yaxunl created this revision. yaxunl added reviewers: MaskRay, tra. Herald added a subscriber: dberris. Herald added a project: All. yaxunl requested review of this revision.
The compiler-rt library path has changed to {resource_dir}/lib/{triple} from {resource_dir}/lib/{OS}/{arch} but the rpath has not been updated. This causes rpath not really added. https://reviews.llvm.org/D146686 Files: clang/lib/Driver/ToolChain.cpp clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/arm-unknown-linux/.keep clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/i386-unknown-linux/.keep clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/.keep clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/.keep clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/.keep clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/.keep clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/x86_64-unknown-linux-android/.keep clang/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/x86_64-unknown-linux/.keep clang/test/Driver/arch-specific-libdir-rpath.c clang/test/Driver/arch-specific-libdir.c Index: clang/test/Driver/arch-specific-libdir.c =================================================================== --- clang/test/Driver/arch-specific-libdir.c +++ clang/test/Driver/arch-specific-libdir.c @@ -1,5 +1,5 @@ // Test that the driver adds an arch-specific subdirectory in -// {RESOURCE_DIR}/lib/linux to the search path. +// {RESOURCE_DIR}/lib/{triple} to the search path. // // RUN: %clang %s -### 2>&1 -target i386-unknown-linux \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ @@ -11,7 +11,7 @@ // // RUN: %clang %s -### 2>&1 -target i686-unknown-linux \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ -// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s +// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i686 %s // // RUN: %clang %s -### 2>&1 -target i686-unknown-linux \ // RUN: -resource-dir=%S/Inputs/resource_dir \ @@ -43,10 +43,11 @@ // // // FILEPATH: "-x" "c" "[[FILE_PATH:.*]]{{(/|\\\\).*}}.c" -// ARCHDIR-i386: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)i386}} -// ARCHDIR-x86_64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}} -// ARCHDIR-arm: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)arm}} -// ARCHDIR-aarch64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}} +// ARCHDIR-i386: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)i386-unknown-linux}} +// ARCHDIR-i686: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)i686-unknown-linux}} +// ARCHDIR-x86_64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}} +// ARCHDIR-arm: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)arm-unknown-linux}} +// ARCHDIR-aarch64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)aarch64-unknown-linux}} // // Have a stricter check for no-archdir - that the driver doesn't add any // subdirectory from the provided resource directory. Index: clang/test/Driver/arch-specific-libdir-rpath.c =================================================================== --- clang/test/Driver/arch-specific-libdir-rpath.c +++ clang/test/Driver/arch-specific-libdir-rpath.c @@ -49,7 +49,7 @@ // RUN: %clang %s -### 2>&1 -target x86_64-linux-android -fsanitize=address \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ // RUN: -frtlib-add-rpath \ -// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s +// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64-ANDROID,RPATH-X86_64-ANDROID %s // // Add LIBPATH, RPATH for OpenMP // RUN: %clang %s -### 2>&1 -target x86_64-linux -fopenmp \ @@ -77,14 +77,17 @@ // RESDIR: "-resource-dir" "[[RESDIR:[^"]*]]" // -// LIBPATH-X86_64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}} -// RPATH-X86_64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}" +// LIBPATH-X86_64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}} +// RPATH-X86_64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}}" +// +// LIBPATH-X86_64-ANDROID: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux-android}} +// RPATH-X86_64-ANDROID: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux-android}}" // -// NO-LIBPATH-X86_64-NOT: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}} -// NO-RPATH-X86_64-NOT: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}" +// NO-LIBPATH-X86_64-NOT: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}} +// NO-RPATH-X86_64-NOT: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}}" // -// LIBPATH-AARCH64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}} -// RPATH-AARCH64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}}" +// LIBPATH-AARCH64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)aarch64-unknown-linux}} +// RPATH-AARCH64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)aarch64-unknown-linux}}" // // NO-LIBPATH-NOT: "-L{{[^"]*Inputs(/|\\\\)resource_dir}}" // NO-RPATH-NOT: "-rpath" {{.*(/|\\\\)Inputs(/|\\\\)resource_dir}} Index: clang/lib/Driver/ToolChain.cpp =================================================================== --- clang/lib/Driver/ToolChain.cpp +++ clang/lib/Driver/ToolChain.cpp @@ -623,8 +623,7 @@ std::string ToolChain::getArchSpecificLibPath() const { SmallString<128> Path(getDriver().ResourceDir); - llvm::sys::path::append(Path, "lib", getOSLibName(), - llvm::Triple::getArchTypeName(getArch())); + llvm::sys::path::append(Path, "lib", getTriple().str()); return std::string(Path.str()); }
Index: clang/test/Driver/arch-specific-libdir.c =================================================================== --- clang/test/Driver/arch-specific-libdir.c +++ clang/test/Driver/arch-specific-libdir.c @@ -1,5 +1,5 @@ // Test that the driver adds an arch-specific subdirectory in -// {RESOURCE_DIR}/lib/linux to the search path. +// {RESOURCE_DIR}/lib/{triple} to the search path. // // RUN: %clang %s -### 2>&1 -target i386-unknown-linux \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ @@ -11,7 +11,7 @@ // // RUN: %clang %s -### 2>&1 -target i686-unknown-linux \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ -// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s +// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i686 %s // // RUN: %clang %s -### 2>&1 -target i686-unknown-linux \ // RUN: -resource-dir=%S/Inputs/resource_dir \ @@ -43,10 +43,11 @@ // // // FILEPATH: "-x" "c" "[[FILE_PATH:.*]]{{(/|\\\\).*}}.c" -// ARCHDIR-i386: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)i386}} -// ARCHDIR-x86_64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}} -// ARCHDIR-arm: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)arm}} -// ARCHDIR-aarch64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}} +// ARCHDIR-i386: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)i386-unknown-linux}} +// ARCHDIR-i686: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)i686-unknown-linux}} +// ARCHDIR-x86_64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}} +// ARCHDIR-arm: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)arm-unknown-linux}} +// ARCHDIR-aarch64: -L[[FILE_PATH]]{{(/|\\\\)Inputs(/|\\\\)resource_dir_with_arch_subdir(/|\\\\)lib(/|\\\\)aarch64-unknown-linux}} // // Have a stricter check for no-archdir - that the driver doesn't add any // subdirectory from the provided resource directory. Index: clang/test/Driver/arch-specific-libdir-rpath.c =================================================================== --- clang/test/Driver/arch-specific-libdir-rpath.c +++ clang/test/Driver/arch-specific-libdir-rpath.c @@ -49,7 +49,7 @@ // RUN: %clang %s -### 2>&1 -target x86_64-linux-android -fsanitize=address \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ // RUN: -frtlib-add-rpath \ -// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s +// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64-ANDROID,RPATH-X86_64-ANDROID %s // // Add LIBPATH, RPATH for OpenMP // RUN: %clang %s -### 2>&1 -target x86_64-linux -fopenmp \ @@ -77,14 +77,17 @@ // RESDIR: "-resource-dir" "[[RESDIR:[^"]*]]" // -// LIBPATH-X86_64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}} -// RPATH-X86_64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}" +// LIBPATH-X86_64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}} +// RPATH-X86_64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}}" +// +// LIBPATH-X86_64-ANDROID: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux-android}} +// RPATH-X86_64-ANDROID: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux-android}}" // -// NO-LIBPATH-X86_64-NOT: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}} -// NO-RPATH-X86_64-NOT: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}" +// NO-LIBPATH-X86_64-NOT: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}} +// NO-RPATH-X86_64-NOT: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)x86_64-unknown-linux}}" // -// LIBPATH-AARCH64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}} -// RPATH-AARCH64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}}" +// LIBPATH-AARCH64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)aarch64-unknown-linux}} +// RPATH-AARCH64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)aarch64-unknown-linux}}" // // NO-LIBPATH-NOT: "-L{{[^"]*Inputs(/|\\\\)resource_dir}}" // NO-RPATH-NOT: "-rpath" {{.*(/|\\\\)Inputs(/|\\\\)resource_dir}} Index: clang/lib/Driver/ToolChain.cpp =================================================================== --- clang/lib/Driver/ToolChain.cpp +++ clang/lib/Driver/ToolChain.cpp @@ -623,8 +623,7 @@ std::string ToolChain::getArchSpecificLibPath() const { SmallString<128> Path(getDriver().ResourceDir); - llvm::sys::path::append(Path, "lib", getOSLibName(), - llvm::Triple::getArchTypeName(getArch())); + llvm::sys::path::append(Path, "lib", getTriple().str()); return std::string(Path.str()); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits