[LLVMdev] defining symbols with lld
Shankar Easwaran
shankare at codeaurora.org
Thu Aug 22 18:42:17 PDT 2013
On 8/22/2013 3:44 PM, Nick Kledzik wrote:
>
> Linker scripts have the same need. My idea for this was to allow atoms to have an associated expression tree and would have references to all symbols in that tree. The resolver wouldn't need any special handling for this, and the backend would just need to evaluate the expression at the end.
> Agreed.
>
> On one hand, this sounds like an AbsoluteAtom because it has no content and no section, but has an address. On the other hand, it needs References to the symbols used in its expression and only DefinedAtoms can have content. But DefinedAtoms are normally laid out and assigned addresses. One way to work this in would be to make them DefinedAtoms of size zero, with a new ContentType that the ELF Writer knows does not need an address assigned. The References to each symbol used in its expression ensures that all needed symbols exist and are not dead stripped. The References will need some Kind the ELF Writer knows is not a relocation, but there for the expression evaluator to find the addresses of the symbols used.
>
> -Nick
These are the changes I plan to make, and some questions that I have
a) Define a new contentType for DefinedAtoms to say 'Expression'
b) Create a new class ExprnAtom derived from DefinedAtom
c) The expression could also contain various functions that could be set
in the expression, how should that be represented ?
d) The actual content of the Atom would be a string representation of
the expression, that can be used to emit YAML information
e)The expression tree needs to be stored into the Native intermediate
representation too right ? Store them as atoms ? How to represent
constants and functions ?
f) What about lld core ?
g) Create a new reference type, How does (ExpressionAtom,
ExpressionFunction, ExpressionConstant) this sound ?
h) I still need to figure out, what are the ways this symbol can be
overridden, if the same symbol is defined in a file, does it override,
(Resolver may need to handle it).
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