lld options to parse linker script

Hi all,

Which are the command-line options available to pass linker script, library path etc… to lld? I see minimal options listed, when i say,

lld -flavor gnu -help

Thanks in advance,

In the GNU flavour, you should just try it as you would do it in GNU ld. Please note, however, that support for linker scripts in LLD is still in its infancy and only simple linker script commands that deal with files are working (GROUP, SEARCH_DIR, OUTPUT).

Both GNU ld and LLD (when using the GNU flavour), whenever they do not recognise an input file format, will read the input file as an “implicit linker script”. This implicit linker script will be read in addition to the internal default linker script that sets linker behaviour. These are used, for example, in GLIBC to add search paths and are very simple and already supported by LLD. These implicit linker scripts can appear multiple times in the linker command line in the same way as you specify multiple linker inputs. For example:

lld-gnu input1.o input2.o linkerscript1.txt linkerscript2.txt -o test

However, there are linker scripts commands that can only appear once (such as the SECTIONS command). If you want to use such commands, you must supply your own linker script name after the “-T” option to override the default linker script, only once:

lld-gnu -T linkerscript.txt (…)

However, currently, these commands are still not supported in LLD.

Best regards,
Rafael Auler

Thanks Rafael