45 lines · plain
1; REQUIRES: x862;; The LTO code generator may create references which will fetch lazy symbols.3;; Test that version script local: directives can change the binding of such4;; symbols to STB_LOCAL. This is a bit complex because the LTO code generator5;; happens after version script scanning and can change symbols from Lazy to Defined.6 7; RUN: llvm-as %s -o %t.bc8; RUN: echo '.globl __udivti3; __udivti3:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o9 10;; An exact pattern can localize a libcall.11; RUN: echo '{ global: foo; local: __udivti3; };' > %t.exact.ver12; RUN: ld.lld -shared --version-script %t.exact.ver %t.bc --start-lib %t1.o --end-lib -o %t.exact.so13; RUN: llvm-nm %t.exact.so | FileCheck %s14 15;; A wildcard pattern can localize a libcall.16; RUN: echo '{ global: foo; local: *; };' > %t.wild.ver17; RUN: ld.lld -shared --version-script %t.wild.ver %t.bc --start-lib %t1.o --end-lib -o %t.wild.so18; RUN: llvm-nm %t.wild.so | FileCheck %s19 20; CHECK: t __udivti321; CHECK: T foo22 23;; Test that --dynamic-list works on such libcall fetched symbols.24; RUN: echo '{ foo; __udivti3; };' > %t.exact.list25; RUN: ld.lld -pie --dynamic-list %t.exact.list %t.bc --start-lib %t1.o --end-lib -o %t.exact26; RUN: llvm-nm %t.exact | FileCheck --check-prefix=LIST %s27; RUN: echo '{ foo; __udiv*; };' > %t.wild.list28; RUN: ld.lld -pie --dynamic-list %t.wild.list %t.bc --start-lib %t1.o --end-lib -o %t.wild29; RUN: llvm-nm %t.wild | FileCheck --check-prefix=LIST %s30 31; LIST: T __udivti332; LIST: T foo33 34target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"35target triple = "x86_64-unknown-linux-gnu"36 37declare i64 @llvm.udiv.fix.i64(i64, i64, i32)38 39;; The symbol table does not record __udivti3, but the reference will be created40;; on the fly.41define i64 @foo(i64 %x, i64 %y) {42 %ret = call i64 @llvm.udiv.fix.i64(i64 %x, i64 %y, i32 31)43 ret i64 %ret44}45