1# REQUIRES: x86 2# LINK_ORDER cnamed sections are not kept alive by the __start_* reference. 3 4# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 5# RUN: ld.lld --gc-sections -z start-stop-gc -z nostart-stop-gc %t.o -o %t 6# RUN: llvm-objdump --section-headers -t %t | FileCheck %s 7 8## With -z start-stop-gc (default), non-SHF_LINK_ORDER C identifier name 9## sections are not retained by __start_/__stop_ references. 10# RUN: ld.lld --gc-sections %t.o -o %t 11# RUN: llvm-readelf -S -s %t | FileCheck %s --check-prefix=GC 12# RUN: ld.lld --gc-sections -z start-stop-gc %t.o -o %t1 13# RUN: llvm-readelf -S -s %t1 | FileCheck %s --check-prefix=GC 14 15# CHECK: Sections: 16# CHECK-NOT: yy 17# CHECK: xx {{.*}} DATA 18# CHECK-NOT: yy 19 20# CHECK: SYMBOL TABLE: 21# CHECK: xx 0000000000000000 .protected __start_xx 22# CHECK: w *UND* 0000000000000000 __start_yy 23 24# GC: Section Headers: 25# GC-NOT: xx 26# GC-NOT: yy 27 28# GC: WEAK DEFAULT UND __start_xx 29# GC: WEAK DEFAULT UND __start_yy 30 31.weak __start_xx 32.weak __start_yy 33 34.global _start 35_start: 36.quad __start_xx 37.quad __start_yy 38 39.section xx,"a" 40.quad 0 41 42.section .foo,"a" 43.quad 0 44 45.section yy,"ao",@progbits,.foo 46.quad 0 47