summaryrefslogtreecommitdiffstats
path: root/lld/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] Fix handling of FDE negative relative PC addrAndrew Ng2018-07-233-0/+255
| | | | | | | | | | | | | | Signed values for the FDE PC addr were not correctly handled in readFdeAddr(). If the value is negative and the type of the value is smaller than 64 bits, the FDE PC addr overflow error would be incorrectly triggered. Fixed readFdeAddr() to properly handle signed values by sign extending where appropriate. Differential Revision: https://reviews.llvm.org/D49557 llvm-svn: 337683
* ELF: Read address significance tables with --icf=all.Peter Collingbourne2018-07-211-0/+45
| | | | | | | | | | | | | | | | Under --icf=all we now only apply KeepUnique to non-executable address-significant sections. This has the effect of making --icf=all mean unsafe ICF for executable sections and safe ICF for non-executable sections. With this change the meaning of the KeepUnique bit changes to "does the current ICF mode (together with the --keep-unique and --ignore-data-address-equality flags) require this section to be kept unique". Differential Revision: https://reviews.llvm.org/D49626 llvm-svn: 337640
* ELF: Make sections with KeepUnique bit eligible for ICF.Peter Collingbourne2018-07-211-1/+4
| | | | | | | | | | The only restriction is that we cannot merge more than one KeepUnique section together. This matches gold's behaviour and reduces code size when using --icf=safe. Differential Revision: https://reviews.llvm.org/D49622 llvm-svn: 337638
* [PDB] Write the command line after response file expansionReid Kleckner2018-07-201-1/+2
| | | | | | | | | | | | Summary: Fixes PR38085 Reviewers: ruiu, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49566 llvm-svn: 337628
* [ELF] Check eh_frame_hdr overflow with PC offsets instead of PC absolute ↵Fangrui Song2018-07-203-32/+58
| | | | | | | | | | | | addresses Reviewers: grimar, ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D49607 llvm-svn: 337610
* [COFF] Sort .reloc before all other discardable sectionsMartin Storsjo2018-07-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a binary is stripped, which can remove discardable sections (except for the .reloc section, which also is marked as discardable as it isn't loaded at runtime, only read by the loader), the .reloc section should be first of them, in order not to create gaps in the image. Previously, binaries with relocations were broken if they were stripped by GNU binutils strip. Trying to execute such binaries produces an error about "xx is not a valid win32 application". This fixes GNU binutils bug 23348. Prior to SVN r329370 (which didn't intend to have functional changes), the code for moving discardable sections to the end didn't clearly express how other discardable sections should be ordered compared to .reloc, but the change retained the exact same end result as before. After SVN r329370, the code (and comments) more clearly indicate that it tries to make the .reloc section the absolutely last one; this patch changes that. This matches how GNU binutils ld sorts .reloc compared to dwarf debug info sections. Differential Revision: https://reviews.llvm.org/D49351 Signed-off-by: Martin Storsjö <martin@martin.st> llvm-svn: 337598
* [ELF] - Fix mistypes in test cases.George Rimar2018-07-202-2/+2
| | | | llvm-svn: 337528
* [COFF] Write the debug directory and build id to a separate section for MinGWMartin Storsjo2018-07-201-0/+16
| | | | | | | | | | | | | | | | | For dwarf debug info, an executable normally either contains the debug info, or it is stripped out. To reduce the storage needed (slightly) for the debug info kept separately from the released, stripped binaries, one can choose to only copy the debug data from the original executable (essentially the reverse of the strip operation), producing a file with only debug info. When copying the debug data from an executable with GNU objcopy, the build id and debug directory need to reside in a separate section, as this will be kept while the rest of the .rdata section is removed. Differential Revision: https://reviews.llvm.org/D49352 llvm-svn: 337526
* [ELF][HEXAGON] Add support for R_HEX_B15_PCRELSid Manning2018-07-191-0/+4
| | | | | | | | Add support and update the testcase. Differential Revision: https://reviews.llvm.org/D49394 llvm-svn: 337494
* Add support for R_HEX_B32_PCREL_X, R_HEX_B22_PCREL_X relocationsSid Manning2018-07-191-0/+6
| | | | | | | | A couple more basic relocations plus testcase. Differential Revision: https://reviews.llvm.org/D47791 llvm-svn: 337484
* [ELF] - One more test case for .eh_frame_hdr.George Rimar2018-07-191-0/+28
| | | | | | | | | | This is to test the following error message: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L544 Which occurs when LLD meets unsupported address encoding when scans .eh_frame to build .eh_frame_hdr section. llvm-svn: 337458
* [PDB] Add PDBSourcePath flag to support absolutize source file pathTakuto Ikuta2018-07-193-0/+636
| | | | | | | | | | | | | | | | | | | | | This patch changes relative path for source files in obj files to absolute path in PDB when linking with added flag. I will make obj file generated by clang-cl independent from build directory for chromium build. But I don't want to confuse visual studio debugger or require additional configuration. To attain this goal, I added flag to convert relative source file path in obj to absolute path when emitting PDB. By removing absolute path from obj files, we can share build cache between chromium developers even when they are doing debug build. That will make build time faster. More context: https://bugs.chromium.org/p/chromium/issues/detail?id=712796 https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/5HXSVX-7fPc llvm-svn: 337439
* [COFF] Don't produce base relocs for discardable sectionsMartin Storsjo2018-07-191-0/+42
| | | | | | | | | | | | | Dwarf debug info contains some data that contains absolute addresses. Since these sections are discardable and aren't loaded at runtime, there's no point in adding base relocations for them. This makes sure that after stripping out dwarf debug info, there are no base relocations that point to nonexistent sections. Differential Revision: https://reviews.llvm.org/D49350 llvm-svn: 337438
* ELF: Implement --icf=safe using address-significance tables.Peter Collingbourne2018-07-182-0/+146
| | | | | | Differential Revision: https://reviews.llvm.org/D48146 llvm-svn: 337429
* [ELF] Error if -r --gdb-index are used togetherFangrui Song2018-07-181-14/+18
| | | | | | | | | | Reviewers: ruiu, espindola Subscribers: emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D49513 llvm-svn: 337427
* [WebAssembly] Fix archive member display in error messagesSam Clegg2018-07-183-4/+28
| | | | | | | | | Add a test for this by causing a symbol collision between archive members. Differential Revision: https://reviews.llvm.org/D49343 llvm-svn: 337426
* Revert r336609: Fix direct calls to __wrap_sym when it is relocated.Rui Ueyama2018-07-181-45/+0
| | | | | | | This reverts commit r336609 as it doesn't seem to work with AArch64 thunk creation when used with ASan. llvm-svn: 337413
* Look for an entry point function if /nodefaultlib is given.Rui Ueyama2018-07-181-0/+35
| | | | | | | | | | | | Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=38018 Reviewers: thakis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48990 llvm-svn: 337407
* [ELF] - Stop silently producing a broken .eh_frame_hdr.George Rimar2018-07-181-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, getFdePC() returns uint64_t. Its because the following encodings might use 8 bytes: DW_EH_PE_absptr and DW_EH_PE_udata8. But caller assigns returned value to uint32_t field: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L508 Value is used for building .eh_frame_hdr section. We use DW_EH_PE_sdata4 encoding for building it at this moment: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L2545 And that means that an overflow issue might happen if DW_EH_PE_absptr/DW_EH_PE_udata8 address encodings are present in .eh_frame. In that case, before this patch, we silently would truncate the address and produced broken .eh_frame_hdr section. It would be not hard to support real 64-bit values for DW_EH_PE_absptr/DW_EH_PE_udata8 encodings, but it is unclear if it is usefull and if we should do it. Since nobody faced/reported it, int this patch I only implement a check to stop producing broken output silently for now. llvm-svn: 337382
* [ELF] - Add a test case to check DW_EH_PE_absptr address encoding.George Rimar2018-07-181-0/+74
| | | | | | | This covers the following line of the code: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L525 llvm-svn: 337377
* [ELF] - Improve eh-frame-value-format7.s test case.George Rimar2018-07-181-2/+23
| | | | | | | This adds .eh_frame_hdr content checking to test that DW_EH_PE_udata2 address was decoded correctly. llvm-svn: 337374
* [ELF] - Improve relocatable-many-sections.s test case. NFC.George Rimar2018-07-181-0/+7
| | | | | | This adds a check for .shstrtab section index. llvm-svn: 337365
* [ELF] - Do not produce broken output when amount of sections is > ~65kGeorge Rimar2018-07-181-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | This is a part of ttps://bugs.llvm.org//show_bug.cgi?id=38119 We produce broken ELF header now when the number of output sections is >= SHN_LORESERVE (0xff00). ELF spec says (http://www.sco.com/developers/gabi/2003-12-17/ch4.eheader.html): e_shnum: If the number of sections is greater than or equal to SHN_LORESERVE (0xff00), this member has the value zero and the actual number of section header table entries is contained in the sh_size field of the section header at index 0. (Otherwise, the sh_size member of the initial entry contains 0.) e_shstrndx If the section name string table section index is greater than or equal to SHN_LORESERVE (0xff00), this member has the value SHN_XINDEX (0xffff) and the actual index of the section name string table section is contained in the sh_link field of the section header at index 0. (Otherwise, the sh_link member of the initial entry contains 0.) We did not set these fields correctly earlier. The patch fixes the issue. Differential revision: https://reviews.llvm.org/D49371 llvm-svn: 337363
* [ELF] — Add a test case for DW_EH_PE_udata2 encoding.George Rimar2018-07-181-0/+54
| | | | | | | | This adds a test to check LLD can handle such address format correctly. Test case covers the following line: https://github.com/llvm-mirror/lld/blob/master/ELF/SyntheticSections.cpp#L519 llvm-svn: 337362
* Implement framework for linking split-stack object files, and x86_64 support.Sterling Augustine2018-07-175-11/+203
| | | | llvm-svn: 337332
* [WebAssemlby] Set IsUsedInRegularObj correctly for undefined data symbolsSam Clegg2018-07-172-0/+53
| | | | | | Differential Revision: https://reviews.llvm.org/D49113 llvm-svn: 337314
* [ELF] - Add test for checking unknown -color-diagnostics arguments.George Rimar2018-07-171-0/+3
| | | | | | | This covers a following line with the test: https://github.com/llvm-mirror/lld/blob/master/ELF/DriverUtils.cpp#L73 llvm-svn: 337268
* [ELF] - Add a test for --no-warn-symbol-ordering.George Rimar2018-07-171-0/+5
| | | | | | | | | | Mentioned flag was never tested together with --call-graph-ordering-file. And the following line was uncovered: https://github.com/llvm-mirror/lld/blob/master/ELF/Symbols.cpp#L248 llvm-svn: 337266
* [ELF] - Check we able to report function symbols that encloses a location in ↵George Rimar2018-07-171-0/+14
| | | | | | | | | | | | error messages. InputSectionBase::getLocation() have the following block of the code which is uncovered by our test cases: https://github.com/llvm-mirror/lld/blob/master/ELF/InputSection.cpp#L238 Patch adds a test to trigger this branch. llvm-svn: 337256
* [ELF] - Fix BB. 'Filecheck' -> 'FileCheck'.George Rimar2018-07-171-1/+1
| | | | llvm-svn: 337254
* [ELF] - Check we are able to report zlib decompressor errors.George Rimar2018-07-171-0/+11
| | | | | | | This test case adds a check for the following line of the code: https://github.com/llvm-mirror/lld/blob/master/ELF/InputSection.cpp#L194 llvm-svn: 337252
* [ELF] - Check we are able to report errors when DW_AT_decl_file is invalid.George Rimar2018-07-171-0/+103
| | | | | | | | We did not try to support this intentionally but have an error handling and reporting logic that can take care of that and hence needs a test. llvm-svn: 337250
* remove temporal file directory before testing in thinlto-debug-fission.llYunlian Jiang2018-07-161-1/+1
| | | | | | | | | | | | | | | | Summary: This removes the %T/dwo directory before calling ld.lld in ELF/lto/thinlto-debug-fission.ll so that files aren't left over from previous runs. Reviewers: espindola, pcc Reviewed By: pcc Subscribers: inglorion, emaste, arichardson, eraman, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D49390 llvm-svn: 337210
* Support option -plugin-opt=dwo_dir=Yunlian Jiang2018-07-161-0/+21
| | | | | | | | | | | | | | | | Summary: This adds support to option -plugin-opt=dwo_dir=${DIR}. This option is used to specify the directory to store the .dwo files when LTO and debug fission is used at the same time. Reviewers: ruiu, espindola, pcc Reviewed By: pcc Subscribers: eraman, dexonsmith, mehdi_amini, emaste, arichardson, steven_wu, llvm-commits Differential Revision: https://reviews.llvm.org/D47904 llvm-svn: 337195
* [ELF] - Cover ObjFile<ELFT>::getLineInfo() with a test.George Rimar2018-07-161-0/+36
| | | | | | There was no test for the first `return`. llvm-svn: 337182
* attempt to get test/COFF/driver.test passing on sanitizer-x86_64-linux-fast; ↵Nico Weber2018-07-141-1/+1
| | | | | | cf r337092 llvm-svn: 337093
* lld-link: Add /lib to Options.td so that it appears in lld-link's help output.Nico Weber2018-07-141-0/+6
| | | | | | https://reviews.llvm.org/D49319 llvm-svn: 337086
* [coff] Remove dots in path pointing to PDB file.Zachary Turner2018-07-121-0/+10
| | | | | | | | | | | Some Microsoft tools (e.g. new versions of WPA) fail when the COFF Debug Directory contains a path to the PDB that contains dots, such as D:\foo\./bar.pdb. Remove dots before writing this path. This fixes pr38126. llvm-svn: 336873
* Also search BitcodeFiles for exclude-lib symbolsYi Kong2018-07-112-3/+10
| | | | | | | | Archives created with ThinLTO are bitcodes, they also need to be searched for excluded symbols. Differential Revision: https://reviews.llvm.org/D48857 llvm-svn: 336826
* [ELF] Update addends in non-allocatable sections for REL targets when ↵Igor Kudrin2018-07-111-0/+12
| | | | | | | | | | creating a relocatable output. This fixes PR37735. Differential Revision: https://reviews.llvm.org/D48929 llvm-svn: 336799
* [ELF] - Report proper error message about mixing bitcode files.George Rimar2018-07-112-0/+11
| | | | | | | | | If we have 2 bitcode inputs for different targets, LLD would print "<internal>" instead of the name of one of the files. The patch adds a test and fixes this issue. llvm-svn: 336794
* Parallelize GdbIndexSection's symbol table creation.Rui Ueyama2018-07-111-9/+9
| | | | | | | | | | | | | | | | | | | | | Since .gdb_index sections contain all known symbols, they can be very large. One of my executables has a .gdb_index section of 1350 GiB. Uniquifying symbols by name takes 3.77 seconds on my machine. This patch parallelize it. Time to call createSymbols() with 8.4 million unique symbols: Without this patch: 3773 ms Parallelism = 1: 4374 ms Parallelism = 2: 2628 ms Parallelism = 16: 837 ms As you can see above, this algorithm is a bit more inefficient than the non-parallelized version, but even with dual-core, it is faster than that, so I think it is overall a win. Differential Revision: https://reviews.llvm.org/D49164 llvm-svn: 336790
* Remove a workaround for an old GCC bug.Rui Ueyama2018-07-111-60/+0
| | | | | | | | | | | | | | This workaround is for GCC 5.4.1. Without this workaround, lld will produce larger .gdb_index sections for object files compiled with the buggy version of the compiler. Since it is not for correctness, and it affects only debug builds (since you are generating .gdb_index sections), perhaps the hack shouldn't have been added in the first place. At least, I think it is time to remove this hack. Differential Revision: https://reviews.llvm.org/D49149 llvm-svn: 336788
* [ELF][MIPS] Add mote tests on MipsArchTree routines, fix typos in error messagesSimon Atanasyan2018-07-104-53/+251
| | | | | | | | | This fix add more test cases for routines check MIPS ELF header flags and flags from .MIPS.abiflags sections. The tests use yaml2obj for object files generation because not all combinations of flags can be produced by LLVM tools. llvm-svn: 336704
* [ELF] - Add a test for readCallGraph() code.George Rimar2018-07-101-2/+4
| | | | | | | This is to test the following untested line: https://github.com/llvm-mirror/lld/blob/master/ELF/Driver.cpp#L643 llvm-svn: 336670
* [COFF] Store import symbol pointers as pointers to the base classMartin Storsjo2018-07-102-0/+22
| | | | | | | | | | | | | | | Future symbol insertions can potentially change the type of these symbols - keep pointers to the base class to reflect this, and use dynamic casts to inspect them before using as the subclass type. This fixes crashes that were possible before, by touching these symbols that now are populated as e.g. a DefinedRegular, via the old pointers with DefinedImportThunk type. Differential Revision: https://reviews.llvm.org/D48953 llvm-svn: 336652
* [ELF] - Improve call graph pasing error reporting.George Rimar2018-07-101-0/+13
| | | | | | | This adds a file name to the error message, adds a missing test case and refactors code a bit. llvm-svn: 336651
* [ELF] - Report call graph profile file names in error messages.George Rimar2018-07-101-1/+1
| | | | | | We did not report file names for some reason. llvm-svn: 336650
* Fix a bug for packed relocations.Rui Ueyama2018-07-091-0/+85
| | | | | | | | | Previously, we didn't create multiple consecutive bitmaps. Added a test to catch this bug too. Differential Revision: https://reviews.llvm.org/D49107 llvm-svn: 336620
* Fix direct calls to __wrap_sym when it is relocated.Rui Ueyama2018-07-091-0/+45
| | | | | | | | | | | | Patch by Matthew Koontz! Before, direct calls to __wrap_sym would not map to valid PLT entries, so they would crash at runtime. This change maps such calls to the same PLT entry as calls to sym that are then wrapped. Differential Revision: https://reviews.llvm.org/D48502 llvm-svn: 336609
OpenPOWER on IntegriCloud