[PATCH] D32082: [ELF] - Implemented --defsym option

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 07:11:45 PDT 2017


grimar created this revision.

gnu ld description of option is:

--defsym=symbol=expression
Create a global symbol in the output file, containing the absolute address given by expression. You may use this option as many times as necessary to define multiple symbols in the command line. A limited form of arithmetic is supported for the expression in this context: you may give a hexadecimal constant or the name of an existing symbol, or use "+" and "-" to add or subtract hexadecimal constants or symbols. If you need more elaborate expressions, consider using the linker command language from a script. Note: there should be no white space between symbol, the equals sign ("="), and expression.

Patch implements support for option using existent expression evaluator we have for linkerscript.
So that means this patch supports full math in --defsym expressions.

This fixes PR32350


https://reviews.llvm.org/D32082

Files:
  ELF/Config.h
  ELF/Driver.cpp
  ELF/Options.td
  ELF/ScriptParser.cpp
  ELF/ScriptParser.h
  ELF/Writer.cpp
  test/ELF/defsym.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32082.95294.patch
Type: text/x-patch
Size: 8490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170414/04dfd15c/attachment.bin>


More information about the llvm-commits mailing list