175 lines · plain
1# REQUIRES: x862 3# RUN: yaml2obj --docnum=1 %s -o %t1.o4# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s5# ERR: error: {{.*}}: R_X86_64_GOTTPOFF must be used in MOVQ or ADDQ instructions only6# ERR: error: {{.*}}: R_X86_64_GOTTPOFF must be used in MOVQ or ADDQ instructions only7 8## YAML below contains 2 relocations of type R_X86_64_GOTTPOFF, and a .text9## with fake content filled by 0xFF. That means instructions for relaxation are10## "broken", so they does not match any known valid relaxations. We also generate11## .tls section because we need it for correct processing of STT_TLS symbol.12--- !ELF13FileHeader:14 Class: ELFCLASS6415 Data: ELFDATA2LSB16 OSABI: ELFOSABI_FREEBSD17 Type: ET_REL18 Machine: EM_X86_6419Sections:20 - Type: SHT_PROGBITS21 Name: .text22 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]23 AddressAlign: 0x0424 Content: "FFFFFFFFFFFFFFFF"25 - Type: SHT_PROGBITS26 Name: .tls27 Flags: [ SHF_ALLOC, SHF_TLS ]28 - Type: SHT_REL29 Name: .rel.text30 Link: .symtab31 Info: .text32 AddressAlign: 0x0433 Relocations:34 - Offset: 435 Symbol: foo36 Type: R_X86_64_GOTTPOFF37 - Offset: 438 Symbol: foo39 Type: R_X86_64_GOTTPOFF40Symbols:41 - Name: foo42 Type: STT_TLS43 Section: .text44 Value: 0x1234545 Size: 446 Binding: STB_GLOBAL47 48 49# RUN: yaml2obj --docnum=2 %s -o %t2.o50# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR2 %s51# ERR2: error: {{.*}}: invalid prefix with R_X86_64_CODE_4_GOTTPOFF!52# ERR2: error: {{.*}}: invalid prefix with R_X86_64_CODE_6_GOTTPOFF!53 54## YAML below contains 2 relocations of55## R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_6_GOTTPOFF type, and a .text with56## fake content filled by 0xFF. It's expected to get "invalid prefix" error57## message as above.58--- !ELF59FileHeader:60 Class: ELFCLASS6461 Data: ELFDATA2LSB62 OSABI: ELFOSABI_FREEBSD63 Type: ET_REL64 Machine: EM_X86_6465Sections:66 - Type: SHT_PROGBITS67 Name: .text68 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]69 AddressAlign: 0x0470 Content: "FFFFFFFFFFFFFFFFFFFF"71 - Type: SHT_PROGBITS72 Name: .tls73 Flags: [ SHF_ALLOC, SHF_TLS ]74 - Type: SHT_REL75 Name: .rel.text76 Link: .symtab77 Info: .text78 AddressAlign: 0x0479 Relocations:80 - Offset: 481 Symbol: foo82 Type: R_X86_64_CODE_4_GOTTPOFF83 - Offset: 684 Symbol: foo85 Type: R_X86_64_CODE_6_GOTTPOFF86Symbols:87 - Name: foo88 Type: STT_TLS89 Section: .text90 Value: 0x1234591 Size: 492 Binding: STB_GLOBAL93 94 95# RUN: yaml2obj --docnum=3 %s -o %t3.o96# RUN: not ld.lld %t3.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR3 %s97# ERR3: error: {{.*}}: R_X86_64_CODE_4_GOTTPOFF must be used in MOVQ or ADDQ instructions only98 99## YAML below contains R_X86_64_CODE_4_GOTTPOFF relocation type, and a .text100## with fake content filled by 0xd5, 0xFF, ... and 0xFF. It's expected to get101## the error message as above.102--- !ELF103FileHeader:104 Class: ELFCLASS64105 Data: ELFDATA2LSB106 OSABI: ELFOSABI_FREEBSD107 Type: ET_REL108 Machine: EM_X86_64109Sections:110 - Type: SHT_PROGBITS111 Name: .text112 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]113 AddressAlign: 0x04114 Content: "d5FFFFFFFFFFFFFFFFFF"115 - Type: SHT_PROGBITS116 Name: .tls117 Flags: [ SHF_ALLOC, SHF_TLS ]118 - Type: SHT_REL119 Name: .rel.text120 Link: .symtab121 Info: .text122 AddressAlign: 0x04123 Relocations:124 - Offset: 4125 Symbol: foo126 Type: R_X86_64_CODE_4_GOTTPOFF127Symbols:128 - Name: foo129 Type: STT_TLS130 Section: .text131 Value: 0x12345132 Size: 4133 Binding: STB_GLOBAL134 135 136# RUN: yaml2obj --docnum=4 %s -o %t4.o137# RUN: not ld.lld %t4.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR4 %s138# ERR4: error: {{.*}}: R_X86_64_CODE_6_GOTTPOFF must be used in ADDQ instructions with NDD/NF/NDD+NF only139 140## YAML below contains R_X86_64_CODE_6_GOTTPOFF relocation type, and a .text141## with fake content filled by 0x62, 0xFF, ... and 0xFF. It's expected to get142## the error message as above.143--- !ELF144FileHeader:145 Class: ELFCLASS64146 Data: ELFDATA2LSB147 OSABI: ELFOSABI_FREEBSD148 Type: ET_REL149 Machine: EM_X86_64150Sections:151 - Type: SHT_PROGBITS152 Name: .text153 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]154 AddressAlign: 0x04155 Content: "62FFFFFFFFFFFFFFFFFF"156 - Type: SHT_PROGBITS157 Name: .tls158 Flags: [ SHF_ALLOC, SHF_TLS ]159 - Type: SHT_REL160 Name: .rel.text161 Link: .symtab162 Info: .text163 AddressAlign: 0x04164 Relocations:165 - Offset: 6166 Symbol: foo167 Type: R_X86_64_CODE_6_GOTTPOFF168Symbols:169 - Name: foo170 Type: STT_TLS171 Section: .text172 Value: 0x12345173 Size: 4174 Binding: STB_GLOBAL175