[yaml2obj] - Allow setting the custom Address for .strtab
Despite the fact that .strtab is non-allocatable,
there is no reason to disallow setting the custom address
for it.
The patch also adds a test case showing we can set any address
we want for other implicit sections.
Differential revision: https://reviews.llvm.org/D63137
llvm-svn: 363368
diff --git a/llvm/tools/yaml2obj/yaml2elf.cpp b/llvm/tools/yaml2obj/yaml2elf.cpp
index cd61561..098c3d6 100644
--- a/llvm/tools/yaml2obj/yaml2elf.cpp
+++ b/llvm/tools/yaml2obj/yaml2elf.cpp
@@ -489,10 +489,9 @@
else if (Name == ".dynstr")
SHeader.sh_flags = ELF::SHF_ALLOC;
- // If .dynstr section is explicitly described in the YAML
+ // If the section is explicitly described in the YAML
// then we want to use its section address.
- // TODO: Allow this for any explicitly described section.
- if (YAMLSec && Name == ".dynstr")
+ if (YAMLSec)
SHeader.sh_addr = YAMLSec->Address;
}