brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 489571c Raw
75 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t; split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/archive-foo.s -o %t/archive-foo.o4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/archive-baz.s -o %t/archive-baz.o5# RUN: llvm-ar rcs %t/libfoo.a %t/archive-foo.o6# RUN: llvm-ar rcs %t/libbaz.a %t/archive-baz.o7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/obj.s -o %t/obj.o8# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/obj-bar.s -o %t/obj-bar.o9 10# RUN: %lld -dylib -lSystem %t/obj.o -load_hidden %t/libfoo.a -o %t/test.dylib11# RUN: llvm-nm %t/test.dylib | FileCheck %s12# RUN: %lld -dylib -lSystem -L%t %t/obj.o -hidden-lfoo -o %t/test2.dylib13# RUN: llvm-nm %t/test2.dylib | FileCheck %s14# CHECK-DAG: t _foo15# CHECK-DAG: d _bar16 17## If an archive has already been loaded without -load_hidden earlier in the command line,18## -load_hidden does not have an effect.19# RUN: %lld -dylib -lSystem %t/obj.o %t/libfoo.a -load_hidden %t/libfoo.a -o %t/test-regular-then-hidden.dylib20# RUN: llvm-nm %t/test-regular-then-hidden.dylib | FileCheck %s --check-prefix=REGULAR-THEN-HIDDEN21# REGULAR-THEN-HIDDEN-DAG: T _foo22# REGULAR-THEN-HIDDEN-DAG: D _bar23 24## If -load_hidden comes first, the symbols will have hidden visibility.25# RUN: %lld -dylib -lSystem %t/obj.o -load_hidden %t/libfoo.a %t/libfoo.a -o %t/test-hidden-then-regular.dylib26# RUN: llvm-nm %t/test-hidden-then-regular.dylib | FileCheck %s --check-prefix=HIDDEN-THEN-REGULAR27# HIDDEN-THEN-REGULAR-DAG: t _foo28# HIDDEN-THEN-REGULAR-DAG: d _bar29 30## If both -load_hidden and -force_load are specified, the earlier one will have an effect.31# RUN: %lld -dylib -lSystem %t/obj.o %t/libfoo.a -force_load %t/libbaz.a -load_hidden %t/libbaz.a -o %t/test-force-then-hidden.dylib32# RUN: llvm-nm %t/test-force-then-hidden.dylib | FileCheck %s --check-prefix=FORCE-THEN-HIDDEN33# FORCE-THEN-HIDDEN: T _baz34# RUN: %lld -dylib -lSystem %t/obj.o %t/libfoo.a -load_hidden %t/libbaz.a -force_load %t/libbaz.a -o %t/test-hidden-then-force.dylib35# RUN: llvm-nm %t/test-hidden-then-force.dylib | FileCheck %s --check-prefix=HIDDEN-THEN-FORCE36# HIDDEN-THEN-FORCE-NOT: _baz37 38## -load_hidden does not cause the library to be loaded eagerly.39# RUN: %lld -dylib -lSystem %t/obj.o -load_hidden %t/libfoo.a -load_hidden %t/libbaz.a -o %t/test-lazy.dylib40# RUN: llvm-nm %t/test-lazy.dylib | FileCheck %s --check-prefix=LAZY41# LAZY-NOT: _baz42 43## Specifying the same library twice is fine.44# RUN: %lld -dylib -lSystem %t/obj.o -load_hidden %t/libfoo.a -load_hidden %t/libfoo.a -o %t/test-twice.dylib45# RUN: llvm-nm %t/test-twice.dylib | FileCheck %s --check-prefix=TWICE46# TWICE-DAG: t _foo47# TWICE-DAG: d _bar48 49## -load_hidden causes the symbols to have "private external" visibility, so duplicate definitions50## are not allowed.51# RUN: not %lld -dylib -lSystem %t/obj.o %t/obj-bar.o -load_hidden %t/libfoo.a 2>&1 | FileCheck %s --check-prefix=DUP52# DUP: error: duplicate symbol: _bar53 54#--- archive-foo.s55.globl _foo56_foo:57 58.data59.globl _bar60_bar:61 62#--- archive-baz.s63.globl _baz64_baz:65 66#--- obj-bar.s67.data68.globl _bar69_bar:70 71#--- obj.s72.globl _test73_test:74    call _foo75