[PATCH] LinkerScript: Add -T <scriptfile> option

Meador Inge meadori at gmail.com
Sun Mar 8 07:07:38 PDT 2015


In http://reviews.llvm.org/D8138#136065, @rafaelauler wrote:

> I'm curious about why is "-T" being handled here as an alias for "-l". "-T" is exclusive for linker scripts and cannot
>  accept any other input files.


That is an oversight on my part.  I will fix it on a later revision.  After taking a more detailed look at the expected
behavior of `-l` and `-T` I see where we have a related bug with `-l`.  The following will find 'test.ls':

  lld -flavor gnu -target x86_64  -ltest.ls

This is due to how we implement `findFile` in `GnuLdDriver.cpp`.
However, the colon form should work (assuming the script is in the find path
it will append to the default script):

  lld -flavor gnu -target x86_64  -l:test.ls



> Actually, currently, lld does handle -T, but in a weird way.  "-T" is not recognized, thus it generates a warning,

>  but then the parameter to "-T" is handled as a regular input and eventually gets parsed as a regular linker script.


I suspect that is accidental.  *Any* unrecognized options issue that warning.  Not sure if that is a good idea.

> Currently there is no difference between a script that overrides the "default linker script" and one that does not,

>  but we need this for the future (well, mostly producing an error if the linker script contains special commands that

>  are reserved for either the default linker script or the script that replaces it).


Exactly.  Right now there isn't much of difference, but to provide a proper distinction between default and user provided
it will matter.


http://reviews.llvm.org/D8138

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list