1# RUN: rm -rf %t && mkdir %t && cd %t 2# RUN: yaml2obj %s -o out 3# RUN: llvm-readelf -r out | FileCheck %s 4 5# CHECK: Relocation section '.crel.text' at offset {{.*}} contains 7 entries: 6# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend 7# CHECK-NEXT: 0000000000000001 0000000100000004 R_X86_64_PLT32 0000000000000000 a0 - 4 8# CHECK-NEXT: 0000000000000005 0000000200000004 R_X86_64_PLT32 0000000000000000 a1 - 4 9# CHECK-NEXT: 000000000000000a 0000000300000004 R_X86_64_PLT32 0000000000000000 a2 + 0 10# CHECK-NEXT: 0000000000000010 0000000200000001 R_X86_64_64 0000000000000000 a1 - 4 11# CHECK-NEXT: 0000000000000018 0000000100000001 R_X86_64_64 0000000000000000 a0 + 80 12# CHECK-NEXT: 0000000000000020 0000000000000008 R_X86_64_RELATIVE 8000000000000000{{$}} 13# CHECK-NEXT: 0000000000000028 0000000400000001 R_X86_64_64 0000000000000000 a3 + 7fffffffffffffff 14 15--- !ELF 16FileHeader: 17 Class: ELFCLASS64 18 Data: ELFDATA2LSB 19 Type: ET_REL 20 Machine: EM_X86_64 21Sections: 22 - Name: .text 23 Type: SHT_PROGBITS 24 - Name: .crel.text 25 Type: SHT_CREL 26 Info: .text 27 Link: .symtab 28 Relocations: 29 - Offset: 1 30 Type: R_X86_64_PLT32 31 Symbol: a0 32 Addend: -4 33 - Offset: 5 34 Type: R_X86_64_PLT32 35 Symbol: a1 36 Addend: -4 37 - Offset: 10 38 Type: R_X86_64_PLT32 39 Symbol: a2 40 Addend: 0 41 - Offset: 16 42 Type: R_X86_64_64 43 Symbol: a1 44 Addend: -4 45 - Offset: 24 46 Type: R_X86_64_64 47 Symbol: a0 48 Addend: 128 49 - Offset: 32 50 Type: R_X86_64_RELATIVE 51 Addend: 0x8000000000000000 52 - Offset: 40 53 Type: R_X86_64_64 54 Symbol: a3 55 Addend: 0x7fffffffffffffff 56Symbols: 57 - Name: a0 58 - Name: a1 59 Binding: STB_GLOBAL 60 - Name: a2 61 Binding: STB_GLOBAL 62 - Name: a3 63 Binding: STB_GLOBAL 64 65## See output-limit.yaml. While estimating the size of the last byte of .crel.text 66## (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 the 69## actual file size. 70# RUN: not yaml2obj %s --docnum=2 --max-size=76 -o /dev/null 71# RUN: yaml2obj %s --docnum=2 --max-size=77 -o out 72# RUN: %python -c 'import os; print(os.path.getsize("out"))' | FileCheck %s --check-prefix=SIZE 73 74# SIZE: 69 75 76--- !ELF 77FileHeader: 78 Class: ELFCLASS64 79 Data: ELFDATA2LSB 80 Type: ET_REL 81 Machine: EM_X86_64 82Sections: 83 - Name: .text 84 Type: SHT_PROGBITS 85 - Name: .crel.text 86 Type: SHT_CREL 87 Relocations: 88 - Offset: 1 89 Type: R_X86_64_64 90 Addend: -4 91 - Type: SectionHeaderTable 92 NoHeaders: true 93