[llvm-dev] [lld] Reject some lld specific one-dash long options

Fangrui Song via llvm-dev llvm-dev at lists.llvm.org
Tue May 5 16:01:52 PDT 2020


GNU ld supports most long options with either one or two dashes.  For
compatibility, lld has to support both.

For newer and lld specific options, we don't have such compatibility
problem.  I'd suggest we reject one-dash long options to avoid collision
with short options. For example,

* -lto-emit-obj can be read as -l to-emit-obj
* -thinlto-cache-dir= means -t -h inlto-cache-dir= in GNU ld

I created a patch https://reviews.llvm.org/D79371 to disallow some
one-dash long options. These options are carefully chosen: I can't find
anything depending on their one-dash forms.

lld has a spell corrector for option names so a misspelled -lto-emit-obj can be
identified quickly.


Thoughts?


More information about the llvm-dev mailing list