2017-03-04 07:20:49 +08:00
|
|
|
// Test that the driver adds an arch-specific subdirectory in
|
2017-03-15 00:58:07 +08:00
|
|
|
// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath'
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
2017-03-15 00:58:07 +08:00
|
|
|
// Test the default behavior when neither -frtlib-add-rpath nor
|
|
|
|
// -fno-rtlib-add-rpath is specified, which is to skip -rpath
|
|
|
|
// 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=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
|
|
|
|
//
|
|
|
|
// Test that -rpath is not added under -fno-rtlib-add-rpath even if other
|
|
|
|
// conditions are met.
|
|
|
|
// RUN: %clang %s -### 2>&1 -target x86_64-linux \
|
|
|
|
// RUN: -fsanitize=address -shared-libasan \
|
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
|
2018-04-03 07:36:14 +08:00
|
|
|
// RUN: -fno-rtlib-add-rpath \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
|
|
|
|
//
|
|
|
|
// Test that -rpath is added only under the right circumstance even if
|
|
|
|
// -frtlib-add-rpath is specified.
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
|
|
|
// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
|
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
|
|
|
|
// RUN: -frtlib-add-rpath \
|
2018-04-03 07:36:14 +08:00
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
|
2017-03-15 00:58:07 +08:00
|
|
|
//
|
|
|
|
// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
|
|
|
|
// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
|
2017-03-04 07:20:49 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: -frtlib-add-rpath \
|
2018-04-03 07:36:14 +08:00
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
|
|
|
// 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 \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: -frtlib-add-rpath \
|
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
|
|
|
|
//
|
|
|
|
// Add LIBPATH, RPATH for -fsanitize=address -shared-libasan on aarch64
|
|
|
|
// RUN: %clang %s -### 2>&1 -target aarch64-linux \
|
|
|
|
// RUN: -fsanitize=address -shared-libasan \
|
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
|
|
|
|
// RUN: -frtlib-add-rpath \
|
2018-04-03 07:36:14 +08:00
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-AARCH64,RPATH-AARCH64 %s
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
|
|
|
// 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 \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: -frtlib-add-rpath \
|
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
|
|
|
// Add LIBPATH, RPATH for OpenMP
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: %clang %s -### 2>&1 -target x86_64-linux -fopenmp \
|
2017-03-04 07:20:49 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: -frtlib-add-rpath \
|
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
|
|
|
// Add LIBPATH but no RPATH for ubsan (or any other sanitizer)
|
2017-03-15 01:26:56 +08:00
|
|
|
// RUN: %clang %s -### 2>&1 -fsanitize=undefined -target x86_64-linux \
|
2017-03-04 07:20:49 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: -frtlib-add-rpath \
|
2018-04-03 07:36:14 +08:00
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
|
|
|
// Add LIBPATH but no RPATH if no sanitizer or runtime is specified
|
2017-03-15 01:26:56 +08:00
|
|
|
// RUN: %clang %s -### 2>&1 -target x86_64-linux \
|
2017-03-04 07:20:49 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: -frtlib-add-rpath \
|
2018-04-03 07:36:14 +08:00
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
|
2017-03-04 07:20:49 +08:00
|
|
|
//
|
|
|
|
// Do not add LIBPATH or RPATH if arch-specific subdir doesn't exist
|
2017-03-15 01:26:56 +08:00
|
|
|
// RUN: %clang %s -### 2>&1 -target x86_64-linux \
|
2017-03-04 07:20:49 +08:00
|
|
|
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
2017-03-15 00:58:07 +08:00
|
|
|
// RUN: -frtlib-add-rpath \
|
|
|
|
// RUN: | FileCheck --check-prefixes=RESDIR,NO-LIBPATH,NO-RPATH %s
|
2018-04-03 07:36:14 +08:00
|
|
|
|
2017-03-15 02:24:41 +08:00
|
|
|
// RESDIR: "-resource-dir" "[[RESDIR:[^"]*]]"
|
2018-04-03 07:36:14 +08:00
|
|
|
//
|
|
|
|
// LIBPATH-X86_64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}
|
|
|
|
// RPATH-X86_64: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}"
|
|
|
|
//
|
|
|
|
// NO-LIBPATH-X86_64-NOT: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}
|
|
|
|
// NO-RPATH-X86_64-NOT: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)x86_64}}"
|
|
|
|
//
|
|
|
|
// LIBPATH-AARCH64: -L[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}}
|
|
|
|
// RPATH-AAARCH4: "-rpath" "[[RESDIR]]{{(/|\\\\)lib(/|\\\\)linux(/|\\\\)aarch64}}"
|
|
|
|
//
|
|
|
|
// NO-LIBPATH-NOT: "-L{{[^"]*Inputs(/|\\\\)resource_dir}}"
|
|
|
|
// NO-RPATH-NOT: "-rpath" {{.*(/|\\\\)Inputs(/|\\\\)resource_dir}}
|