This simplifies the code allowing to set the sh_info
for relocations sections. And adds a missing test.
llvm-svn: 339870
--- /dev/null
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-readobj -sections %t | FileCheck %s
+
+# CHECK: Name: .rela.text
+# CHECK: Type: SHT_RELA
+# CHECK: Flags [
+# CHECK: ]
+# CHECK: Address:
+# CHECK: Offset:
+# CHECK: Size:
+# CHECK: Link:
+# CHECK: Info: 12345
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .rela.text
+ Type: SHT_RELA
+ Link: .symtab
+ Info: 12345
+ Relocations:
SHeader.sh_link = getDotSymTabSecNo();
unsigned Index;
- if (SN2I.lookup(S->Info, Index)) {
- if (S->Info.getAsInteger(0, Index)) {
- WithColor::error() << "Unknown section referenced: '" << S->Info
- << "' at YAML section '" << S->Name << "'.\n";
- return false;
- }
+ if (SN2I.lookup(S->Info, Index) && !to_integer(S->Info, Index)) {
+ WithColor::error() << "Unknown section referenced: '" << S->Info
+ << "' at YAML section '" << S->Name << "'.\n";
+ return false;
}
SHeader.sh_info = Index;