Don't use OS/arch suffix for installed ldc-rt lib copies

LDC's concept is different lib dirs per target triple, so the extra
suffix isn't needed and only complicates matters.

The lib names are now streamlined across targets; they already were on
Windows.
This commit is contained in:
Martin Kinkelin 2018-09-01 23:35:12 +02:00
parent 34707d6faa
commit 281efb6655
2 changed files with 21 additions and 19 deletions

View file

@ -831,24 +831,24 @@ if (LDC_INSTALL_LLVM_RUNTIME_LIBS)
# Note: libFuzzer is part of compiler-rt version >= 6.0, but was part of LLVM =< 5.0
if(APPLE)
copy_compilerrt_lib("darwin/libclang_rt.asan_osx_dynamic.dylib" "libldc_rt.asan_osx_dynamic.dylib" TRUE)
copy_compilerrt_lib("darwin/libclang_rt.osx.a" "libldc_rt.osx.a" FALSE)
copy_compilerrt_lib("darwin/libclang_rt.profile_osx.a" "libldc_rt.profile_osx.a" FALSE)
copy_compilerrt_lib("darwin/libclang_rt.asan_osx_dynamic.dylib" "libldc_rt.asan.dylib" TRUE)
copy_compilerrt_lib("darwin/libclang_rt.osx.a" "libldc_rt.builtins.a" FALSE)
copy_compilerrt_lib("darwin/libclang_rt.profile_osx.a" "libldc_rt.profile.a" FALSE)
if(NOT (LDC_LLVM_VER LESS 600))
copy_compilerrt_lib("darwin/libclang_rt.fuzzer_osx.a" "libldc_rt.fuzzer_osx.a" FALSE)
copy_compilerrt_lib("darwin/libclang_rt.xray_osx.a" "libldc_rt.xray_osx.a" FALSE)
copy_compilerrt_lib("darwin/libclang_rt.fuzzer_osx.a" "libldc_rt.fuzzer.a" FALSE)
copy_compilerrt_lib("darwin/libclang_rt.xray_osx.a" "libldc_rt.xray.a" FALSE)
endif()
elseif(UNIX)
set(LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH "x86_64" CACHE STRING "Non-Mac Posix: architecture used as libname suffix for the compiler-rt source libraries.")
copy_compilerrt_lib("linux/libclang_rt.asan-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.asan-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" FALSE)
copy_compilerrt_lib("linux/libclang_rt.builtins-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.builtins-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" FALSE)
copy_compilerrt_lib("linux/libclang_rt.profile-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.profile-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" FALSE)
copy_compilerrt_lib("linux/libclang_rt.asan-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.asan.a" FALSE)
copy_compilerrt_lib("linux/libclang_rt.builtins-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.builtins.a" FALSE)
copy_compilerrt_lib("linux/libclang_rt.profile-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.profile.a" FALSE)
if(NOT (LDC_LLVM_VER LESS 500))
copy_compilerrt_lib("linux/libclang_rt.xray-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.xray-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" FALSE)
copy_compilerrt_lib("linux/libclang_rt.xray-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.xray.a" FALSE)
endif()
if(NOT (LDC_LLVM_VER LESS 600))
copy_compilerrt_lib("linux/libclang_rt.fuzzer-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.fuzzer-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" FALSE)
copy_compilerrt_lib("linux/libclang_rt.fuzzer-${LDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH}.a" "libldc_rt.fuzzer.a" FALSE)
endif()
elseif(WIN32)
set(compilerrt_arch_suffix "x86_64")

View file

@ -200,8 +200,8 @@ llvm::StringRef getCompilerRTArchName(const llvm::Triple &triple) {
}
// Appends arch suffix and extension.
// E.g., for name="libldc_rt.fuzzer" and sharedLibrary=false, returns
// "libldc_rt.fuzzer_osx.a" on Darwin.
// E.g., for name="libclang_rt.fuzzer" and sharedLibrary=false, returns
// "libclang_rt.fuzzer_osx.a" on Darwin.
std::string getCompilerRTLibFilename(const llvm::Twine &name,
const llvm::Triple &triple,
bool sharedLibrary) {
@ -247,7 +247,7 @@ void appendFullLibPathCandidates(std::vector<std::string> &paths,
// Returns candidates of full paths to a compiler-rt lib.
// E.g., for baseName="asan" and sharedLibrary=false, returns something like
// [ "<libDir>/libldc_rt.asan_osx.a",
// [ "<libDir>/libldc_rt.asan.a",
// "<libDir>/libclang_rt.asan_osx.a",
// "<libDir>/clang/6.0.0/lib/darwin/libclang_rt.asan_osx.a" ].
std::vector<std::string>
@ -256,7 +256,9 @@ getFullCompilerRTLibPathCandidates(llvm::StringRef baseName,
bool sharedLibrary = false) {
std::vector<std::string> r;
const auto ldcRT =
getCompilerRTLibFilename("libldc_rt." + baseName, triple, sharedLibrary);
("libldc_rt." + baseName +
(!sharedLibrary ? ".a" : triple.isOSDarwin() ? ".dylib" : ".so"))
.str();
appendFullLibPathCandidates(r, ldcRT);
const auto clangRT = getCompilerRTLibFilename("libclang_rt." + baseName,
triple, sharedLibrary);