summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/linkerscript/sort-non-script.s
Commit message (Collapse)AuthorAgeFilesLines
* [ELF] Simplify RelRo, TLS, NOBITS section ranks and make RW PT_LOAD start ↵Fangrui Song2019-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with RelRo Old: PT_LOAD(.data | PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) | .bss) New: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) | .data .bss) The placement of | indicates page alignment caused by PT_GNU_RELRO. The new layout has simpler rules and saves space for many cases. Old size: roundup(.data) + roundup(.data.rel.ro) New size: roundup(.data.rel.ro + .bss.rel.ro) + .data Other advantages: * At runtime the 3 memory mappings decrease to 2. * start(PT_TLS) = start(PT_GNU_RELRO) = start(RW PT_LOAD). This simplifies binary manipulation tools. GNU strip before 2.31 discards PT_GNU_RELRO if its address is not equal to the start of its associated PT_LOAD. This has been fixed by https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f2731e0c374e5323ce4cdae2bcc7b7fe22da1a6f But with this change, we will be compatible with GNU strip before 2.31 * Before, .got.plt (non-relro by default) was placed before .got (relro by default), which made it impossible to have _GLOBAL_OFFSET_TABLE_ (start of .got.plt on x86-64) equal to the end of .got (R_GOT*_FROM_END) (https://bugs.llvm.org/show_bug.cgi?id=36555). With the new ordering, we can improve on this regard if we'd like to. Reviewers: ruiu, espindola, pcc Subscribers: emaste, arichardson, llvm-commits, joerg, jdoerfert Differential Revision: https://reviews.llvm.org/D56828 llvm-svn: 356117
* [lld][NFC] Update tests to use -S instead of -s when using llvm-readelf.Jordan Rupprecht2018-11-051-1/+1
| | | | | | | | | | | | | | Summary: llvm-readobj/readelf accepts both -s and -S as aliases for --sections. However with GNU readelf only -S means --section, and -s means --symbols. I would like to make llvm-readelf more compatible. Reviewers: MaskRay, espindola Reviewed By: MaskRay Subscribers: emaste, arichardson, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D54118 llvm-svn: 346164
* [ELF] Make non-writable non-executable PROGBITS sections closer to .textFangrui Song2018-06-261-1/+1
| | | | | | | | | | | | This generalizes the old heuristic placing SHT_DYNSYM SHT_DYNSTR first in the readonly SHF_ALLOC segment. Reviewers: espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D48406 llvm-svn: 335674
* [ELF] Assign RF_EXEC rank even if --no-rosegment or SECTIONS command is usedFangrui Song2018-06-261-1/+1
| | | | | | | | | | | | | | | | | Summary: Currently when --no-rosegment is specified or a linker script with SECTIONS command is used, .rodata (A) .text (AX) are assigned the same rank and .rodata may be placed after .text . This increases the gap between .text and .bss and can cause pc-relative relocation overflow (e.g. gcc crtbegin.o crtbegin.S have R_X86_64_PC32 relocation from .text to .bss). This patch makes SingleRoRx affect only segment layout, not section layout. As a consequence, .rodata will be placed before .text regardless of SingleRoRx. Reviewers: espindola, ruiu, grimar, echristo, javed.absar Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D48405 llvm-svn: 335627
* [ELF] Fix sort-non-script.sFangrui Song2018-06-251-1/+1
| | | | llvm-svn: 335499
* [ELF] Change test files for style consistency. NFCFangrui Song2018-06-251-2/+2
| | | | | | | | | * Move `REQUIRES:` line to the top * llvm-mc ... -o %t -> llvm-mc ... -o %t.o * Don't check "TEXT" "DATA" columns (they are bfd-style names that do not fit into llvm well) in llvm-objdump output llvm-svn: 335498
* [ELF] readobj -elf-output-style=GNU -> readelfFangrui Song2018-06-251-1/+1
| | | | | | Style change for consistency. NFC llvm-svn: 335494
* [lld] Mitigate relocation overflow [part 1 of 2].Han Shen2018-05-151-3/+3
| | | | | | | | | | | This CL places .dynsym and .dynstr at the beginning of SHF_ALLOC sections. We do this to mitigate the possibility that huge .dynsym and .dynstr sections placed between ro-data and text sections cause relocation overflow. Differential Revision: https://reviews.llvm.org/D45788 llvm-svn: 332374
* [ELF] - Revert of: r332038, r332054, r332060, r332061, r332062, r332063George Rimar2018-05-111-3/+3
| | | | | | | | | | | This reverts "Mitigate relocation overflow [part 1 of 2]." and the following commits which were trying to fix the bots. At the moment of r332082, bots are still failing and we need to find the reason of test case breakages first of all. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/17042/steps/test/logs/stdio http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/29845/steps/test/logs/stdio llvm-svn: 332085
* Mitigate relocation overflow [part 1 of 2].Han Shen2018-05-101-3/+3
| | | | | | | | | | | | This CL is to mitigate R_X86_64_PC32 relocation overflow problems for huge binaries that has near 4G allocated sections. By examining those binaries, there're 2 issues contributes to the problem: 1). huge ".dynsym" and ".dynstr" stands in the way between .rodata and .text 2). _init_array_start/end are placed at 0 if no ".init_array" presents, this causes .text relocation against them become more prone to overflow. This CL addresses 1st problem (the 2nd will be addressed in another CL.) by assigning a smaller sortrank to .dynsym and .dynstr thus they no longer stand in between. llvm-svn: 332038
* [ELF] - Do --hash-style=both by default.George Rimar2017-10-061-1/+1
| | | | | | | | | | | | | | Its PR34712, GNU linkers recently changed default values to "both" of "sysv". Patch do the same for all targets except MIPS, where .gnu.hash section is not yet supported. Code suggested by Rui Ueyama. Differential revision: https://reviews.llvm.org/D38407 llvm-svn: 315051
* ELF: Place relro sections after non-relro sections in r/w segment.Peter Collingbourne2017-01-101-1/+1
| | | | | | | | | | | | This is in preparation for my next change, which will introduce a relro nobits section. That requires that relro sections appear at the end of the progbits part of the r/w segment so that the relro nobits section can appear contiguously. Because of the amount of churn required in the test suite, I'm making this change separately. llvm-svn: 291523
* Don't put ro before rx when using linker scripts.Rafael Espindola2016-09-291-2/+2
| | | | | | | | Since they end up going on the same PT_LOAD, there is no reason to sort them. This matches bfd's behaviour and is user visible in the placement of orphan sections. llvm-svn: 282799
* Revert "Revert "Only restrict order if both sections are in the script.""Rafael Espindola2016-09-201-0/+16
| | | | | | | | | | | | | | | | | | | This reverts commit r282021, bringing back r282015. The problem was that the comparison function was not a strict weak ordering anymore, which this patch fixes. Original message: Only restrict order if both sections are in the script. This matches gold and bfd behavior and is required to handle some scripts. The script has to assume where PT_LOADs start in order to align that spot. If we don't allow section it doesn't know about to move to the middle, we can need more PT_LOADs and those will not be aligned. llvm-svn: 282035
* Revert "Only restrict order if both sections are in the script."Rafael Espindola2016-09-201-16/+0
| | | | | | This reverts commit r282015. It broke some bots. llvm-svn: 282021
* Only restrict order if both sections are in the script.Rafael Espindola2016-09-201-0/+16
This matches gold and bfd behavior and is required to handle some scripts. The script has to assume where PT_LOADs start in order to align that spot. If we don't allow section it doesn't know about to move to the middle, we can need more PT_LOADs and those will not be aligned. llvm-svn: 282015
OpenPOWER on IntegriCloud