[LLVMdev] defining symbols with lld

Shankar Easwaran shankare at codeaurora.org
Thu Aug 22 12:54:28 PDT 2013


Hi Nick,

I am planning to work on adding support for definining expressions for 
the Gnu flavor.

Currently Gnu ld supports an option --defsym symbol=expression. The 
expression may be composed of other symbols.
Any symbol that appears in the expression, gets its value from the 
output symbol value (address of the symbol in the output file).

In addition the symbol only gets defined if and only if there is a 
relocation, that refers to the symbol.

I was wondering how to accomplish this with lld. One thought that I had 
was to take list of  user defined symbols and the expressions associated 
with the symbols and evaluate at the time of writing the output file.
The problem with that is

a) if the expression uses a symbol thats not defined anywhere else 
except the defsym expression, the symbol would get garbage collected.
b) Supporting linker scripts which create new symbols, will be an issue.

What are your thoughts ?

Thanks

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-dev mailing list