summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] Dump symbols ordered by profiled guided section layout to file.Rui Ueyama2019-03-272-0/+79
| | | | | | | | | | | | | | | | Patch by Tiancong Wang. In D36351, Call-Chain Clustering (C3) heuristic is implemented with option --call-graph-ordering-file <file>. This patch adds a flag --print-symbol-order=<file> to LLD, and when specified, it prints out the symbols ordered by the heuristics to the file. The symbols printout is helpful to those who want to understand the heuristics and want to reproduce the ordering with --symbol-ordering-file in later pass. Differential Revision: https://reviews.llvm.org/D59311 llvm-svn: 357133
* [LLD] Restore tests that use "-" as outputAndrew Ng2019-03-271-4/+1
| | | | | | | | | | No longer require workarounds for output to "-" (stdout) for Windows. These workarounds were just hiding the actual problem which has been fixed in r357058. Differential Revision: https://reviews.llvm.org/D59824 llvm-svn: 357072
* Revert "[lld] Reapply "Prevent duplicate files in debug line header in dwarf ↵Ali Tamur2019-03-262-7/+9
| | | | | | | | | | | 5."" This reverts commit rL357020 Reason: rL357018, which this commit depend on breaks the test: llvm/test/tools/llvm-objdump/embedded-source.test on some architectures. llvm-svn: 357025
* [lld] Reapply "Prevent duplicate files in debug line header in dwarf 5."Ali Tamur2019-03-262-9/+7
| | | | | | | | | | | | | | | Reapply rL356943; the previous attempt was reverted because the patch rL356941 that this depended on had broken a test. Original commit message: [lld] Prevent duplicate files in debug line header in dwarf 5. Tags: #llvm Differential Revision: https://reviews.llvm.org/D59671 llvm-svn: 357020
* [ELF] Change GOT*_FROM_END (relative to end(.got)) to GOTPLT* (start(.got.plt))Fangrui Song2019-03-2516-113/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This should address remaining issues discussed in PR36555. Currently R_GOT*_FROM_END are exclusively used by x86 and x86_64 to express relocations types relative to the GOT base. We have _GLOBAL_OFFSET_TABLE_ (GOT base) = start(.got.plt) but end(.got) != start(.got.plt) This can have problems when _GLOBAL_OFFSET_TABLE_ is used as a symbol, e.g. glibc dl_machine_dynamic assumes _GLOBAL_OFFSET_TABLE_ is start(.got.plt), which is not true. extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden; return _GLOBAL_OFFSET_TABLE_[0]; // R_X86_64_GOTPC32 In this patch, we * Change all GOT*_FROM_END to GOTPLT* to fix the problem. * Add HasGotPltOffRel to denote whether .got.plt should be kept even if the section is empty. * Simplify GotSection::empty and GotPltSection::empty by setting HasGotOffRel and HasGotPltOffRel according to GlobalOffsetTable early. The change of R_386_GOTPC makes X86::writePltHeader simpler as we don't have to compute the offset start(.got.plt) - Ebx (it is constant 0). We still diverge from ld.bfd (at least in most cases) and gold in that .got.plt and .got are not adjacent, but the advantage doing that is unclear. Reviewers: ruiu, sivachandra, espindola Subscribers: emaste, mehdi_amini, arichardson, dexonsmith, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59594 llvm-svn: 356968
* Revert "[lld] Prevent duplicate files in debug line header in dwarf 5."Ali Tamur2019-03-252-7/+9
| | | | | | | | This reverts commit 5aa7478a55fa86dae45913b82bd05ed32d9c0973. Some things are broken; I will fix and try to commit again. llvm-svn: 356949
* [lld] Prevent duplicate files in debug line header in dwarf 5.Ali Tamur2019-03-252-9/+7
| | | | | | | | | | | | | | | | | Summary: Changes to a couple of tests that will start failing after https://reviews.llvm.org/D59515 is submitted. Reviewers: echristo, ruiu, espindola Reviewed By: echristo, ruiu Subscribers: emaste, arichardson, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59671 llvm-svn: 356943
* [ELF][ARM] Revert Redesign of .ARM.exidx handling to use a SyntheticSectionPeter Smith2019-03-217-133/+52
| | | | | | | | | There is a reproducible buildbot failure (segfault) on the 2 stage clang-cmake-armv8-lld bot. Reverting while I investigate. Differential Revision: https://reviews.llvm.org/D59216 llvm-svn: 356684
* [ELF][ARM] Redesign of .ARM.exidx handling to use a SyntheticSectionPeter Smith2019-03-217-52/+133
| | | | | | | | | | | | | | | | | Instead of creating extra Synthetic .ARM.exidx sections to account for gaps in the table, create a single .ARM.exidx SyntheticSection that can derive the contents of the gaps from a sorted list of the executable InputSections. This has the benefit of moving the ARM specific code for SyntheticSections in SHF_LINK_ORDER processing and the table merging code into the ARM specific SyntheticSection. This also makes it easier to create EXIDX_CANTUNWIND table entries for executable InputSections that don't have an associated .ARM.exidx section. Fixes pr40277 Differential Revision: https://reviews.llvm.org/D59216 llvm-svn: 356666
* [TailCallElim] Update tests for LTO pipeline changeRobert Lougher2019-03-203-19/+8
| | | | | | | | | D58391 changed the LTO pipelines to add the tailcall elimination pass. This caused three LLD tests to fail. Differential Revision: https://reviews.llvm.org/D59604 llvm-svn: 356593
* [ELF] Allow sh_entsize to be unrelated to sh_addralign and not a power of 2Fangrui Song2019-03-185-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This implements Rui Ueyama's idea in PR39044. I've checked that ld.bfd and gold do not have the power-of-2 requirement and do not require sh_entsize to be a multiple of sh_align. Now on the updated test merge-entsize.s, all the 3 linkers happily create .rodata that is not 3-byte aligned. This has a use case in Linux arch/x86/crypto/sha512-avx2-asm.S It uses sh_entsize of 640, which is not a power of 2. See https://github.com/ClangBuiltLinux/linux/issues/417 Reviewers: ruiu, espindola Reviewed By: ruiu Subscribers: nickdesaulniers, E5ten, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59478 llvm-svn: 356428
* [ELF] Emit weak-undef symbols in .dynsym of a PIE binary only if linked ↵Siva Chandra2019-03-185-4/+40
| | | | | | | | | | | | | | against shared libs. Reviewers: espindola Subscribers: emaste, arichardson, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59275 llvm-svn: 356374
* [LLD][ELF] - Replace one of the tests with a YAML version.George Rimar2019-03-173-4/+17
| | | | | | | | This removes one more binary from the inputs. Differential revision: https://reviews.llvm.org/D59085 llvm-svn: 356334
* [ELF] Add a test for large .bss.rel.roFangrui Song2019-03-151-0/+44
| | | | | | | | | | | | | | Reviewers: ruiu, pcc, espindola Reviewed By: pcc Subscribers: emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59404 llvm-svn: 356230
* [ELF] Fix 3 tests after D56828Fangrui Song2019-03-153-21/+21
| | | | | | | | | | | | | | | | | arm-plt-reloc.s arm-thumb-plt-reloc.s: update offset calculations pack-dyn-relocs-loop.s: this test is very sensitive to exact section offsets and sizes. If we comment out the following two lines in SyntheticSections.cpp, we should reproduce `ld.lld: error: thunk creation not converged` caused by oscillation of the section size. if (RelocData.size() < OldSize) RelocData.append(OldSize - RelocData.size(), 0); Use -z norelro to counteract the layout change (to be more specific, we have to place .dynamic below .foo so that offset(foo) remains 0x10004) llvm-svn: 356229
* [ELF] Split RW PT_LOAD on the PT_GNU_RELRO boundaryFangrui Song2019-03-1520-81/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make a hack for LTO work only when you are actually doing LTO.Rui Ueyama2019-03-142-5/+14
| | | | | | | | | | | | We allow an archive file without symbol table as a linker input as a workaround for a very common error in LTO build. But that logic worked even for an archive file containing non-bitcode files, which is not expected. This patch limits that workaround to one that contains only bitcode files. Differential Revision: https://reviews.llvm.org/D59373 llvm-svn: 356186
* [ELF] Simplify RelRo, TLS, NOBITS section ranks and make RW PT_LOAD start ↵Fangrui Song2019-03-14116-858/+859
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Reland "[Remarks] Add -foptimization-record-passes to filter remark emission"Francis Visoiu Mistrih2019-03-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently we have -Rpass for filtering the remarks that are displayed as diagnostics, but when using -fsave-optimization-record, there is no way to filter the remarks while generating them. This adds support for filtering remarks by passes using a regex. Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline` will only emit the remarks coming from the pass `inline`. This adds: * `-fsave-optimization-record` to the driver * `-opt-record-passes` to cc1 * `-lto-pass-remarks-filter` to the LTOCodeGenerator * `--opt-remarks-passes` to lld * `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2 * `-opt-remarks-passes` to gold-plugin Differential Revision: https://reviews.llvm.org/D59268 Original llvm-svn: 355964 llvm-svn: 355984
* ELF: Don't add .dynamic strings to .dynstr early.Peter Collingbourne2019-03-121-3/+3
| | | | | | | | | | This does not appear to be necessary because StringTableSection does not need to be finalized, which also means that we can remove the call to finalizeSynthetic on .dynstr. Differential Revision: https://reviews.llvm.org/D59240 llvm-svn: 355977
* Revert "[Remarks] Add -foptimization-record-passes to filter remark emission"Francis Visoiu Mistrih2019-03-121-5/+0
| | | | | | This reverts commit 20fff32b7d1f1a1bd417b22aa9f26ededd97a3e5. llvm-svn: 355976
* [Remarks] Add -foptimization-record-passes to filter remark emissionFrancis Visoiu Mistrih2019-03-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Currently we have -Rpass for filtering the remarks that are displayed as diagnostics, but when using -fsave-optimization-record, there is no way to filter the remarks while generating them. This adds support for filtering remarks by passes using a regex. Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline` will only emit the remarks coming from the pass `inline`. This adds: * `-fsave-optimization-record` to the driver * `-opt-record-passes` to cc1 * `-lto-pass-remarks-filter` to the LTOCodeGenerator * `--opt-remarks-passes` to lld * `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2 * `-opt-remarks-passes` to gold-plugin Differential Revision: https://reviews.llvm.org/D59268 llvm-svn: 355964
* fix break tests after rL355922. NFCIXing GUO2019-03-121-3/+3
| | | | llvm-svn: 355925
* [LLD][ELF] - Show symbols visibility in "undefined symbol..." error messages.George Rimar2019-03-126-9/+9
| | | | | | | | | This teaches LLD to report visibility when showing undefined symbol errors and fixes https://bugs.llvm.org/show_bug.cgi?id=40770. Differential revision: https://reviews.llvm.org/D58577 llvm-svn: 355909
* Fix test to unconditionally create a GNU-format archive.Eli Friedman2019-03-121-1/+1
| | | | | | | On Darwin targets, llvm-ar creates a Darwin format archive by default, which ld.lld can't read, so it was printing an unexpected error. llvm-svn: 355894
* [ELF] Print a better error for an archive containing a non-ELF file.Eli Friedman2019-03-121-3/+10
| | | | | | | | | Hopefully gives a more readable error message for the most obvious mistake. Differential Revision: https://reviews.llvm.org/D59170 llvm-svn: 355888
* Include an archive file name in an error message for a corrupted file.Rui Ueyama2019-03-121-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D59212 llvm-svn: 355886
* [LLD] Fixed flaky unit test based on build directory.Mitch Phillips2019-03-081-0/+1
| | | | | | | | | | This unit test fails if 'zed' appears in your build path, as lld is echoing out the path of the source file. Change the unit test to explicitly only match everything after the 'Symbols [' line of the output, to make sure that this test doesn't inadvertently fail due to the build path. llvm-svn: 355748
* fix expected format in test/ELF/eh-frame-hdr-augmentation.sPetar Jovanovic2019-03-071-2/+2
| | | | | | | Follow-up for r355605. Fix expected format in test/ELF/eh-frame-hdr-augmentation.s llvm-svn: 355621
* [WebAssembly] LTO: Don't include bitcode-only symbols in the symtabSam Clegg2019-03-071-0/+2
| | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=40654 Differential Revision: https://reviews.llvm.org/D59012 llvm-svn: 355577
* [LLD][ELF] - Convert common-symbol-alignment.s test to yaml.George Rimar2019-03-064-12/+36
| | | | | | This removes 2 precompiled binaries from the inputs. llvm-svn: 355500
* [LLD][ELF] - Remove unused invalid input object. NFC.George Rimar2019-03-061-0/+0
| | | | | | | | It was introduced by me in 2016: r290335, but the test did contain the YAML from start, I think it was committed by mistake. llvm-svn: 355497
* [ELF][test] chmod u+w to prevent annoying rm promptFangrui Song2019-03-051-1/+2
| | | | | | | | If the permission does not permit writing and the standard input is a terminal, rm gives an annoying prompt. chmod u+w to make the output directory easier to delete. llvm-svn: 355382
* [LLD] add test for line number info related to differrent .text sectionsAlexey Lapshin2019-03-041-0/+177
| | | | | | | | | | | There is a bug for llvm-objdump which incorrectly reported line number info for object file if several .text sections presented. https://bugs.llvm.org/show_bug.cgi?id=40703 . This patch adds test for the same situation. Differential revision: https://reviews.llvm.org/D58357 llvm-svn: 355306
* ELF: Change FileSize back to a uint64_t.Peter Collingbourne2019-03-011-0/+11
| | | | | | | | | This lets us detect file size overflows when creating a 64-bit binary on a 32-bit machine. Differential Revision: https://reviews.llvm.org/D58840 llvm-svn: 355218
* [lld][test] Fix tests. llvm-readobj now emits symbol section names.Matt Davis2019-03-012-2/+2
| | | | | | | This is the result of patch 99e9c4cad08164b9c0ca565ab9ad48ce132e98e5 See the related patch https://reviews.llvm.org/D58796 llvm-svn: 355211
* [LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.George Rimar2019-03-015-13/+59
| | | | | | | | This change makes 3 tests to use yaml instead of binaries. Differential revision: https://reviews.llvm.org/D58780 llvm-svn: 355196
* [LLD][ELF] - Convert invalid/undefined-local-symbol-in-dso.test to use YAMLGeorge Rimar2019-03-012-56/+17
| | | | | | | | This removes a binary from the inputs and reduces the test case. Differential revision: https://reviews.llvm.org/D58783 llvm-svn: 355194
* ELF: Write .eh_frame_hdr explicitly after writing .eh_frame.Peter Collingbourne2019-02-281-0/+20
| | | | | | | | | | | This lets us remove the special case from Writer::writeSections(), and also fixes a bug where .eh_frame_hdr isn't necessarily written in the correct order if a linker script moves .eh_frame and .eh_frame_hdr into the same output section. Differential Revision: https://reviews.llvm.org/D58795 llvm-svn: 355153
* [LLD][ELF] - Stop using binary input in invalid/tls-symbol.s test. NFCI.George Rimar2019-02-282-3/+22
| | | | | | We can use yaml2obj instead, patch does this. llvm-svn: 355075
* [LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.George Rimar2019-02-272-5/+16
| | | | | | | | | | This patch removes the precompiled binary from inputs, replacing it with a YAML. And teaches LLD to report a section name in case of such error. Differential revision: https://reviews.llvm.org/D58670 llvm-svn: 354959
* Output ELF files after ThinLTO is run.Bill Wendling2019-02-262-0/+42
| | | | | | | | | | | | | | | | | | Summary: The gold linker allowed you to output the ELF files after LTO was run. It did it by using the 'obj-path' option. This replicates that behavior. Reviewers: espindola, ruiu, MaskRay, pcc Reviewed By: MaskRay, pcc Subscribers: grimar, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D56046 llvm-svn: 354917
* [mips] Reduce number of tools invocations in the test. NFCSimon Atanasyan2019-02-251-74/+41
| | | | llvm-svn: 354772
* [ELF][ARM] Accept and ignore -p and -no-pipleline-knowledgePeter Smith2019-02-251-0/+2
| | | | | | | | | | | | The linux kernel uses an old flag -p/-no-pipeline-knowledge that is accepted by bfd and gold but ignored by modern versions of them. The original option is very old and is pre-ABI, it sometimes comes up in code-bases that had support for pre ABI toolchains. The Linux kernel uses it in 3 places in the ARM specific section. Differential Revision: https://reviews.llvm.org/D58540 llvm-svn: 354769
* [ELF][test]Remove unnecessary empty symbol references in yaml/add missing ↵James Henderson2019-02-228-7/+12
| | | | | | | | | | | | | | | | | | | symbols for relocs yaml2obj used to require the Symbol field in relocations, but it hasn't done so for a couple of years. Another change to yaml2obj will soon land that will look up the symbol by name or index, if present, and emit an error if not found. This will mean that an explicit symbol reference (even to an empty-named symbol) that does not reference a symbol declared in the yaml will result in an error. This patch updates tests that would otherwise start emitting errors. Reviewed by: ruiu, grimar Differential Revision: https://reviews.llvm.org/D58508 llvm-svn: 354666
* [LLD][ELF] - Simplify test case. NFC.George Rimar2019-02-211-7/+0
| | | | | | It has an excessive section declaration. llvm-svn: 354573
* [mips] Put some MIPS-specific sections to separate segmentsSimon Atanasyan2019-02-203-11/+48
| | | | | | | | | | | | | | Three MIPS-specific sections `.reginfo`, `.MIPS.options`, and `.MIPS.abiflags` are used by loader to read their contents and setup environment for running a program. Loader looks up these data in the corresponding segments: `PT_MIPS_REGINFO`, `PT_MIPS_OPTIONS`, and `PT_MIPS_ABIFLAGS` respectively. This patch put these sections to separate segments like we do already for ARM `SHT_ARM_EXIDX` section. Differential Revision: http://reviews.llvm.org/D58381 llvm-svn: 354468
* [mips] Fix indentations in the test. NFCSimon Atanasyan2019-02-191-13/+13
| | | | llvm-svn: 354341
* [ELF] - Update test case after yaml2obj format change.George Rimar2019-02-191-1/+1
| | | | | | yaml2obj was changed in r354338("[yaml2obj][obj2yaml] - Support SHT_GNU_versym (.gnu.version) section.") llvm-svn: 354339
* Convert the eh-frame-hdr-abs-fde.s test to use x86 as a target architectureSimon Atanasyan2019-02-191-9/+9
| | | | | | | The test checks common functionality. Let's use `x86` (generic LLD target) as a target architecture. llvm-svn: 354336
OpenPOWER on IntegriCloud