[ELF] - Linkerscript: fixed non-determinism when handling MEMORY.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 3 Nov 2017 08:21:51 +0000 (08:21 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 3 Nov 2017 08:21:51 +0000 (08:21 +0000)
commit8c825db25e32365652c9d68177224f8c3c1a551a
tree0dff873d733bbbbf74e69f6276538974552da14a
parentcbed0e615b3658add66600d89e1d47c80a99a22d
[ELF] - Linkerscript: fixed non-determinism when handling MEMORY.

When findMemoryRegion do search to find a region for output section it
iterates over MemoryRegions which is DenseMap and so does not
guarantee iteration in insertion order. As a result selected region depends
on its name and not on its definition position
Testcase shows the issue, patch fixes it. Behavior after applying the patch
seems consistent with bfd.

Differential revision: https://reviews.llvm.org/D39544

llvm-svn: 317307
lld/ELF/LinkerScript.h
lld/ELF/ScriptParser.cpp
lld/test/ELF/linkerscript/memory3.s [new file with mode: 0644]