summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2elf.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-07-11 12:59:29 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-07-11 12:59:29 +0000
commiteb41f7f081a8e9e20e3cb559c181c1097f94216f (patch)
treebc62810c9b39459210e0e5872c784a3abcfb0021 /llvm/tools/yaml2obj/yaml2elf.cpp
parente195a91d2d6ac9322a4d8899611b4bfd49cadd6c (diff)
downloadbcm5719-llvm-eb41f7f081a8e9e20e3cb559c181c1097f94216f.tar.gz
bcm5719-llvm-eb41f7f081a8e9e20e3cb559c181c1097f94216f.zip
[yaml2obj] - Allow overriding the sh_size field.
There is no way to set broken sh_size field currently for sections. It can be usefull for writing the test cases. Differential revision: https://reviews.llvm.org/D64401 llvm-svn: 365766
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2elf.cpp')
-rw-r--r--llvm/tools/yaml2obj/yaml2elf.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/tools/yaml2obj/yaml2elf.cpp b/llvm/tools/yaml2obj/yaml2elf.cpp
index 735057f6e7d..e821c642c85 100644
--- a/llvm/tools/yaml2obj/yaml2elf.cpp
+++ b/llvm/tools/yaml2obj/yaml2elf.cpp
@@ -270,9 +270,13 @@ bool ELFState<ELFT>::initImplicitHeader(ELFState<ELFT> &State,
else
return false;
- // Override the sh_offset field if requested.
- if (YAMLSec && YAMLSec->ShOffset)
- Header.sh_offset = *YAMLSec->ShOffset;
+ // Override the sh_offset/sh_size fields if requested.
+ if (YAMLSec) {
+ if (YAMLSec->ShOffset)
+ Header.sh_offset = *YAMLSec->ShOffset;
+ if (YAMLSec->ShSize)
+ Header.sh_size = *YAMLSec->ShSize;
+ }
return true;
}
@@ -364,9 +368,13 @@ bool ELFState<ELFT>::initSectionHeaders(ELFState<ELFT> &State,
} else
llvm_unreachable("Unknown section type");
- // Override the sh_offset field if requested.
- if (Sec && Sec->ShOffset)
- SHeader.sh_offset = *Sec->ShOffset;
+ // Override the sh_offset/sh_size fields if requested.
+ if (Sec) {
+ if (Sec->ShOffset)
+ SHeader.sh_offset = *Sec->ShOffset;
+ if (Sec->ShSize)
+ SHeader.sh_size = *Sec->ShSize;
+ }
}
return true;
OpenPOWER on IntegriCloud