Author: Joseph Huber Date: 2023-02-01T13:49:17-06:00 New Revision: fa5209ce4060f659aeb9c0e70ca4cf908c788fff
URL: https://github.com/llvm/llvm-project/commit/fa5209ce4060f659aeb9c0e70ca4cf908c788fff DIFF: https://github.com/llvm/llvm-project/commit/fa5209ce4060f659aeb9c0e70ca4cf908c788fff.diff LOG: [LinkerWrapper] Adjust placement of input files for the linker Summary: The placement of input files can change the result of the linker. We should put the input files earlier to avoid this. Added: Modified: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp Removed: ################################################################################ diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index 2980044edd75..6ec089a8233c 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -391,6 +391,9 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args) { "-Wl,--no-undefined", }; + for (StringRef InputFile : InputFiles) + CmdArgs.push_back(InputFile); + // If this is CPU offloading we copy the input libraries. if (!Triple.isAMDGPU() && !Triple.isNVPTX()) { CmdArgs.push_back("-Wl,-Bsymbolic"); @@ -423,9 +426,6 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args) { for (StringRef Arg : Args.getAllArgValues(OPT_linker_arg_EQ)) CmdArgs.push_back(Args.MakeArgString("-Wl," + Arg)); - for (StringRef InputFile : InputFiles) - CmdArgs.push_back(InputFile); - if (Error Err = executeCommands(*ClangPath, CmdArgs)) return std::move(Err); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits