Compare commits
1 Commits
develop
...
fix-rpath-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0a385414e5 |
59
lib/spack/env/cc
vendored
59
lib/spack/env/cc
vendored
@ -482,26 +482,6 @@ if [ "$mode" = vcheck ]; then
|
|||||||
execute
|
execute
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Darwin's linker has a -r argument that merges object files together.
|
|
||||||
# It doesn't work with -rpath.
|
|
||||||
# This variable controls whether they are added.
|
|
||||||
add_rpaths=true
|
|
||||||
if [ "$mode" = ld ] || [ "$mode" = ccld ]; then
|
|
||||||
if [ "${SPACK_SHORT_SPEC#*darwin}" != "${SPACK_SHORT_SPEC}" ]; then
|
|
||||||
for arg in "$@"; do
|
|
||||||
if [ "$arg" = "-r" ]; then
|
|
||||||
if [ "$mode" = ld ] || [ "$mode" = ccld ]; then
|
|
||||||
add_rpaths=false
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
elif [ "$arg" = "-Wl,-r" ] && [ "$mode" = ccld ]; then
|
|
||||||
add_rpaths=false
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Save original command for debug logging
|
# Save original command for debug logging
|
||||||
input_command="$*"
|
input_command="$*"
|
||||||
|
|
||||||
@ -861,13 +841,11 @@ if [ "$mode" = ld ] || [ "$mode" = ccld ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = ccld ] || [ "$mode" = ld ]; then
|
if [ "$mode" = ccld ] || [ "$mode" = ld ]; then
|
||||||
if [ "$add_rpaths" != "false" ]; then
|
# Append RPATH directories. Note that in the case of the
|
||||||
# Append RPATH directories. Note that in the case of the
|
# top-level package these directories may not exist yet. For dependencies
|
||||||
# top-level package these directories may not exist yet. For dependencies
|
# it is assumed that paths have already been confirmed.
|
||||||
# it is assumed that paths have already been confirmed.
|
extend spack_store_rpath_dirs_list SPACK_STORE_RPATH_DIRS
|
||||||
extend spack_store_rpath_dirs_list SPACK_STORE_RPATH_DIRS
|
extend rpath_dirs_list SPACK_RPATH_DIRS
|
||||||
extend rpath_dirs_list SPACK_RPATH_DIRS
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$mode" = ccld ] || [ "$mode" = ld ]; then
|
if [ "$mode" = ccld ] || [ "$mode" = ld ]; then
|
||||||
@ -882,14 +860,10 @@ case "$mode" in
|
|||||||
ld|ccld)
|
ld|ccld)
|
||||||
# Set extra RPATHs
|
# Set extra RPATHs
|
||||||
extend lib_dirs_list SPACK_COMPILER_EXTRA_RPATHS
|
extend lib_dirs_list SPACK_COMPILER_EXTRA_RPATHS
|
||||||
if [ "$add_rpaths" != "false" ]; then
|
extend rpath_dirs_list SPACK_COMPILER_EXTRA_RPATHS
|
||||||
extend rpath_dirs_list SPACK_COMPILER_EXTRA_RPATHS
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set implicit RPATHs
|
# Set implicit RPATHs
|
||||||
if [ "$add_rpaths" != "false" ]; then
|
extend rpath_dirs_list SPACK_COMPILER_IMPLICIT_RPATHS
|
||||||
extend rpath_dirs_list SPACK_COMPILER_IMPLICIT_RPATHS
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add SPACK_LDLIBS to args
|
# Add SPACK_LDLIBS to args
|
||||||
for lib in $SPACK_LDLIBS; do
|
for lib in $SPACK_LDLIBS; do
|
||||||
@ -945,7 +919,8 @@ extend args_list lib_dirs_list "-L"
|
|||||||
extend args_list system_spack_flags_lib_dirs_list "-L"
|
extend args_list system_spack_flags_lib_dirs_list "-L"
|
||||||
extend args_list system_lib_dirs_list "-L"
|
extend args_list system_lib_dirs_list "-L"
|
||||||
|
|
||||||
# RPATHs arguments
|
# RPATH arguments
|
||||||
|
|
||||||
rpath_prefix=""
|
rpath_prefix=""
|
||||||
case "$mode" in
|
case "$mode" in
|
||||||
ccld)
|
ccld)
|
||||||
@ -962,8 +937,20 @@ case "$mode" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# if mode is ccld or ld, extend RPATH lists with the prefix determined above
|
# Darwin's linker has a -r argument that merges object files together.
|
||||||
if [ -n "$rpath_prefix" ]; then
|
# It doesn't work with -rpath. add_rpaths controls whether RPATHs are added.
|
||||||
|
add_rpaths=true
|
||||||
|
if [ "$mode" = ld ] || [ "$mode" = ccld ]; then
|
||||||
|
if [ "${SPACK_SHORT_SPEC#*darwin}" != "${SPACK_SHORT_SPEC}" ]; then
|
||||||
|
args="$@"
|
||||||
|
if contains args "-r" || contains args "-Wl,-r"; then
|
||||||
|
add_rpaths=false
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if mode is ccld or ld, extend RPATH lists, adding the prefix determined above
|
||||||
|
if [ "$add_rpaths" == "true" ] && [ -n "$rpath_prefix" ]; then
|
||||||
extend_unique args_list spack_store_spack_flags_rpath_dirs_list "$rpath_prefix"
|
extend_unique args_list spack_store_spack_flags_rpath_dirs_list "$rpath_prefix"
|
||||||
extend_unique args_list spack_store_rpath_dirs_list "$rpath_prefix"
|
extend_unique args_list spack_store_rpath_dirs_list "$rpath_prefix"
|
||||||
|
|
||||||
|
@ -794,7 +794,6 @@ def test_ld_deps_partial(wrapper_environment):
|
|||||||
+ test_library_paths
|
+ test_library_paths
|
||||||
+ ["-Lxlib"]
|
+ ["-Lxlib"]
|
||||||
+ ["--disable-new-dtags"]
|
+ ["--disable-new-dtags"]
|
||||||
+ test_rpaths
|
|
||||||
+ ["-r"]
|
+ ["-r"]
|
||||||
+ test_args_without_paths,
|
+ test_args_without_paths,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user