mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
[AIX][Clang] Respect -r when invoking the linker
On AIX, libraries are still being linked when `-r` is passed to the driver. This patch corrects this error. Differential Revision: https://reviews.llvm.org/D145899
This commit is contained in:
parent
6ac632ad83
commit
5259da75b9
@ -175,7 +175,7 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
};
|
||||
|
||||
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
|
||||
options::OPT_shared)) {
|
||||
options::OPT_shared, options::OPT_r)) {
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename())));
|
||||
|
||||
@ -235,6 +235,7 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
// Add directory to library search path.
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_L);
|
||||
ToolChain.AddFilePathLibArgs(Args, CmdArgs);
|
||||
if (!Args.hasArg(options::OPT_r)) {
|
||||
ToolChain.addProfileRTLibs(Args, CmdArgs);
|
||||
|
||||
if (getToolChain().ShouldLinkCXXStdlib(Args))
|
||||
@ -278,6 +279,7 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
"/usr/lib/profiled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
|
@ -1077,3 +1077,22 @@
|
||||
// RUN: -fopenmp=libfoo \
|
||||
// RUN: | FileCheck --check-prefixes=CHECK-FOPENMP-FOO %s
|
||||
// CHECK-FOPENMP-FOO: error: unsupported argument 'libfoo' to option '-fopenmp='
|
||||
|
||||
// Check powerpc-ibm-aix7.1.0.0. -r does not link object files or libraries
|
||||
// RUN: %clang %s 2>&1 -### \
|
||||
// RUN: --target=powerpc-ibm-aix7.1.0.0 \
|
||||
// RUN: --sysroot %S/Inputs/aix_ppc_tree \
|
||||
// RUN: --unwindlib=libunwind \
|
||||
// RUN: -L/foo/bar \
|
||||
// RUN: -r \
|
||||
// RUN: | FileCheck --check-prefixes=CHECK-RELOCATABLE %s
|
||||
|
||||
// CHECK-RELOCATABLE: "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
|
||||
// CHECK-RELOCATABLE: "-isysroot" "[[SYSROOT:[^"]+]]"
|
||||
// CHECK-RELOCATABLE: "{{.*}}ld{{(.exe)?}}"
|
||||
// CHECK-RELOCATABLE: "-r"
|
||||
// CHECK-RELOCATABLE: "-L/foo/bar"
|
||||
// CHECK-RELOCATABLE-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crt0.o"
|
||||
// CHECK-RELOCATABLE-NOT: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
|
||||
// CHECK-RELOCATABLE-NOT: "-l{{.*}}"
|
||||
// CHECK-RELOCATABLE-NOT: "-L{{.*}}"
|
||||
|
Loading…
Reference in New Issue
Block a user