[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / discard-locals.s
blob63a70300e39315270cffb47dbc8b60165bda8ab0
1 # REQUIRES: x86
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
28 .globl _start
29 _start:
30 call text@plt
31 jmp .Lused@plt
32 call used@plt
34 .section text,"ax"
35 .Lunused:
36 .Lused:
37 unused:
38 used:
40 .section gc,"ax"
41 .Lunused_gc:
42 unused_gc:
43 ret