1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[yaml2obj] - Teach yaml2obj to produce SHT_GROUP section with a custom Info field.

This allows to set custom Info field value for SHT_GROUP sections.

It is useful to allow this because we would be able to replace at least one binary
object committed in LLD and replace it with the yaml2obj based test.

Differential revision: https://reviews.llvm.org/D50776

llvm-svn: 339772
This commit is contained in:
George Rimar 2018-08-15 13:55:22 +00:00
parent 96aa6b1e55
commit ec11a04ab3
2 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,27 @@
# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj -sections %t | FileCheck %s
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .group
Type: SHT_GROUP
Link: .symtab
Info: 12345
Members:
- SectionOrType: GRP_COMDAT
## Check we are able to produce SHT_GROUP section with a custom Info value (12345).
# CHECK: Name: .group
# CHECK-NEXT: Type: SHT_GROUP
# CHECK-NEXT: Flags [
# CHECK-NEXT: ]
# CHECK-NEXT: Address:
# CHECK-NEXT: Offset:
# CHECK-NEXT: Size:
# CHECK-NEXT: Link:
# CHECK-NEXT: Info: 12345

View File

@ -274,7 +274,7 @@ bool ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders,
return false;
} else if (auto S = dyn_cast<ELFYAML::Group>(Sec.get())) {
unsigned SymIdx;
if (SymN2I.lookup(S->Info, SymIdx)) {
if (SymN2I.lookup(S->Info, SymIdx) && !to_integer(S->Info, SymIdx)) {
WithColor::error() << "Unknown symbol referenced: '" << S->Info
<< "' at YAML section '" << S->Name << "'.\n";
return false;