[Linux] Reorder the -Xlinker and -l arguments

- Move the -Xlinker and -l options to just before swift_end.o

- Add testcase to check linker option ordering.
This commit is contained in:
Simon Evans
2017-06-29 13:10:04 +01:00
parent 03b067b949
commit 3ac5e12c67
2 changed files with 14 additions and 2 deletions

View File

@@ -1534,8 +1534,6 @@ toolchains::GenericUnix::constructInvocation(const LinkJobAction &job,
addPrimaryInputsOfType(Arguments, context.Inputs, types::TY_Object);
addInputsOfType(Arguments, context.InputActions, types::TY_Object);
context.Args.AddAllArgs(Arguments, options::OPT_Xlinker);
context.Args.AddAllArgs(Arguments, options::OPT_linker_option_Group);
for (const Arg *arg : context.Args.filtered(options::OPT_F,
options::OPT_Fsystem)) {
if (arg->getOption().matches(options::OPT_Fsystem))
@@ -1609,6 +1607,9 @@ toolchains::GenericUnix::constructInvocation(const LinkJobAction &job,
Twine("-u", llvm::getInstrProfRuntimeHookVarName())));
}
context.Args.AddAllArgs(Arguments, options::OPT_Xlinker);
context.Args.AddAllArgs(Arguments, options::OPT_linker_option_Group);
// Just before the output option, allow GenericUnix toolchains to add
// additional inputs.
auto PostInputObjectPath = getPostInputObjectPath(ObjectLibPath);