diff options
author | Georgii Rymar <grimar@accesssoftek.com> | 2019-10-28 13:30:05 +0300 |
---|---|---|
committer | Georgii Rymar <grimar@accesssoftek.com> | 2019-10-29 11:09:12 +0300 |
commit | 5b118a0471435751f39eeb92d56ecc3956053304 (patch) | |
tree | bf63bbed8c429a3bb4a095a6df6b6196bde0e0e5 /llvm/lib/ObjectYAML/ELFEmitter.cpp | |
parent | 5a955cc8b95a88fd0489d9b0a36ec86941ba6337 (diff) | |
download | bcm5719-llvm-5b118a0471435751f39eeb92d56ecc3956053304.tar.gz bcm5719-llvm-5b118a0471435751f39eeb92d56ecc3956053304.zip |
[yaml2obj] - Improve handling of the SHT_GROUP section.
Currently, when we do not specify "Info" field in a YAML description
for SHT_GROUP section, yaml2obj reports an error:
"error: unknown symbol referenced: '' by YAML section '.group1'"
Also, we do not link it with a symbol table by default,
though it is what we do for AddrsigSection, HashSection, RelocationSection.
(http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_link)
The patch fixes missings mentioned.
Differential revision: https://reviews.llvm.org/D69299
Diffstat (limited to 'llvm/lib/ObjectYAML/ELFEmitter.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/ELFEmitter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp index d5cdb85eab5..6a4e00c6285 100644 --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -791,10 +791,16 @@ void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader, assert(Section.Type == llvm::ELF::SHT_GROUP && "Section type is not SHT_GROUP"); + unsigned Link = 0; + if (Section.Link.empty() && SN2I.lookup(".symtab", Link)) + SHeader.sh_link = Link; + SHeader.sh_entsize = 4; SHeader.sh_size = SHeader.sh_entsize * Section.Members.size(); - SHeader.sh_info = - toSymbolIndex(Section.Signature, Section.Name, /*IsDynamic=*/false); + + if (Section.Signature) + SHeader.sh_info = + toSymbolIndex(*Section.Signature, Section.Name, /*IsDynamic=*/false); raw_ostream &OS = CBA.getOSAndAlignedOffset(SHeader.sh_offset, SHeader.sh_addralign); |