[PATCH] D23019: [ELF] - Linkerscript: support all kinds of sorting (including nested).

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 09:39:22 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, davide, evgeny777.

Previously we supported only sorting by name.
I found that SORT_BY_ALIGNMENT is also often used in combination with nested sorting:
https://searchcode.com/codesearch/view/85938978/
https://searchcode.com/codesearch/view/47611074/

When there are nested section sorting commands in linker script, there can be at most 1
level of nesting for section sorting commands.
1. SORT_BY_NAME (SORT_BY_ALIGNMENT (wildcard section pattern)). It will sort the input
sections by name first, then by alignment if 2 sections have the same name.
2. SORT_BY_ALIGNMENT (SORT_BY_NAME (wildcard section pattern)). It will sort the input
sections by alignment first, then by name if 2 sections have the same alignment.
3. SORT_BY_NAME (SORT_BY_NAME (wildcard section pattern)) is treated the same as SORT_
BY_NAME (wildcard section pattern).
4. SORT_BY_ALIGNMENT (SORT_BY_ALIGNMENT (wildcard section pattern)) is treated the
same as SORT_BY_ALIGNMENT (wildcard section pattern).
5. All other nested section sorting commands are invalid.

Patch implements that all above.

https://reviews.llvm.org/D23019

Files:
  ELF/LinkerScript.cpp
  ELF/LinkerScript.h
  test/ELF/linkerscript/Inputs/linkerscript-sort-nested.s
  test/ELF/linkerscript/Inputs/linkerscript-sort.s
  test/ELF/linkerscript/linkerscript-sort-nested.s
  test/ELF/linkerscript/linkerscript-sort.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23019.66332.patch
Type: text/x-patch
Size: 11983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160801/f2184ea8/attachment.bin>


More information about the llvm-commits mailing list