brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 569cd3c Raw
65 lines · plain
1## Check that group members are retained or discarded as a unit.2 3# REQUIRES: x864 5# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o6# RUN: ld.lld %t.o --gc-sections -o %t7# RUN: llvm-readelf -s %t | FileCheck %s8 9# RUN: echo ".global __start___data; __start___data:" > %t2.s10# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t2.s -o %t2.o11# RUN: ld.lld -shared %t2.o --soname=t2 -o %t2.so12# RUN: ld.lld %t.o --gc-sections -o %t2 %t2.so13# RUN: llvm-readelf -s %t2 | FileCheck %s14 15## The referenced __data is retained.16# CHECK:     [[#%x,ADDR:]] {{.*}} __start___data17# CHECK:     [[#ADDR + 8]] {{.*}} __stop___data18## __libc_atexit is retained even if there is no reference, as a workaround for19## glibc<2.34 (BZ #27492).20# CHECK:     [[#%x,ADDR:]] {{.*}} __start___libc_atexit21# CHECK:     [[#ADDR + 8]] {{.*}} __stop___libc_atexit22# CHECK:     _start23# CHECK:     f24# CHECK-NOT: g25 26## If -z nostart-stop-gc, sections whose names are C identifiers are retained by27## __start_/__stop_ references.28# RUN: ld.lld %t.o %t2.so --gc-sections -z nostart-stop-gc -o %t329# RUN: llvm-readelf -s %t3 | FileCheck %s --check-prefix=NOGC30# NOGC:     [[#%x,ADDR:]] {{.*}} __start___data31# NOGC:     [[#ADDR + 16]] {{.*}} __stop___data32 33.weak __start___data34.weak __stop___data35.weak __start___libc_atexit36.weak __stop___libc_atexit37 38.section .text,"ax",@progbits39.global _start40_start:41  .quad __start___data - .42  .quad __stop___data - .43  .quad __start___libc_atexit - .44  .quad __stop___libc_atexit - .45  call f46 47.section __data,"axG",@progbits,f48.quad 049 50.section .text.f,"axG",@progbits,f51.global f52f:53  nop54 55.section __data,"axG",@progbits,g56.quad 057 58.section .text.g,"axG",@progbits,g59.global g60g:61  nop62 63.section __libc_atexit,"a",@progbits64.quad 065