forked from OSchip/llvm-project
[HIP] Ignore invalid ar linker options
Instead of accepting the same arguments as regular linker, the static linker will only accept input files. Reviewed By: yaxunl Differential Revision: https://reviews.llvm.org/D85442
This commit is contained in:
parent
99298c7fc5
commit
96c2d5e99e
|
@ -341,12 +341,17 @@ void tools::gnutools::StaticLibTool::ConstructJob(
|
|||
// Silence warnings when linking C code with a C++ '-stdlib' argument.
|
||||
Args.ClaimAllArgs(options::OPT_stdlib_EQ);
|
||||
|
||||
// GNU ar tool command "ar <options> <output_file> <input_files>".
|
||||
// ar tool command "llvm-ar <options> <output_file> <input_files>".
|
||||
ArgStringList CmdArgs;
|
||||
// Create and insert file members with a deterministic index.
|
||||
CmdArgs.push_back("rcsD");
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
|
||||
|
||||
for (const auto &II : Inputs) {
|
||||
if (II.isFilename()) {
|
||||
CmdArgs.push_back(II.getFilename());
|
||||
}
|
||||
}
|
||||
|
||||
// Delete old output archive file if it already exists before generating a new
|
||||
// archive file.
|
||||
|
|
|
@ -25,3 +25,14 @@
|
|||
|
||||
// NORDC-NOT: offload bundler
|
||||
// NORDC: # "x86_64-unknown-linux-gnu" - "GNU::StaticLibTool", inputs: ["{{.*o}}"], output: "a.out"
|
||||
|
||||
// RUN: %clang --hip-link -### -target x86_64-linux-gnu \
|
||||
// RUN: --emit-static-lib -lgcc \
|
||||
// RUN: -Wl,--enable-new-dtags -Wl,--rpath=/opt \
|
||||
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 -fgpu-rdc %t.o\
|
||||
// RUN: 2>&1 | FileCheck -check-prefix=NOFLAG %s
|
||||
|
||||
// NOFLAG-NOT: .*lgcc
|
||||
// NOFLAG-NOT: .*enable-new-dtags
|
||||
// NOFLAG-NOT: .*rpath=/opt
|
||||
// NOFLAG: "{{.*}}llvm-ar{{.*}}" "rcsD" "{{.*}}.out" "{{.*o}}" "{{.*o}}"
|
||||
|
|
Loading…
Reference in New Issue