[SandboxIR][Doc] Add Quick start notes (#123992)
[llvm-project.git] / lld / test / ELF / linkerscript / discard-section-dynsym.s
blobf5d483dca86ec2334d7671b2bc18307546dd9601
1 # REQUIRES: aarch64
3 ## We allow discarding .dynsym, check we don't crash.
4 # RUN: rm -rf %t && split-file %s %t && cd %t
5 # RUN: llvm-mc -filetype=obj -triple=aarch64 a.s -o a.o
6 # RUN: llvm-mc -filetype=obj -triple=aarch64 c.s -o c.o
7 # RUN: ld.lld -shared --version-script=c.ver c.o -o c.so
9 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.dynsym) } }' > 1.lds
10 # RUN: ld.lld -shared -T 1.lds a.o c.so -o out1.so
11 # RUN: llvm-readelf -Sr out1.so | FileCheck %s --check-prefixes=CHECK,CHECK1
13 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.dynsym .dynstr) } }' > 2.lds
14 # RUN: ld.lld -shared -T 2.lds a.o c.so -o out2.so
15 # RUN: llvm-readelf -Sr out2.so | FileCheck %s --check-prefixes=CHECK,CHECK2
17 # CHECK: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
18 # CHECK-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
19 # CHECK-NEXT: [ 1] .gnu.version VERSYM 0000000000000000 {{.*}} 000006 02 A 0 0 2
20 # CHECK1-NEXT: [ 2] .gnu.version_r VERNEED 0000000000000008 {{.*}} 000020 00 A 5 1 4
21 # CHECK2-NEXT: [ 2] .gnu.version_r VERNEED 0000000000000008 {{.*}} 000020 00 A 0 1 4
22 # CHECK1: [ 5] .dynstr STRTAB
24 # CHECK: contains 2 entries:
25 # CHECK: R_AARCH64_RELATIVE [[#]]
26 # CHECK-NEXT: R_AARCH64_GLOB_DAT 0{{$}}
28 #--- a.s
29 adrp x9, :got:var
30 ldr x9, [x9, :got_lo12:var]
31 bl __libc_start_main
33 .data
34 .align 8
35 foo:
36 .quad foo
38 #--- c.s
39 .globl __libc_start_main
40 __libc_start_main:
42 #--- c.ver
43 GLIBC_2.34 { __libc_start_main; };