2 # RUN: llvm-mc -filetype=obj -triple=x86_64 -save-temp-labels %s -o %t.o
4 # RUN: ld.lld --discard-locals %t.o -o %tlocal
5 # RUN: llvm-readelf -s %tlocal | FileCheck --check-prefixes=DISCARD-LOCALS,DISCARD-LOCALS-NOGC %s
7 ## --gc-sections can discard symbols relative to GCed sections (including STT_SECTION).
8 # RUN: ld.lld --discard-locals --gc-sections %t.o -o %tlocal.gc
9 # RUN: llvm-readelf -s %tlocal.gc | FileCheck --check-prefix=DISCARD-LOCALS %s
11 # RUN: ld.lld --discard-all %t.o -o %tall
12 # RUN: llvm-readelf -s %tall | FileCheck --check-prefix=DISCARD-ALL %s
14 # RUN: ld.lld --discard-all --gc-sections %t.o -o %tall.gc
15 # RUN: llvm-readelf -s %tall.gc | FileCheck --check-prefix=DISCARD-ALL %s
17 ## --discard-locals removes local symbols which start with ".L"
18 # DISCARD-LOCALS: 0: {{0+}} 0 NOTYPE LOCAL DEFAULT UND
19 # DISCARD-LOCALS-NEXT: NOTYPE LOCAL DEFAULT {{.*}} used
20 # DISCARD-LOCALS-NEXT: NOTYPE LOCAL DEFAULT {{.*}} unused
21 # DISCARD-LOCALS-NOGC-NEXT: NOTYPE LOCAL DEFAULT {{.*}} unused_gc
22 # DISCARD-LOCALS-NEXT: NOTYPE GLOBAL DEFAULT {{.*}} _start
24 ## --discard-all removes all regular local symbols.
25 # DISCARD-ALL: 0: {{0+}} 0 NOTYPE LOCAL DEFAULT UND
26 # DISCARD-ALL-NEXT: NOTYPE GLOBAL DEFAULT {{.*}} _start