70 lines · plain
1# REQUIRES: riscv2## Test RISC-V specific section layout. See also section-layout.s and riscv-gp.s.3 4# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32.o5# RUN: ld.lld -pie %t.32.o -o %t.326# RUN: llvm-readelf -S -sX %t.32 | FileCheck %s --check-prefix=NOSDATA7# RUN: llvm-mc -filetype=obj -triple=riscv32 --defsym=SDATA=1 %s -o %t.32s.o8# RUN: ld.lld -pie %t.32s.o -o %t.32s9# RUN: llvm-readelf -S -sX %t.32s | FileCheck %s10 11# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64.o12# RUN: ld.lld -pie %t.64.o -o %t.6413# RUN: llvm-readelf -S -sX %t.64 | FileCheck %s --check-prefix=NOSDATA14# RUN: llvm-mc -filetype=obj -triple=riscv64 --defsym=SDATA=1 %s -o %t.64s.o15# RUN: ld.lld -pie %t.64s.o -o %t.64s16# RUN: llvm-readelf -S -sX %t.64s | FileCheck %s17 18# NOSDATA: .rodata PROGBITS19# NOSDATA-NEXT: .text PROGBITS20# NOSDATA-NEXT: .tdata PROGBITS [[#%x,TDATA:]]21# NOSDATA-NEXT: .tbss NOBITS22# NOSDATA-NEXT: .dynamic DYNAMIC23# NOSDATA-NEXT: .got PROGBITS24# NOSDATA-NEXT: .relro_padding NOBITS25# NOSDATA-NEXT: .data PROGBITS [[#%x,DATA:]]26# NOSDATA-NEXT: .bss NOBITS [[#%x,BSS:]]27 28## If there is an undefined reference to __global_pointer$ but .sdata doesn't29## exist, define __global_pointer$ and set its st_shndx arbitrarily to 1.30## The symbol value should not be used by the program.31 32# NOSDATA-DAG: [[#]]: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] (.text) _etext33# NOSDATA-DAG: [[#]]: {{0*}}[[#BSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.data) _edata34# NOSDATA-DAG: [[#]]: {{0*}}[[#BSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.bss) __bss_start35# NOSDATA-DAG: [[#]]: {{0*}}800 0 NOTYPE GLOBAL DEFAULT 1 (.dynsym) __global_pointer$36 37# CHECK: .rodata PROGBITS38# CHECK-NEXT: .srodata PROGBITS39# CHECK-NEXT: .text PROGBITS40# CHECK-NEXT: .tdata PROGBITS41# CHECK-NEXT: .tbss NOBITS42# CHECK-NEXT: .dynamic DYNAMIC43# CHECK-NEXT: .got PROGBITS44# CHECK-NEXT: .relro_padding NOBITS45# CHECK-NEXT: .data PROGBITS46# CHECK-NEXT: .sdata PROGBITS [[#%x,SDATA:]]47# CHECK-NEXT: .sbss NOBITS [[#%x,SBSS:]]48# CHECK-NEXT: .bss NOBITS49 50# CHECK-DAG: [[#]]: {{0*}}[[#SBSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.sdata) _edata51# CHECK-DAG: [[#]]: {{0*}}[[#SBSS]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.sbss) __bss_start52# CHECK-DAG: [[#]]: {{0*}}[[#SDATA+0x800]] 0 NOTYPE GLOBAL DEFAULT [[#]] (.sdata) __global_pointer$53 54.globl _etext, _edata, __bss_start55 lla gp, __global_pointer$56 57.section .rodata,"a",@progbits; .space 158.section .data,"aw",@progbits; .long _GLOBAL_OFFSET_TABLE_ - .59.section .bss,"aw",@nobits; .space 160.section .tdata,"awT",@progbits; .space 161.section .tbss,"awT",@nobits; .space 162.ifdef SDATA63.section .sdata,"aw",@progbits; .space 164.section .sdata.suffix,"aw",@progbits; .space 165.section .sbss,"aw",@nobits; .space 166.section .sbss.suffix,"aw",@nobits; .space 167.section .srodata,"a",@progbits; .space 168.section .srodata.suffix,"a",@progbits; .space 169.endif70