96 lines · plain
1# RUN: llvm-mc -triple riscv64-unknown-linux-gnu -filetype obj %s -o %t2# RUN: llvm-readobj -r %t | FileCheck %s3# RUN: llvm-objdump -s %t | FileCheck %s --check-prefix=CONTENT4 5# CHECK: Relocations [6# CHECK-NEXT: Section ({{.*}}) .rela.note {7# CHECK-NEXT: 0x0 R_RISCV_ADD64 extern 0x08# CHECK-NEXT: 0x0 R_RISCV_SUB64 note 0x09# CHECK-NEXT: }10# CHECK-NEXT: Section ({{.*}}) .rela.rodata {11# CHECK-NEXT: 0x0 R_RISCV_ADD64 extern 0x012# CHECK-NEXT: 0x0 R_RISCV_SUB64 rodata 0x013# CHECK-NEXT: }14# CHECK-NEXT: Section ({{.*}}) .rela.alloc_w {15# CHECK-NEXT: 0x0 R_RISCV_ADD64 extern 0x016# CHECK-NEXT: 0x0 R_RISCV_SUB64 w 0x017# CHECK-NEXT: 0x8 R_RISCV_ADD64 w 0x018# CHECK-NEXT: 0x8 R_RISCV_SUB64 extern 0x019# CHECK-NEXT: 0x10 R_RISCV_ADD32 x 0x020# CHECK-NEXT: 0x10 R_RISCV_SUB32 w 0x021# CHECK-NEXT: 0x18 R_RISCV_ADD32 .L.str 0x022# CHECK-NEXT: 0x18 R_RISCV_SUB32 w 0x023# CHECK-NEXT: }24# CHECK-NEXT: Section ({{.*}}) .rela.alloc_x {25# CHECK-NEXT: 0x0 R_RISCV_ADD64 y 0x026# CHECK-NEXT: 0x0 R_RISCV_SUB64 x 0x027# CHECK-NEXT: }28# CHECK-NEXT: Section ({{.*}}) .rela.alloc_y {29# CHECK-NEXT: 0x0 R_RISCV_ADD64 x 0x030# CHECK-NEXT: 0x0 R_RISCV_SUB64 y 0x031# CHECK-NEXT: }32# CHECK-NEXT: Section ({{.*}}) .rela.nonalloc_w {33# CHECK-NEXT: 0x0 R_RISCV_ADD64 extern 0x034# CHECK-NEXT: 0x0 R_RISCV_SUB64 nw 0x035# CHECK-NEXT: 0x8 R_RISCV_ADD64 nw 0x036# CHECK-NEXT: 0x8 R_RISCV_SUB64 extern 0x037# CHECK-NEXT: }38# CHECK-NEXT: Section ({{.*}}) .rela.nonalloc_x {39# CHECK-NEXT: 0x0 R_RISCV_ADD64 ny 0x040# CHECK-NEXT: 0x0 R_RISCV_SUB64 nx 0x041# CHECK-NEXT: }42# CHECK-NEXT: Section ({{.*}}) .rela.nonalloc_y {43# CHECK-NEXT: 0x0 R_RISCV_ADD64 nx 0x044# CHECK-NEXT: 0x0 R_RISCV_SUB64 ny 0x045# CHECK-NEXT: }46# CHECK-NEXT: ]47 48# CONTENT: Contents of section .alloc_w:49# CONTENT-NEXT: 0000 00000000 00000000 00000000 0000000050# CONTENT-NEXT: 0010 00000000 1c000000 0000000051 52.section .note,"a",@note; note:53.quad extern-note54.section .rodata,"a",@progbits; rodata:55.quad extern-rodata56 57.section .alloc_w,"aw",@progbits; w:58.quad extern-w # extern is undefined59.quad w-extern60.long x-w # A is later defined in another section61.long w1-w # A is later defined in the same section62.long .L.str-w # A is temporary63w1:64 65.section .alloc_x,"aw",@progbits; x:66.quad y-x67.section .alloc_y,"aw",@progbits; y:68.quad x-y69 70.section .nonalloc_w; nw:71.quad extern-nw72.quad nw-extern73.section .nonalloc_x; nx:74.quad ny-nx75.section .nonalloc_y; ny:76.quad nx-ny77 78## -gdwarf-aranges generated assembly expects no relocation.79## Otherwise, a .Lsec_end0 symbol (defined at the end of .rodata.str1.1)80## will be rejected by linkers.81.section .rodata.str1.1,"aMS",@progbits,182.L.str:83 .asciz "hello"84.section .rodata.str1.1,"aMS",@progbits,185.Lsec_end0:86.section .debug_aranges,"",@progbits87.quad .Lsec_end0-.L.str88 89## .apple_names/.apple_types are fixed-size and do not need fixups.90## llvm-dwarfdump --apple-names does not process R_RISCV_{ADD,SUB}32 in them.91## See llvm/test/DebugInfo/Generic/accel-table-hash-collisions.ll92 .section .apple_types93 .word 094 .word .Ltypes0-.apple_types95.Ltypes0:96