41 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o3# RUN: ld.lld -shared %t.o -o %t.so4 5# RUN: echo '.data; .weak foo; .quad foo' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o6# RUN: echo '.data; .quad foo' | llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o7# RUN: ld.lld -shared %t2.o -o %t2.so8 9## If the first undefined reference is weak, the binding changes to10## STB_WEAK.11# RUN: ld.lld %t1.o %t.so -o %t12# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s13# RUN: ld.lld %t.so %t1.o -o %t14# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s15 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 %t18# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s19# RUN: ld.lld %t.so %t1.o %t1.o -o %t20# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s21 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 %t24# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=GLOBAL %s25# RUN: ld.lld %t2.o %t.so %t1.o -o %t26# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=GLOBAL %s27 28## Check the binding (weak) is not affected by the STB_GLOBAL undefined29## reference in %t2.so30# RUN: ld.lld %t1.o %t2.so -o %t31# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s32 33# RUN: ld.lld %t2.so %t1.o -o %t34# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s35 36# WEAK: NOTYPE WEAK DEFAULT UND foo37# GLOBAL: NOTYPE GLOBAL DEFAULT UND foo38 39.globl foo40foo:41