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

Rui Ueyama ruiu at google.com
Wed Apr 9 15:11:44 PDT 2014


Hi Bigcheese, shankarke, kledzik,

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, a 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.

http://reviews.llvm.org/D3332

Files:
  include/lld/ReaderWriter/ELFLinkingContext.h
  lib/Driver/GnuLdDriver.cpp
  lib/ReaderWriter/ELF/ELFLinkingContext.cpp
  test/elf/X86_64/Inputs/fn.o
  test/elf/X86_64/defsym.test
  test/elf/defsym.objtxt
  unittests/DriverTests/GnuLdDriverTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3332.1.patch
Type: text/x-patch
Size: 9324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140409/2e7b5a20/attachment.bin>


More information about the llvm-commits mailing list