[sanitizer][MIPS] Add --target flag for MIPS32

Without the --target flag, clang uses the mips64 triple which selects the n64 abi. We need to add --target=mips-linux-gnu, so that clang can select the correct abi for mips32r2.

Reviewers: dsanders, kcc, samsonov
Subscribers: llvm-commits, mohit.bhakkad, jaydeep
Differential Revision: http://reviews.llvm.org/D9249

llvm-svn: 237675
This commit is contained in:
Sagar Thakur 2015-05-19 09:07:37 +00:00
parent ccb59ec9b5
commit 3ee5bd9377
4 changed files with 8 additions and 4 deletions

View File

@ -196,11 +196,11 @@ else()
# FIXME: Ideally, we would build the N32 library too.
if("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "mipsel|mips64el")
# regex for mipsel, mips64el
test_target_arch(mipsel "" "-mips32r2")
test_target_arch(mips64el "" "-mips64r2 -mabi=n64")
test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
test_target_arch(mips64el "" "-mips64r2" "-mabi=n64")
else()
test_target_arch(mips "" "-mips32r2")
test_target_arch(mips64 "" "-mips64r2 -mabi=n64")
test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
test_target_arch(mips64 "" "-mips64r2" "-mabi=n64")
endif()
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "arm")
test_target_arch(arm "" "-march=armv7-a")
@ -226,6 +226,7 @@ function(filter_available_targets out_var)
set(${out_var} ${archs} PARENT_SCOPE)
endfunction()
# Returns a list of architecture specific target cflags in @out_var list.
function(get_target_flags_for_arch arch out_var)
list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
if(ARCH_INDEX EQUAL -1)

View File

@ -28,6 +28,7 @@ foreach(arch ${ASAN_SUPPORTED_ARCH})
set(ASAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
else()
get_target_flags_for_arch(${arch} ASAN_TEST_TARGET_CFLAGS)
string(REPLACE ";" " " ASAN_TEST_TARGET_CFLAGS "${ASAN_TEST_TARGET_CFLAGS}")
endif()
if(ANDROID)
set(ASAN_TEST_DYNAMIC True)

View File

@ -28,6 +28,7 @@ foreach(tool ${SUPPORTED_TOOLS})
${COMPILER_RT_TEST_COMPILER_CFLAGS})
else()
get_target_flags_for_arch(${arch} SANITIZER_COMMON_TEST_TARGET_CFLAGS)
string(REPLACE ";" " " SANITIZER_COMMON_TEST_TARGET_CFLAGS "${SANITIZER_COMMON_TEST_TARGET_CFLAGS}")
endif()
set(CONFIG_NAME ${tool}-${arch}-${OS_NAME})
configure_lit_site_cfg(

View File

@ -22,6 +22,7 @@ foreach(arch ${UBSAN_SUPPORTED_ARCH})
set(UBSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
else()
get_target_flags_for_arch(${arch} UBSAN_TEST_TARGET_CFLAGS)
string(REPLACE ";" " " UBSAN_TEST_TARGET_CFLAGS "${UBSAN_TEST_TARGET_CFLAGS}")
endif()
add_ubsan_testsuite("Standalone" ubsan ${arch})