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
4 changes: 0 additions & 4 deletions compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,6 @@ if (COMPILER_RT_TEST_STANDALONE_BUILD_LIBS)
if ("${COMPILER_RT_TEST_COMPILER_ID}" MATCHES "Clang")
list(APPEND COMPILER_RT_UNITTEST_LINK_FLAGS "-resource-dir=${COMPILER_RT_OUTPUT_DIR}")
endif()
get_compiler_rt_output_dir(${COMPILER_RT_DEFAULT_TARGET_ARCH} rtlib_dir)
if (NOT WIN32)
list(APPEND COMPILER_RT_UNITTEST_LINK_FLAGS "-Wl,-rpath,${rtlib_dir}")
endif()
endif()

if(COMPILER_RT_USE_LLVM_UNWINDER)
Expand Down
13 changes: 13 additions & 0 deletions compiler-rt/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ function(get_target_link_flags_for_arch arch out_var)
endif()
endfunction()

# Returns a list of architecture specific dynamic ldflags in @out_var list.
function(get_dynamic_link_flags_for_arch arch out_var)
list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
if(ARCH_INDEX EQUAL -1)
message(FATAL_ERROR "Unsupported architecture: ${arch}")
else()
get_compiler_rt_output_dir(${arch} rtlib_dir)
if (NOT WIN32)
set(${out_var} "-Wl,-rpath,${rtlib_dir}" PARENT_SCOPE)
endif()
endif()
endfunction()

# Returns a compiler and CFLAGS that should be used to run tests for the
# specific architecture. When cross-compiling, this is controled via
# COMPILER_RT_TEST_COMPILER and COMPILER_RT_TEST_COMPILER_CFLAGS.
Expand Down
4 changes: 3 additions & 1 deletion compiler-rt/lib/asan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,15 @@ function(add_asan_tests arch test_runtime)
-Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames
)
else()
set(DYNAMIC_LINK_FLAGS)
get_dynamic_link_flags_for_arch(${arch} DYNAMIC_LINK_FLAGS)

# Otherwise, reuse ASAN_INST_TEST_OBJECTS.
add_compiler_rt_test(AsanDynamicUnitTests "${dynamic_test_name}" "${arch}"
SUBDIR "${CONFIG_NAME_DYNAMIC}"
OBJECTS ${ASAN_INST_TEST_OBJECTS}
DEPS asan ${ASAN_INST_TEST_OBJECTS}
LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS} ${TARGET_LINK_FLAGS}
LINK_FLAGS ${ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINK_FLAGS} ${TARGET_LINK_FLAGS} ${DYNAMIC_LINK_FLAGS}
)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/asan/Unit/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ config.test_source_root = config.test_exec_root
# host triple as the trailing path component. The value is incorrect for i386
# tests on x86_64 hosts and vice versa. Adjust config.compiler_rt_libdir
# accordingly.
if config.enable_per_target_runtime_dir and config.target_arch != config.host_arch:
if config.enable_per_target_runtime_dir:
if config.target_arch == 'i386':
config.compiler_rt_libdir = re.sub(r'/x86_64(?=-[^/]+$)', '/i386', config.compiler_rt_libdir)
elif config.target_arch == 'x86_64':
Expand Down