[PATCH] D42733: [ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 00:36:11 PST 2018


>> @@ -685,6 +679,7 @@
>>    Config->ZWxneeded = hasZOption(Args, "wxneeded");
>>
>>    // Parse LTO plugin-related options for compatibility with gold.
>> +  std::vector<const char *> LTOOptions({Argv0});
>
>Do we need to pass a real argv0? If not, it is probably better to use
>"<lld>" or something like that to simplify the code.
>
>Cheers,
>Rafael

Currently output is:
lld.exe: Unknown command line argument '-data-sectionssss'.  Try: 'D:\...long path here...\Debug\bin\lld.exe -help'
lld.exe: Did you mean '-data-sections'?

With  "<lld>" it becomes:
<lld>: Unknown command line argument '-data-sectionssss'.  Try: '<lld> -help'
<lld>: Did you mean '-data-sections'?

Not sure it looks better, personally I would probably prefer shortened version of first instead:
lld.exe: Unknown command line argument '-data-sectionssss'.  Try: 'lld.exe -help'
what requires argv0 to pass sys::path::filename(argv0).

Though when we print -help (in elf::printHelp), we print full path:
~/LLVM/build/bin/ld.lld -help
OVERVIEW: lld
USAGE: /home/umb/LLVM/build/bin/ld.lld [options] <inputs>

And then, first version has benefit that user is able simply to copy paste the full invocation 
('D:\...long path here...\Debug\bin\lld.exe -help') to get help.

But I think I have no really strong opinion.

Rui, what do you think ?

George.


More information about the llvm-commits mailing list