summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/linkerscript/overlapping-sections.s
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-readobj] llvm-readobj --elf-output-style=GNU => llvm-readelfFangrui Song2019-05-011-3/+3
| | | | | | | While updating the test, change -l -S to -S -l as the output of -S goes before -l. llvm-svn: 359653
* [test] Change llvm-readobj -long-option to --long-option or well-known short ↵Fangrui Song2019-05-011-3/+3
| | | | | | | | | | | | options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651
* [ELF] Split RW PT_LOAD on the PT_GNU_RELRO boundaryFangrui Song2019-03-151-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Based on Peter Collingbourne's suggestion in D56828. Before D56828: PT_LOAD(.data PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .bss) Old: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .data .bss) New: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss) The new layout reflects the runtime memory mappings. By having two PT_LOAD segments, we can utilize the NOBITS part of the first PT_LOAD and save bytes for .bss.rel.ro. .bss.rel.ro is currently small and only used by copy relocations of symbols in read-only segments, but it can be used for other purposes in the future, e.g. if a relro section's statically relocated data is all zeros, we can move it to .bss.rel.ro. Reviewers: espindola, ruiu, pcc Reviewed By: ruiu Subscribers: nemanjai, jvesely, nhaehnle, javed.absar, kbarton, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58892 llvm-svn: 356226
* [ELF] Simplify RelRo, TLS, NOBITS section ranks and make RW PT_LOAD start ↵Fangrui Song2019-03-141-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [ELF] Make non-writable non-executable PROGBITS sections closer to .textFangrui Song2018-06-261-3/+3
| | | | | | | | | | | | 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
* [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] - Convert overlapping-sections.s testcase to x86 and cleanup.George Rimar2018-03-141-85/+27
| | | | | | | | | | | | | | | Patch do the following changes: * Test case was converted from MIPS to x86. * Removed part of the test checking we are able to produce a valid output. Since we do that already in other tests, this one's intention should be only to check we are still able to report overlaps and/or produce broken output with overlaps. Differential revision: https://reviews.llvm.org/D44438 llvm-svn: 327480
* [ELF] - Adjust rangeToString to report ranges in a different format.George Rimar2018-03-071-10/+10
| | | | | | | | | | | | | It was raised during the review of D43819. LLD usually use [X, Y] for reporting ranges, like below: "relocation R_386_16 out of range: 65536 is not in [0, 65535]" Patch changes rangeToString() to do the same. Differential revision: https://reviews.llvm.org/D44207 llvm-svn: 326918
* Make sure that --no-check-sections doesn't print out warning messages.Rui Ueyama2018-02-071-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D42988 llvm-svn: 324434
* Add -{no,}-check-sections flags to enable/disable section overlcheckingRui Ueyama2018-02-021-1/+3
| | | | | | | | GNU linkers have this option. Differential Revision: https://reviews.llvm.org/D42858 llvm-svn: 324150
* [ELF] Make overlapping output sections an errorAlexander Richardson2018-01-311-0/+169
Summary: While trying to make a linker script behave the same way with lld as it did with bfd, I discovered that lld currently doesn't diagnose overlapping output sections. I was getting very strange runtime failures which I tracked down to overlapping sections in the resulting binary. When linking with ld.bfd overlapping output sections are an error unless --noinhibit-exec is passed and I believe lld should behave the same way here to avoid surprising crashes at runtime. The patch also uncovered an errors in the tests: arm-thumb-interwork-thunk was creating a binary where .got.plt was placed at an address overlapping with .got. Reviewers: ruiu, grimar, rafael Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D41046 llvm-svn: 323856
OpenPOWER on IntegriCloud