93 lines · yaml
1# RUN: rm -rf %t && mkdir %t && cd %t2# RUN: yaml2obj %s -o out3# RUN: llvm-readelf -r out | FileCheck %s4 5# CHECK: Relocation section '.crel.text' at offset {{.*}} contains 7 entries:6# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend7# CHECK-NEXT: 0000000000000001 0000000100000004 R_X86_64_PLT32 0000000000000000 a0 - 48# CHECK-NEXT: 0000000000000005 0000000200000004 R_X86_64_PLT32 0000000000000000 a1 - 49# CHECK-NEXT: 000000000000000a 0000000300000004 R_X86_64_PLT32 0000000000000000 a2 + 010# CHECK-NEXT: 0000000000000010 0000000200000001 R_X86_64_64 0000000000000000 a1 - 411# CHECK-NEXT: 0000000000000018 0000000100000001 R_X86_64_64 0000000000000000 a0 + 8012# CHECK-NEXT: 0000000000000020 0000000000000008 R_X86_64_RELATIVE 8000000000000000{{$}}13# CHECK-NEXT: 0000000000000028 0000000400000001 R_X86_64_64 0000000000000000 a3 + 7fffffffffffffff14 15--- !ELF16FileHeader:17 Class: ELFCLASS6418 Data: ELFDATA2LSB19 Type: ET_REL20 Machine: EM_X86_6421Sections:22 - Name: .text23 Type: SHT_PROGBITS24 - Name: .crel.text25 Type: SHT_CREL26 Info: .text27 Link: .symtab28 Relocations:29 - Offset: 130 Type: R_X86_64_PLT3231 Symbol: a032 Addend: -433 - Offset: 534 Type: R_X86_64_PLT3235 Symbol: a136 Addend: -437 - Offset: 1038 Type: R_X86_64_PLT3239 Symbol: a240 Addend: 041 - Offset: 1642 Type: R_X86_64_6443 Symbol: a144 Addend: -445 - Offset: 2446 Type: R_X86_64_6447 Symbol: a048 Addend: 12849 - Offset: 3250 Type: R_X86_64_RELATIVE51 Addend: 0x800000000000000052 - Offset: 4053 Type: R_X86_64_6454 Symbol: a355 Addend: 0x7fffffffffffffff56Symbols:57 - Name: a058 - Name: a159 Binding: STB_GLOBAL60 - Name: a261 Binding: STB_GLOBAL62 - Name: a363 Binding: STB_GLOBAL64 65## See output-limit.yaml. While estimating the size of the last byte of .crel.text66## (a SLEB128), checkLimit thinks 10 byte headroom is needed while only 1 is used.67## The file end is 1 byte away from the end of .crel.text (one-byte .strtab).68## Therefore, the --max-size= value has to be at least 10-1-1 larger than the69## actual file size.70# RUN: not yaml2obj %s --docnum=2 --max-size=76 -o /dev/null71# RUN: yaml2obj %s --docnum=2 --max-size=77 -o out72# RUN: %python -c 'import os; print(os.path.getsize("out"))' | FileCheck %s --check-prefix=SIZE73 74# SIZE: 6975 76--- !ELF77FileHeader:78 Class: ELFCLASS6479 Data: ELFDATA2LSB80 Type: ET_REL81 Machine: EM_X86_6482Sections:83 - Name: .text84 Type: SHT_PROGBITS85 - Name: .crel.text86 Type: SHT_CREL87 Relocations:88 - Offset: 189 Type: R_X86_64_6490 Addend: -491 - Type: SectionHeaderTable92 NoHeaders: true93