[PATCH] D64130: [LLD][ELF] - Linkerscript: add a support for expressions for section's filling

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 06:10:59 PDT 2019


grimar created this revision.
grimar added reviewers: MaskRay, psmith, ruiu.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

Imagine the script:

  .section: {
  ...
  } = FILL_EXPR

LLD assumes that FILL_EXPR is a number, and does not allow
it to be an expression. Though that is allowed by specification:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html#OUTPUT-SECTION-FILL

This patch adds a support for cases when FILL_EXPR is simple math expression.
I am not sure it makes sense to support the case when expression uses symbols,
I hope it is not used in the wild, though we can do that in a follow-up, but that would do
our filling code a bit more complicated.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42482.


https://reviews.llvm.org/D64130

Files:
  ELF/ScriptLexer.cpp
  ELF/ScriptParser.cpp
  test/ELF/linkerscript/fill.test
  test/ELF/linkerscript/sections-padding.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64130.207773.patch
Type: text/x-patch
Size: 6381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190703/4504c32c/attachment.bin>


More information about the llvm-commits mailing list