[LLVMdev] [lld] Linker script findings.

Meador Inge meadori at codesourcery.com
Sun Jan 6 16:30:41 PST 2013

On Jan 6, 2013, at 2:05 PM, Sean Silva wrote:

> but since the script can define symbols, it has to be parsed earlier.

It is more than just defining symbols.  There are many other directives that
have command line option equivalents that are used to setup linking.  You can pull symbols
with EXTERN, add other files to link with INPUT, add groups of archives to be searched
with GROUP, name the output file with OUTPUT, add new library path directories
with SEARCH_DIR, etc…

Also keep in mind that that linker scripts are usually "inlined" with other command line
options.  For example:

   ld foo.o --defsym=x=12 -Lbar -T beagle-ram.ld -lbaz bar.o

As you said, it makes sense to parse it during command line argument parsing.

Meador Inge
CodeSourcery / Mentor Embedded

More information about the llvm-dev mailing list