summaryrefslogtreecommitdiff
path: root/test/Linker
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-14 06:49:45 +0000
committerChris Lattner <sabre@nondot.org>2008-07-14 06:49:45 +0000
commitd1ec48c641f76d4c0e5b7cb357a1333d4fb75c4a (patch)
tree3d1ecbd6559d1eb32d37371a04a7ff980f218213 /test/Linker
parent0bb8757997392ee18ca9de0f1fab29463f8e7aeb (diff)
downloadllvm-d1ec48c641f76d4c0e5b7cb357a1333d4fb75c4a.tar.gz
llvm-d1ec48c641f76d4c0e5b7cb357a1333d4fb75c4a.tar.bz2
llvm-d1ec48c641f76d4c0e5b7cb357a1333d4fb75c4a.tar.xz
implement linking of globals to functions, in one direction
(replacing a function with a global). This is needed when building llvm itself with LTO on darwin, because of the EXPLICIT_SYMBOL hack in lib/system/DynamicLibrary.cpp. Implementation of linking the other way will need to wait for a cleanup of LinkFunctionProtos. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53546 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Linker')
-rw-r--r--test/Linker/link-global-to-func.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Linker/link-global-to-func.ll b/test/Linker/link-global-to-func.ll
new file mode 100644
index 0000000000..b492e52d80
--- /dev/null
+++ b/test/Linker/link-global-to-func.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as %s -o %t1.bc -f
+; RUN: echo {declare void @__eprintf(i8*, i8*, i32, i8*) noreturn define void @foo() { tail call void @__eprintf( i8* undef, i8* undef, i32 4, i8* null ) noreturn nounwind unreachable }} | llvm-as -o %t2.bc -f
+; RUN: llvm-link %t2.bc %t1.bc -o - | llvm-dis | grep __eprintf
+; RN: llvm-link %t1.bc %t2.bc -o - | llvm-dis | grep __eprintf
+
+; rdar://6072702
+
+@__eprintf = external global i8* ; <i8**> [#uses=1]
+
+define i8* @test() {
+ %A = load i8** @__eprintf ; <i8*> [#uses=1]
+ ret i8* %A
+}