summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorGeorgii Rymar <grimar@accesssoftek.com>2019-10-28 13:30:05 +0300
committerGeorgii Rymar <grimar@accesssoftek.com>2019-10-29 11:09:12 +0300
commit5b118a0471435751f39eeb92d56ecc3956053304 (patch)
treebf63bbed8c429a3bb4a095a6df6b6196bde0e0e5 /llvm/lib
parent5a955cc8b95a88fd0489d9b0a36ec86941ba6337 (diff)
downloadbcm5719-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')
-rw-r--r--llvm/lib/ObjectYAML/ELFEmitter.cpp10
-rw-r--r--llvm/lib/ObjectYAML/ELFYAML.cpp2
2 files changed, 9 insertions, 3 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);
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index ad316be85e8..f362b9c23a7 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1069,7 +1069,7 @@ static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) {
static void groupSectionMapping(IO &IO, ELFYAML::Group &Group) {
commonSectionMapping(IO, Group);
- IO.mapOptional("Info", Group.Signature, StringRef());
+ IO.mapOptional("Info", Group.Signature);
IO.mapRequired("Members", Group.Members);
}
OpenPOWER on IntegriCloud