[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / weak-undef-shared.s
blob0b3e0ec78e570075b7fb2e12d6775ea311996072
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3 # RUN: ld.lld -shared %t.o -o %t.so
5 # RUN: echo '.data; .weak foo; .quad foo' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o
6 # RUN: echo '.data; .quad foo' | llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o
7 # RUN: ld.lld -shared %t2.o -o %t2.so
9 ## If the first undefined reference is weak, the binding changes to
10 ## STB_WEAK.
11 # RUN: ld.lld %t1.o %t.so -o %t
12 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s
13 # RUN: ld.lld %t.so %t1.o -o %t
14 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s
16 ## The binding remains STB_WEAK if there is no STB_GLOBAL undefined reference.
17 # RUN: ld.lld %t1.o %t.so %t1.o -o %t
18 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s
19 # RUN: ld.lld %t.so %t1.o %t1.o -o %t
20 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s
22 ## The binding changes back to STB_GLOBAL if there is a STB_GLOBAL undefined reference.
23 # RUN: ld.lld %t1.o %t.so %t2.o -o %t
24 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=GLOBAL %s
25 # RUN: ld.lld %t2.o %t.so %t1.o -o %t
26 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=GLOBAL %s
28 ## Check the binding (weak) is not affected by the STB_GLOBAL undefined
29 ## reference in %t2.so
30 # RUN: ld.lld %t1.o %t2.so -o %t
31 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s
33 # RUN: ld.lld %t2.so %t1.o -o %t
34 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s
36 # WEAK: NOTYPE WEAK DEFAULT UND foo
37 # GLOBAL: NOTYPE GLOBAL DEFAULT UND foo
39 .globl foo
40 foo: