[LLVMdev] lld options to parse linker script

784 views
Skip to first unread message

shridevi Bellatti

unread,
Feb 9, 2015, 2:28:14 AM2/9/15
to LLV...@cs.uiuc.edu
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,

Rafael Auler

unread,
Feb 18, 2015, 4:02:09 PM2/18/15
to shridevi Bellatti, LLV...@cs.uiuc.edu
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

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


shridevi Bellatti

unread,
Feb 22, 2015, 11:46:45 PM2/22/15
to Rafael Auler, LLV...@cs.uiuc.edu
Thanks Rafael
Reply all
Reply to author
Forward
0 new messages