Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add arch-specific directory to search path
Summary: This change adds an arch-specific subdirectory in <ResourceDir>/lib/<OS> to the linker search path. This path also gets added as '-rpath' for native compilation if a runtime is linked in as a shared object. This allows arch-specific libraries to be installed alongside clang. Reviewers: danalbert, cbergstrom, javed.absar Subscribers: srhines Differential Revision: https://reviews.llvm.org/D30015 llvm-svn: 296927
- Loading branch information
1 parent
1c9d800
commit 65a16dd
Showing
10 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Test that the driver adds an arch-specific subdirectory in | ||
// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath' for native | ||
// compilations. | ||
// | ||
// -rpath only gets added during native compilation. To keep the test simple, | ||
// just test for x86_64-linux native compilation. | ||
// REQUIRES: x86_64-linux | ||
// | ||
// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan | ||
// RUN: %clang %s -### 2>&1 -fsanitize=undefined \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,LIBPATH,NO-RPATH %s | ||
// | ||
// Add LIBPATH, RPATH for -fsanitize=address -shared-libasan | ||
// RUN: %clang %s -### 2>&1 -target x86_64-linux \ | ||
// RUN: -fsanitize=address -shared-libasan \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s | ||
// | ||
// Add LIBPATH, RPATH with -fsanitize=address for Android | ||
// RUN: %clang %s -### 2>&1 -target x86_64-linux-android -fsanitize=address \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s | ||
// | ||
// Add LIBPATH, RPATH for OpenMP | ||
// RUN: %clang %s -### 2>&1 -fopenmp \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s | ||
// | ||
// Add LIBPATH but no RPATH for ubsan (or any other sanitizer) | ||
// RUN: %clang %s -### 2>&1 -fsanitize=undefined \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,LIBPATH,NO-RPATH %s | ||
// | ||
// Add LIBPATH but no RPATH if no sanitizer or runtime is specified | ||
// RUN: %clang %s -### 2>&1 \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,LIBPATH,NO-RPATH %s | ||
// | ||
// Do not add LIBPATH or RPATH if arch-specific subdir doesn't exist | ||
// RUN: %clang %s -### 2>&1 \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,NO-LIBPATH,NO-RPATH %s | ||
// | ||
// | ||
// FILEPATH: "-x" "c" "[[FILE_PATH:.*]]/{{.*}}.c" | ||
// LIBPATH: -L[[FILE_PATH]]/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64 | ||
// RPATH: "-rpath" "[[FILE_PATH]]/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64" | ||
// NO-LIBPATH-NOT: -L{{.*}}Inputs/resource_dir | ||
// NO-RPATH-NOT: "-rpath" {{.*}}/Inputs/resource_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Test that the driver adds an arch-specific subdirectory in | ||
// {RESOURCE_DIR}/lib/linux to the search path. | ||
// | ||
// RUN: %clang %s -### 2>&1 -target i386-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s | ||
// | ||
// RUN: %clang %s -### 2>&1 -target i386-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s | ||
// | ||
// 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: %clang %s -### 2>&1 -target i686-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s | ||
// | ||
// RUN: %clang %s -### 2>&1 -target x86_64-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-x86_64 %s | ||
// | ||
// RUN: %clang %s -### 2>&1 -target x86_64-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s | ||
// | ||
// RUN: %clang %s -### 2>&1 -target arm-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-arm %s | ||
// | ||
// RUN: %clang %s -### 2>&1 -target arm-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s | ||
// | ||
// RUN: %clang %s -### 2>&1 -target aarch64-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,ARCHDIR-aarch64 %s | ||
// | ||
// RUN: %clang %s -### 2>&1 -target aarch64-unknown-linux \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: | FileCheck --check-prefixes=FILEPATH,NO-ARCHDIR %s | ||
// | ||
// | ||
// 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 | ||
// | ||
// Have a stricter check for no-archdir - that the driver doesn't add any | ||
// subdirectory from the provided resource directory. | ||
// NO-ARCHDIR-NOT: -L[[FILE_PATH]]/Inputs/resource_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters