Index: External/SPEC/CINT2000/186.crafty/CMakeLists.txt =================================================================== --- External/SPEC/CINT2000/186.crafty/CMakeLists.txt +++ External/SPEC/CINT2000/186.crafty/CMakeLists.txt @@ -26,7 +26,7 @@ list(APPEND CPPFLAGS -DHAS_LONGLONG) endif() -list(APPEND LDFLAGS -Wl,-zmuldefs) +list(APPEND LDFLAGS ${LD_MULTIDEF_FLAG}) set(SourceNames attacks.c Index: External/SPEC/CINT2000/300.twolf/CMakeLists.txt =================================================================== --- External/SPEC/CINT2000/300.twolf/CMakeLists.txt +++ External/SPEC/CINT2000/300.twolf/CMakeLists.txt @@ -1,6 +1,6 @@ list(APPEND CPPFLAGS -DHAVE_SIGNED_CHAR) list(APPEND LDFLAGS -lm) -list(APPEND LDFLAGS -Wl,-zmuldefs) +list(APPEND LDFLAGS ${LD_MULTIDEF_FLAG}) list(APPEND CFLAGS -Wno-return-type) macro(test_input run_type) Index: External/SPEC/SpecCPU2000.cmake =================================================================== --- External/SPEC/SpecCPU2000.cmake +++ External/SPEC/SpecCPU2000.cmake @@ -1,4 +1,5 @@ include(External) +include(CheckCSourceCompiles) llvm_externals_find(TEST_SUITE_SPEC2000_ROOT "speccpu2000" "SPEC CPU2000") if(TEST_SUITE_SPEC2000_ROOT) # SPEC supports three "run types": ref, train and test @@ -33,4 +34,12 @@ function(llvm_test_data_spec_default target) llvm_test_data_spec(${target} data) endfunction() + + set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,-zmuldefs") + check_c_source_compiles("int main() { return 0; };" LINKER_SUPPORTS_ZMULTIDEFS) + + set(LINKER_MULTIDEF_FLAGS) + if (LINKER_SUPPORTS_ZMULTIDEFS) + set(LD_MULTIDEF_FLAG "-Wl,-zmuldefs") + endif () endif()