[ELF] Support --defsym=<symbol>=<symbol>.

Description

[ELF] Support --defsym=<symbol>=<symbol>.

Currently LLD supports --defsym only in the form of
--defsym=<symbol>=<integer>, where the integer is interpreted as the
absolute address of the symbol. This patch extends it to allow other
symbol name to be given as an RHS value. If a RHS value is a symbol
name, the LHS symbol will be defined as an alias for the RHS symbol.

Internally, a LHS symbol is represented as a zero-size defined atom
who has an LayoutAfter reference to an undefined atom, whose name is
the RHS value. Everything else is already implemented -- Resolver
will resolve the undefined symbol, and the layout pass will layout
the two atoms at the same location. Looks like it's working fine.

Note that GNU LD supports --defsym=<symbol>=<symbol>+<addend>. That
feature is out of scope of this patch.

Differential Revision: http://reviews.llvm.org/D3332

Details

Committed
ruiuApr 16 2014, 1:58 PM
Differential Revision
D3332: [ELF] Support --defsym=<symbol>=<symbol>.
Parents
rL206416: Handle -m32 for NetBSD/sparc64 correctly. Extend test case to also check
Branches
Unknown
Tags
Unknown