xref: /llvm-project/lld/test/MachO/load-hidden.ll (revision 595fc59f742aeee398eb35ff69182a413a882317)
1*595fc59fSDaniel Bertalan; REQUIRES: x86
2*595fc59fSDaniel Bertalan; RUN: rm -rf %t; split-file %s %t
3*595fc59fSDaniel Bertalan; RUN: llvm-as %t/archive.ll -o %t/archive.o
4*595fc59fSDaniel Bertalan; RUN: llvm-ar rcs %t/archive.a  %t/archive.o
5*595fc59fSDaniel Bertalan; RUN: llvm-as %t/obj.ll -o %t/obj.o
6*595fc59fSDaniel Bertalan
7*595fc59fSDaniel Bertalan; RUN: %lld -dylib -lSystem %t/obj.o -load_hidden %t/archive.a -o %t/test.dylib
8*595fc59fSDaniel Bertalan; RUN: llvm-nm %t/test.dylib | FileCheck %s
9*595fc59fSDaniel Bertalan; CHECK: t _foo
10*595fc59fSDaniel Bertalan
11*595fc59fSDaniel Bertalan;--- archive.ll
12*595fc59fSDaniel Bertalantarget triple = "x86_64-apple-macosx10.15.0"
13*595fc59fSDaniel Bertalantarget datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
14*595fc59fSDaniel Bertalan
15*595fc59fSDaniel Bertalandefine void @foo() noinline optnone {
16*595fc59fSDaniel Bertalan    ret void
17*595fc59fSDaniel Bertalan}
18*595fc59fSDaniel Bertalan
19*595fc59fSDaniel Bertalan;--- obj.ll
20*595fc59fSDaniel Bertalantarget triple = "x86_64-apple-macosx10.15.0"
21*595fc59fSDaniel Bertalantarget datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
22*595fc59fSDaniel Bertalan
23*595fc59fSDaniel Bertalandeclare void @foo();
24*595fc59fSDaniel Bertalan
25*595fc59fSDaniel Bertalandefine void @main() {
26*595fc59fSDaniel Bertalan  call void @foo()
27*595fc59fSDaniel Bertalan  ret void
28*595fc59fSDaniel Bertalan}
29