1; REQUIRES: x86 2;; The LTO code generator may create references which will fetch lazy symbols. 3;; Test that version script local: directives can change the binding of such 4;; symbols to STB_LOCAL. This is a bit complex because the LTO code generator 5;; happens after version script scanning and can change symbols from Lazy to Defined. 6 7; RUN: llvm-as %s -o %t.bc 8; RUN: echo '.globl __udivti3; __udivti3:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o 9 10;; An exact pattern can localize a libcall. 11; RUN: echo '{ global: foo; local: __udivti3; };' > %t.exact.ver 12; RUN: ld.lld -shared --version-script %t.exact.ver %t.bc --start-lib %t1.o --end-lib -o %t.exact.so 13; RUN: llvm-nm %t.exact.so | FileCheck %s 14 15;; A wildcard pattern can localize a libcall. 16; RUN: echo '{ global: foo; local: *; };' > %t.wild.ver 17; RUN: ld.lld -shared --version-script %t.wild.ver %t.bc --start-lib %t1.o --end-lib -o %t.wild.so 18; RUN: llvm-nm %t.wild.so | FileCheck %s 19 20; CHECK: t __udivti3 21; CHECK: T foo 22 23;; Test that --dynamic-list works on such libcall fetched symbols. 24; RUN: echo '{ foo; __udivti3; };' > %t.exact.list 25; RUN: ld.lld -pie --dynamic-list %t.exact.list %t.bc --start-lib %t1.o --end-lib -o %t.exact 26; RUN: llvm-nm %t.exact | FileCheck --check-prefix=LIST %s 27; RUN: echo '{ foo; __udiv*; };' > %t.wild.list 28; RUN: ld.lld -pie --dynamic-list %t.wild.list %t.bc --start-lib %t1.o --end-lib -o %t.wild 29; RUN: llvm-nm %t.wild | FileCheck --check-prefix=LIST %s 30 31; LIST: T __udivti3 32; LIST: T foo 33 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 created 40;; 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 %ret 44} 45