diff options
author | Lang Hames <lhames@gmail.com> | 2016-08-06 00:54:43 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2016-08-06 00:54:43 +0000 |
commit | 62a459603c2b9cf219a3102146d285a860f1cef7 (patch) | |
tree | d6bc18afd1c375f03e3edb701169ef3eb9f6ab8a /llvm/test/ExecutionEngine/OrcLazy/weak-function.ll | |
parent | 000ca1850d85fb4e70ed275c7b73c6a0c15bfd82 (diff) | |
download | bcm5719-llvm-62a459603c2b9cf219a3102146d285a860f1cef7.tar.gz bcm5719-llvm-62a459603c2b9cf219a3102146d285a860f1cef7.zip |
[ORC] Add (partial) weak symbol support to the CompileOnDemand layer.
This adds partial support for weak functions to the CompileOnDemandLayer by
modifying the addLogicalModule method to check for existing stub definitions
before building a new stub for a weak function. This scheme is sufficient to
support ODR definitions, but fails for general weak definitions if strong
definition is encountered after the first weak definition. (A more extensive
refactor will be required to fully support weak symbols).
This patch does *not* add weak symbol support to RuntimeDyld: I hope to add
that in the near future.
llvm-svn: 277896
Diffstat (limited to 'llvm/test/ExecutionEngine/OrcLazy/weak-function.ll')
-rw-r--r-- | llvm/test/ExecutionEngine/OrcLazy/weak-function.ll | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/ExecutionEngine/OrcLazy/weak-function.ll b/llvm/test/ExecutionEngine/OrcLazy/weak-function.ll new file mode 100644 index 00000000000..86c962e677e --- /dev/null +++ b/llvm/test/ExecutionEngine/OrcLazy/weak-function.ll @@ -0,0 +1,28 @@ +; RUN: lli -jit-kind=orc-lazy -extra-module %p/Inputs/weak-function-2.ll %s +; +; Check that functions in two different modules agree on the address of weak +; function 'baz' +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.12.0" + +define linkonce_odr i32 @baz() { +entry: + ret i32 0 +} + +define i8* @foo() { +entry: + ret i8* bitcast (i32 ()* @baz to i8*) +} + +declare i8* @bar() + +define i32 @main(i32 %argc, i8** %argv) { +entry: + %call = tail call i8* @foo() + %call1 = tail call i8* @bar() + %cmp = icmp ne i8* %call, %call1 + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + |