55a4e89b3b
Some libraries are layered can depend on other libraries on a private paths. That is, libA can depend on libB which is neither on the LD_LIBRARY_PATH nor on a known system path. The posix linker injects "variables" such as @rpath which is expanded at link time to resolve the libraries on a relative path. Prior to this patch, cling's Dyld-based symbol resolution could not trace down such cases causing failures in symbol resolution when a symbol is only defined in libB (a private library). This patch implements the basic posix linker substitutions allowing cling's Dyld-based symbol resolution implementation to follow more closely the linker rules. Kudos Alexander Penev (@alexander-penev).
29 lines
1.3 KiB
C
29 lines
1.3 KiB
C
//------------------------------------------------------------------------------
|
|
// CLING - the C++ LLVM-based InterpreterG :)
|
|
//
|
|
// This file is dual-licensed: you can choose to license it under the University
|
|
// of Illinois Open Source License or the GNU Lesser General Public License. See
|
|
// LICENSE.TXT for details.
|
|
//------------------------------------------------------------------------------
|
|
|
|
// RUN: mkdir -p %t-dir/rlib1
|
|
// RUN: mkdir -p %t-dir/rlib2
|
|
// RUN: mkdir -p %t-dir/lib
|
|
// RUN: %clang -shared -DCLING_EXPORT=%dllexport %S/call_lib_A.c -o%t-dir/rlib1/libcall_lib_A%shlibext
|
|
// RUN: %clang -shared -DCLING_EXPORT=%dllexport %S/call_lib_B.c -o%t-dir/rlib2/libcall_lib_B%shlibext
|
|
// RUN: %clang %fPIC -shared -Wl,--disable-new-dtags -Wl,-rpath,%t-dir/rlib1 -Wl,-rpath,%t-dir/rlib2 -DCLING_EXPORT=%dllexport %S/call_lib_L_AB.c -o%t-dir/lib/libcall_lib_L_AB%shlibext -L %t-dir/rlib1 -L %t-dir/rlib2 -lcall_lib_A -lcall_lib_B
|
|
// RUN: cat %s | %cling -L%t-dir/lib 2>&1 | FileCheck %s
|
|
|
|
// Test: Lookup and load library Lib_L_AB that depends on two libraries Lib_A
|
|
// and Lib_B via RPATH. Lib_A and Lib_B in two different directories
|
|
// and are not in LD_LIBRARY_PATH.
|
|
|
|
extern "C" int cling_testlibrary_function();
|
|
cling_testlibrary_function()
|
|
// CHECK: {{.*}}libcall_lib_L_AB{{.*}}
|
|
.L libcall_lib_L_AB
|
|
cling_testlibrary_function()
|
|
// CHECK: (int) 357
|
|
|
|
.q
|