[ELF] - Linkerscript: support complex section pattern grammar.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 21 Sep 2016 15:56:44 +0000 (15:56 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 21 Sep 2016 15:56:44 +0000 (15:56 +0000)
commit07171f21d148d340115ec634be6a7f296799517d
treefc936cdecbe62301dbcdc305738204dc05e23a70
parent1049085c788ac6628200fe3758b6f280ddbc6e2a
[ELF] - Linkerscript: support complex section pattern grammar.

This is PR30442.
Previously we were failed to parce complex expressions like:
foo : { *(SORT_BY_NAME(bar) zed) }

Main idea of patch that globs and excludes can be wrapped in a SORT.
There is a difference in semanics of ld/gold:
ld likes:
*(SORT(EXCLUDE_FILE (*file1.o) .foo.1))

gold likes:
*(EXCLUDE_FILE (*file1.o) SORT(.foo.1))

Patch implements ld grammar, complex expressions like
next is not a problem anymore:
.abc : { *(SORT(.foo.* EXCLUDE_FILE (*file1.o) .bar.*) .bar.*) }

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

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