llvm.org GIT mirror llvm / d9d6711
[yaml2elf] - Simplify code, add a test. NFC. This simplifies the code allowing to set the sh_info for relocations sections. And adds a missing test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339870 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 1 year, 1 month ago
2 changed file(s) with 29 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
0 # RUN: yaml2obj %s -o %t
1 # RUN: llvm-readobj -sections %t | FileCheck %s
2
3 # CHECK: Name: .rela.text
4 # CHECK: Type: SHT_RELA
5 # CHECK: Flags [
6 # CHECK: ]
7 # CHECK: Address:
8 # CHECK: Offset:
9 # CHECK: Size:
10 # CHECK: Link:
11 # CHECK: Info: 12345
12
13 --- !ELF
14 FileHeader:
15 Class: ELFCLASS64
16 Data: ELFDATA2LSB
17 Type: ET_REL
18 Machine: EM_X86_64
19 Sections:
20 - Name: .rela.text
21 Type: SHT_RELA
22 Link: .symtab
23 Info: 12345
24 Relocations:
260260 SHeader.sh_link = getDotSymTabSecNo();
261261
262262 unsigned Index;
263 if (SN2I.lookup(S->Info, Index)) {
264 if (S->Info.getAsInteger(0, Index)) {
265 WithColor::error() << "Unknown section referenced: '" << S->Info
266 << "' at YAML section '" << S->Name << "'.\n";
267 return false;
268 }
263 if (SN2I.lookup(S->Info, Index) && !to_integer(S->Info, Index)) {
264 WithColor::error() << "Unknown section referenced: '" << S->Info
265 << "' at YAML section '" << S->Name << "'.\n";
266 return false;
269267 }
270268 SHeader.sh_info = Index;
271269