brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.4 KiB · 04df909 Raw
231 lines · plain
1# RUN: yaml2obj --docnum=1 %s -o %t2# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=LLVM --match-full-lines3# RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=GNU --match-full-lines4 5# LLVM:      Relocations [6# LLVM-NEXT:   Section ([[#]]) .crel.text {7# LLVM-NEXT:     0x1 R_X86_64_32 g1 0x18# LLVM-NEXT:     0x2 R_X86_64_64 l1 0x29# LLVM-NEXT:     0x0 R_X86_64_32S g1 0xFFFFFFFFFFFFFFFF10# LLVM-NEXT:     0x4 R_X86_64_32S .text 0x800000000000000011# LLVM-NEXT:   }12# LLVM-NEXT:   Section ([[#]]) .crelnonalloc {13# LLVM-NEXT:     0x10 R_X86_64_64 g1 0x114# LLVM-NEXT:     0x20 R_X86_64_64 g2 0x215# LLVM-NEXT:   }16# LLVM-NEXT: ]17 18# GNU:      Relocation section '.crel.text' at offset 0x48 contains 4 entries:19# GNU-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend20# GNU-NEXT: 0000000000000001  000000030000000a R_X86_64_32            0000000000000000 g1 + 121# GNU-NEXT: 0000000000000002  0000000200000001 R_X86_64_64            0000000000000000 l1 + 222# GNU-NEXT: 0000000000000000  000000030000000b R_X86_64_32S           0000000000000000 g1 - 123# GNU-NEXT: 0000000000000004  000000010000000b R_X86_64_32S           0000000000000000 .text - 800000000000000024# GNU-EMPTY:25# GNU-NEXT: Relocation section '.crelnonalloc' at offset 0xa2 contains 2 entries:26# GNU-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend27# GNU-NEXT: 0000000000000010  0000000300000001 R_X86_64_64            0000000000000000 g1 + 128# GNU-NEXT: 0000000000000020  0000000400000001 R_X86_64_64            0000000000000000 g2 + 229 30--- !ELF31FileHeader: !FileHeader32  Class: ELFCLASS6433  Data: ELFDATA2LSB34  Type: ET_REL35  Machine: EM_X86_6436 37Sections:38- Name: .text39  Type: SHT_PROGBITS40  Content: "0000000000000000"41  Flags: [SHF_ALLOC]42- Name: .crel.text43  Type: SHT_CREL44  Info: .text45  Link: .symtab46  Relocations:47    - Offset: 0x148      Symbol: g149      Type:   R_X86_64_3250      Addend: 151    - Offset: 0x252      Symbol: l153      Type:   R_X86_64_6454      Addend: 255    - Offset: 0x056      Symbol: g157      Type:   R_X86_64_32S58      Addend: 0xffffffffffffffff59    - Offset: 0x460      Symbol: .text61      Type:   R_X86_64_32S62      Addend: 0x800000000000000063- Name: nonalloc64  Type: SHT_PROGBITS65  Size: 0x3066- Name: .crelnonalloc67  Type: SHT_CREL68  Info: nonalloc69  Link: .symtab70  Relocations:71    - Offset: 0x1072      Symbol: g173      Type:   R_X86_64_6474      Addend: 175    - Offset: 0x2076      Symbol: g277      Type:   R_X86_64_6478      Addend: 279 80Symbols:81  - Name: .text82    Type: STT_SECTION83    Section: .text84  - Name:    l185  - Name:    g186    Section: .text87    Value:   0x088    Size:    489    Binding: STB_GLOBAL90  - Name:    g291    Binding: STB_GLOBAL92 93## Check relocation formatting on ELFCLASS32 as well.94# RUN: yaml2obj --docnum=2 %s -o %t295# RUN: llvm-readobj -r %t2 | FileCheck %s --check-prefix=LLVM2 --match-full-lines96# RUN: llvm-readelf -r %t2 | FileCheck %s --check-prefix=GNU2 --match-full-lines97 98# LLVM2:      Relocations [99# LLVM2-NEXT:   Section (2) .crel.text {100# LLVM2-NEXT:     0x8 R_386_PC32 l1 0x1101# LLVM2-NEXT:     0x4 R_386_32 g1 0x0102# LLVM2-NEXT:   }103# LLVM2-NEXT: ]104 105# GNU2:      Relocation section '.crel.text' at offset {{.*}} contains 2 entries:106# GNU2-NEXT:  Offset     Info    Type                Sym. Value  Symbol's Name + Addend107# GNU2-NEXT: 00000008  00000102 R_386_PC32             00000000   l1 + 1108# GNU2-NEXT: 00000004  00000201 R_386_32               00000000   g1 + 0109 110--- !ELF111FileHeader:112  Class:   ELFCLASS32113  Data:    ELFDATA2LSB114  Type:    ET_REL115  Machine: EM_386116Sections:117- Name: .text118  Type: SHT_PROGBITS119  Size: 0x10120- Name: .crel.text121  Type: SHT_CREL122  Info: .text123  Link: .symtab124  Relocations:125    - Offset: 0x8126      Symbol: l1127      Type:   R_386_PC32128      Addend: 1129    - Offset: 0x4130      Symbol: g1131      Type:   R_386_32132Symbols:133  - Name:    l1134  - Name:    g1135    Binding: STB_GLOBAL136 137## Check CREL with implicit addends.138# RUN: yaml2obj --docnum=3 %s -o %t3139# RUN: llvm-readobj -r %t3 | FileCheck %s --check-prefix=LLVM3 --match-full-lines140# RUN: llvm-readelf -r %t3 | FileCheck %s --check-prefix=GNU3 --match-full-lines141 142# LLVM3:      Relocations [143# LLVM3-NEXT:   Section (3) .crel.data {144# LLVM3-NEXT:     0x1F R_X86_64_32 g1145# LLVM3-NEXT:     0x3F R_X86_64_64 g1146# LLVM3-NEXT:     0x0 R_X86_64_32S l1147# LLVM3-NEXT:   }148# LLVM3-NEXT: ]149 150# GNU3:      Relocation section '.crel.data' at offset {{.*}} contains 3 entries:151# GNU3-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name152# GNU3-NEXT: 000000000000001f  000000030000000a R_X86_64_32            0000000000000000 g1153# GNU3-NEXT: 000000000000003f  0000000300000001 R_X86_64_64            0000000000000000 g1154# GNU3-NEXT: 0000000000000000  000000020000000b R_X86_64_32S           0000000000000000 l1155--- !ELF156FileHeader:157  Class:     ELFCLASS64158  Data:      ELFDATA2LSB159  Type:      ET_REL160  Machine:   EM_X86_64161Sections:162  - Name:    .text163    Type:    SHT_PROGBITS164  - Name:    .data165    Type:    SHT_PROGBITS166  - Name:    .crel.data167    Type:    SHT_CREL168    Flags:   [ SHF_INFO_LINK ]169    Link:    .symtab170    Info:    .data171    Content: 187f030a82017787feffffffffffffff077f0a172Symbols:173  - Name:    .text174    Type:    STT_SECTION175    Section: .text176  - Name:    l1177    Section: .text178  - Name:    g1179    Section: .text180    Binding: STB_GLOBAL181 182## Test errors. See also relocation-errors.test.183# RUN: yaml2obj --docnum=4 %s -o %t.err184# RUN: llvm-readobj -r %t.err 2>&1 | FileCheck %s --check-prefix=ERR-LLVM -DFILE=%t.err185# RUN: llvm-readelf -r %t.err 2>&1 | FileCheck %s --check-prefix=ERR-GNU -DFILE=%t.err186 187# ERR-LLVM:      Section ([[#]]) .crel.data {188# ERR-LLVM-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_CREL section with index 3: unable to decode LEB128 at offset 0x00000000: malformed uleb128, extends past end189# ERR-LLVM-NEXT: }190 191# ERR-GNU: warning: '[[FILE]]': unable to get the number of relocations in SHT_CREL section with index 3: unable to decode LEB128 at offset 0x00000000: malformed uleb128, extends past end192# ERR-GNU-EMPTY:193# ERR-GNU-NEXT: Relocation section '.crel.data' at offset 0x40 contains <?> entries:194# ERR-GNU-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name195# ERR-GNU-NOT:  {{.}}196 197# RUN: yaml2obj --docnum=4 -DCONTENT=08 %s -o %t.err2198# RUN: llvm-readobj -r %t.err2 2>&1 | FileCheck %s --check-prefix=ERR2-LLVM -DFILE=%t.err2199# RUN: llvm-readelf -r %t.err2 2>&1 | FileCheck %s --check-prefix=ERR2-GNU -DFILE=%t.err2200 201# ERR2-LLVM:      Section ([[#]]) .crel.data {202# ERR2-LLVM-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_CREL section with index 3: unexpected end of data at offset 0x1 while reading [0x1, 0x2)203# ERR2-LLVM-NEXT: }204 205# ERR2-GNU:      Relocation section '.crel.data' at offset 0x40 contains 1 entries:206# ERR2-GNU-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name207# ERR2-GNU:      warning: '[[FILE]]': unable to read relocations from SHT_CREL section with index 3: unexpected end of data at offset 0x1 while reading [0x1, 0x2)208# ERR2-GNU-NOT:  {{.}}209 210--- !ELF211FileHeader:212  Class:     ELFCLASS64213  Data:      ELFDATA2LSB214  Type:      ET_REL215  Machine:   EM_X86_64216Sections:217  - Name:    .text218    Type:    SHT_PROGBITS219  - Name:    .data220    Type:    SHT_PROGBITS221  - Name:    .crel.data222    Type:    SHT_CREL223    Flags:   []224    Link:    .symtab225    Info:    .data226    Content: [[CONTENT=""]]227Symbols:228  - Name:    .text229    Type:    STT_SECTION230    Section: .text231