Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/Input/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ bool Input::resolvePath(const LinkerConfig &PConfig) {
}

if (Type == Input::Script) {
if (PSearchDirs.hasSysRoot() &&
(FileName.size() > 0 && FileName[0] == '/')) {
ResolvedPath = PSearchDirs.sysroot();
ResolvedPath->append(FileName);
}
if (!llvm::sys::fs::exists(ResolvedPath->native())) {
const sys::fs::Path *P = PSearchDirs.find(FileName, Input::Script);
if (P != nullptr)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Simple library with exported functions
int exported_func_v1() { return 1; }
int exported_func_v2() { return 2; }
int hidden_func() { return 3; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
exported_func_v1;
exported_func_v2;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
global:
exported_func_v1;
local:
*;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#---VersionAndDynamicScripts.test---- sysRoot ----------------#

#BEGIN_COMMENT
# Test that the version scripts and dynamic lists paths are properly handled
# when sysroot is used.
#END_COMMENT
#START_TEST
RUN: %clang %clangopts -o %t1.1.o %p/Inputs/1.c -c
RUN: %rm -rf %t1.sysroot %t1.dir
RUN: %mkdir %t.sysroot
RUN: %link %linkopts -o %t1.lib1.so %t1.1.o -shared --sysroot=%t.sysroot -L=/ \
RUN: --version-script=%p/Inputs/version.script --verbose 2>&1 \
RUN: | %filecheck %s --check-prefix VersionScriptAbs
RUN: %link %linkopts -o %t1.lib2.so %t1.1.o -shared --sysroot=%t.sysroot -L=/ \
RUN: --dynamic-list=%p/Inputs/dynamic.list --verbose 2>&1 \
RUN: | %filecheck %s --check-prefix DynScriptAbs
RUN: %mkdir %t1.dir
RUN: cd %t1.dir
RUN: %link %linkopts -o %t1.lib1.so %t1.1.o -shared --sysroot=%p/Inputs -L=/ \
RUN: --version-script=version.script --verbose 2>&1 \
RUN: | %filecheck %s --check-prefix VersionScriptSysRoot
RUN: %link %linkopts -o %t1.lib2.so %t1.1.o -shared --sysroot=%p/Inputs -L=/ \
RUN: --dynamic-list=dynamic.list --verbose 2>&1 \
RUN: | %filecheck %s --check-prefix DynScriptSysRoot
RUN: cp %p/Inputs/version.script version.script
RUN: cp %p/Inputs/dynamic.list dynamic.list
RUN: %link %linkopts -o %t1.lib1.so %t1.1.o -shared --sysroot=%p/Inputs -L=/ \
RUN: --version-script=version.script --verbose 2>&1 \
RUN: | %filecheck %s --check-prefix VersionScriptRel
RUN: %link %linkopts -o %t1.lib2.so %t1.1.o -shared --sysroot=%p/Inputs -L=/ \
RUN: --dynamic-list=dynamic.list --verbose 2>&1 \
RUN: | %filecheck %s --check-prefix DynScriptSysRel
#END_TEST

VersionScriptAbs: Verbose: Parsing version script

DynScriptAbs: Verbose: Dynamic List[{{.*}}] : exported_func_v1
DynScriptAbs: Verbose: Dynamic List[{{.*}}] : exported_func_v2

VersionScriptSysRoot: Verbose: Trying to open input `{{.*}}/Inputs//version.script' of type `linker script' for namespec `version.script': found
DynScriptSysRoot: Verbose: Trying to open input `{{.*}}/Inputs//dynamic.list' of type `linker script' for namespec `dynamic.list': found

VersionScriptRel: Verbose: Mapping input file 'version.script' into memory
DynScriptSysRel: Verbose: Mapping input file 'dynamic.list' into memory
Loading