[PATCH] D39489: [ELF] - Linkerscript: fix issue with multiple output sections definitions.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 1 05:20:12 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

Currently for following script LLD produce broken output silently:

  bar : ONLY_IF_RO { *(no_such_section) }
  bar : ONLY_IF_RW { *(foo_aw) }
  sym1 = SIZEOF(bar); 
  sym2 = ADDR(bar);

Values of sym1 and sym2 are zeroes.

That happens because of `NameToOutputSection` member which currently is a
mapping from name to OutputSection. Though in case above there are two different
output section commands, so I believe it should be a mapping to vector.

Patch changes implementation of mapping what fixes the issue observed.


https://reviews.llvm.org/D39489

Files:
  ELF/LinkerScript.cpp
  ELF/LinkerScript.h
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/ScriptParser.cpp
  test/ELF/linkerscript/sections-constraint6.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39489.121114.patch
Type: text/x-patch
Size: 8248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171101/5a20aac0/attachment.bin>


More information about the llvm-commits mailing list