summaryrefslogtreecommitdiffstats
path: root/lld/ELF
Commit message (Collapse)AuthorAgeFilesLines
...
* Make a lambda a static function to make the ICF main function shorter.Rui Ueyama2018-02-091-11/+9
| | | | llvm-svn: 324756
* Do not print out removed ICF sections for -verbose.Rui Ueyama2018-02-091-10/+4
| | | | | | | | | | | GNU gold doesn't print out ICF sections for -verbose. It only shows them for -print-icf-sections. We printed out them for -verbose because we didn't have -print-icf-sections. Now that we have the option, there's no reason to print out for -verbose. Differential Revision: https://reviews.llvm.org/D43100 llvm-svn: 324755
* Make --export-dynamic-symbol to pull out object files from archives.Rui Ueyama2018-02-091-1/+3
| | | | | | | | | | | | | | This is for compatiblity with GNU gold. GNU gold tries to resolve symbols specified by --export-dynamic-symbol. So, if a symbol specified by --export-dynamic-symbol is in an archive file, lld's result is currently different from gold's. Interestingly, that behavior is different for --dynamic-list. I added a new test to ensure that. Differential Revision: https://reviews.llvm.org/D43103 llvm-svn: 324752
* Refactor how we decide which sections to sort.Rafael Espindola2018-02-091-28/+33
| | | | | | | | | | | | | This is a bit more verbose, but it has a few advantages. The logic on what to do with special sections like .init_array is not duplicated. Before we would need keep isKnownNonreorderableSection in sync. I think with this the call graph based sorting can be implemented by "just" returning a new order from buildSectionOrder. llvm-svn: 324744
* Remove redundant semicolon.Rui Ueyama2018-02-091-1/+1
| | | | llvm-svn: 324698
* Use log to print out a verbose message.Rui Ueyama2018-02-091-4/+2
| | | | llvm-svn: 324688
* Remove Config->Verbose because we have errorHandler().Verbose.Rui Ueyama2018-02-084-7/+7
| | | | llvm-svn: 324684
* Fix --print-icf-sections output.Rui Ueyama2018-02-081-1/+1
| | | | | | | Previously, multiple chunks of --print-icf-sections messages were interleaved and didn't make sense. This is because forEachClass is multi-threaded. llvm-svn: 324683
* [ELF] Don't sort non reorderable sections with --symbol-ordering-fileMichael J. Spencer2018-02-081-1/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D43038 llvm-svn: 324656
* Symbols defined in linker scripts should not have dso_local flag set in LTO ↵Dmitry Mikulin2018-02-081-2/+3
| | | | | | | | resolutions. Differential Revision: https://reviews.llvm.org/D43051 llvm-svn: 324559
* Add --build-id=fast as a synonym for --build-id.Rui Ueyama2018-02-071-0/+2
| | | | | | | | | | | | When you omit an argument, most options fall back to their defaults. For example, --color-diagnostics is a synonym for --color-diagnostics=auto. We don't have a way to specify the default choice for --build-id, so we can't describe --build-id (without an argument) in that way. This patch adds "fast" for the default build-id choice. Differential Revision: https://reviews.llvm.org/D43032 llvm-svn: 324502
* [ELF][MIPS] Ignore incorrect version definition index for _gp_disp symbolSimon Atanasyan2018-02-071-0/+8
| | | | | | | | | | | | MIPS BFD linker puts _gp_disp symbol into DSO files and assigns zero version definition index to it. This value means 'unversioned local symbol' while _gp_disp is a section global symbol. We have to handle this bug in the LLD because BFD linker is used for building MIPS toolchain libraries. Differential revision: https://reviews.llvm.org/D42486 llvm-svn: 324467
* [ELF] - Remove unused synthetic sections correctly.George Rimar2018-02-071-14/+12
| | | | | | | | | | | | | | | | This is PR35740 which now crashes because we remove unused synthetic sections incorrectly. We can keep input section description and corresponding output section live even if it must be empty and dead. This results in a crash because SHF_LINK_ORDER handling code tries to access first section which is nullptr in this case. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D42681 llvm-svn: 324463
* [ELF] - Make defsym to work correctly with reserved symbols.George Rimar2018-02-071-1/+1
| | | | | | | | | | | | Previously --defsym=foo2=etext+2 would produce incorrect value for foo2 because expressions did not work correctly with reserved symbols, section offset was calculated wrong for them. Fixes PR35744. Differential revision: https://reviews.llvm.org/D42911 llvm-svn: 324461
* [ELF] - Allow set CPU string with -plugin-opt=mcpu=<xxx>George Rimar2018-02-071-2/+3
| | | | | | | | | | | | | | Previously we ignored -plugin-opt=mcpu=<xxx> and the only way to set CPU string was to pass -mllvm -mcpu=<xxx> Though clang may pass it with use of plugin options: -plugin-opt=mcpu=x86-64 Since we are trying to be compatible in command line with gold plugin, seems we should support it too. Differential revision: https://reviews.llvm.org/D42956 llvm-svn: 324459
* Don't set dso_local flag in LTO resolutions for absolute symbols defined in ELFDmitry Mikulin2018-02-071-1/+7
| | | | | | | | | objects, it confuses codegen into generating pc-rel relocations for those symbols, which leads to linker errors. Differential Revision: https://reviews.llvm.org/D42977 llvm-svn: 324435
* Simplify libtool compatibility hack.Rafael Espindola2018-02-071-7/+1
| | | | | | | | | | | | | I tested that if I remove "elf" from the message, building a program that uses libtool prints checking whether to build shared libraries... no but with this patch it still prints checking whether to build shared libraries... yes llvm-svn: 324428
* Convert a use of Config->Static.Rafael Espindola2018-02-061-1/+1
| | | | | | | | | | In lld this was the only use of Config->Static where it meant anything else other than "use .a instead of .so". If a program turns out to not use any dynamic libraries, we should produce the same result with and without -static. llvm-svn: 324421
* Store just argv[0] in Config.Rafael Espindola2018-02-064-9/+9
| | | | | | | Having the full argv there seems in conflict with the desire to parse all command line options in the Driver. llvm-svn: 324418
* Hide the --full-shutdown option.Rafael Espindola2018-02-062-1/+2
| | | | llvm-svn: 324365
* [ELF] - Re-commit r324322 "Use ↵George Rimar2018-02-061-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options.". With fix: Keep logic that ignores -plugin-opt=mcpu=x86-64 -plugin-opt=thinlto, add checks for those to testcases. Original commit message: [ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options. gold plugin uses InitTargetOptionsFromCodeGenFlags + ParseCommandLineOptions for parsing LTO options. Patch do the same change for LLD. Such change helps to avoid parsing/whitelisting LTO plugin options again on linker side, what can help LLD to automatically support new -plugin-opt=xxx options passed. Differential revision: https://reviews.llvm.org/D42733 llvm-svn: 324340
* Revert r324322 "[ELF] - Use ↵George Rimar2018-02-061-10/+13
| | | | | | | | | InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for parsing LTO options." It broke BB: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/8162 llvm-svn: 324332
* [ELF] - Use InitTargetOptionsFromCodeGenFlags/ParseCommandLineOptions for ↵George Rimar2018-02-061-13/+10
| | | | | | | | | | | | | | | | | parsing LTO options. gold plugin uses InitTargetOptionsFromCodeGenFlags + ParseCommandLineOptions for parsing LTO options. Patch do the same change for LLD. Such change helps to avoid parsing/whitelisting LTO plugin options again on linker side, what can help LLD to automatically support new -plugin-opt=xxx options passed. Differential revision: https://reviews.llvm.org/D42733 llvm-svn: 324322
* Add -no-allow-multiple-definition, -no-pic-executable and -no-warn-common.Rui Ueyama2018-02-062-7/+11
| | | | | | | | GNU gold has these options. Differential Revision: https://reviews.llvm.org/D42929 llvm-svn: 324300
* Replace ApplyDynamicRelocs with WriteAddends.Rafael Espindola2018-02-053-7/+8
| | | | | | | The difference is that WriteAddends also takes IsRela into consideration. llvm-svn: 324271
* Change the default of --apply-dynamic-relocs.Rafael Espindola2018-02-051-1/+1
| | | | | | | | | | | | | When using Elf_Rela every tool should use the addend in the relocation. We have --apply-dynamic-relocs to work around bugs in tools that don't do that. The default value of --apply-dynamic-relocs should be false to make sure these bugs are more easily found in the future. llvm-svn: 324264
* Allow both -no-omagic and --no-omagic.Rui Ueyama2018-02-051-1/+1
| | | | | | | Any multi-character option that doesn't start with "o" should be allowed to start both with "-" and "--". llvm-svn: 324262
* [ELF] Implement --[no-]apply-dynamic-relocs option.Peter Smith2018-02-054-4/+12
| | | | | | | | | | | | | | | | When resolving dynamic RELA relocations the addend is taken from the relocation and not the place being relocated. Accordingly lld does not write the addend field to the place like it would for a REL relocation. Unfortunately there is some system software, in particlar dynamic loaders such as Bionic's linker64 that use the value of the place prior to relocation to find the offset that they have been loaded at. Both gold and bfd control this behavior with the --[no-]apply-dynamic-relocs option. This change implements the option and defaults it to true for compatibility with gold and bfd. Differential Revision: https://reviews.llvm.org/D42797 llvm-svn: 324221
* [ELF] - Report valid binary filename when reporting error.George Rimar2018-02-052-4/+4
| | | | | | | | | | We did not report valid filename for duplicate symbol error when symbol came from binary input file. Patch fixes it. Differential revision: https://reviews.llvm.org/D42635 llvm-svn: 324217
* Simplify.Rui Ueyama2018-02-021-2/+1
| | | | llvm-svn: 324155
* Update Eq so that it uses NAME just like B does. NFC.Rui Ueyama2018-02-021-2/+2
| | | | llvm-svn: 324154
* Add -{no,}-check-sections flags to enable/disable section overlcheckingRui Ueyama2018-02-024-1/+9
| | | | | | | | GNU linkers have this option. Differential Revision: https://reviews.llvm.org/D42858 llvm-svn: 324150
* Strip .note.gnu.build-id sections if --build-id is given.Rui Ueyama2018-02-021-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D42823 llvm-svn: 324146
* Add --no-gnu-unique and --no-undefined-version for completeness.Rui Ueyama2018-02-025-12/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D42865 llvm-svn: 324145
* Consolidate --foo and --no-foo options. NFC.Rui Ueyama2018-02-021-63/+47
| | | | | | Differential Revision: https://reviews.llvm.org/D42859 llvm-svn: 324141
* [ELF][MIPS] Change format of output relocations to Elf_RelSimon Atanasyan2018-02-022-3/+3
| | | | | | | | | | | Initially LLD generates Elf_Rel relocations for O32 ABI and Elf_Rela relocations for N32 / N64 ABIs. In other words, format of input and output relocations was always the same. Now LLD generates all output relocations using Elf_Rel format only. It conforms to ABIs requirement. The patch suggested by Alexander Richardson. llvm-svn: 324064
* Fix typo: --nopie -> --no-pie.Rui Ueyama2018-02-022-3/+3
| | | | | | | | | --nopie was a typo. GNU gold doesn't recognize it. It is also inconsistent with other options that have --foo and --no-foo. Differential Revision: https://reviews.llvm.org/D42825 llvm-svn: 324043
* Don't accept unsuitable ELF files such as executables or core files.Rui Ueyama2018-02-021-1/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D42827 llvm-svn: 324041
* Relax the grammar of the version script.Rui Ueyama2018-02-011-0/+5
| | | | | | | | | In GNU linkers, the last semicolon is optional. We can't link libstdc++ with lld because of that difference. Differential Revision: https://reviews.llvm.org/D42820 llvm-svn: 324036
* Sort each InputSectionDescription individually.Rafael Espindola2018-02-011-3/+3
| | | | | | | | | This fixes pr36190. Thanks to James Henderson for the testcase and for pointing out how to fix this. llvm-svn: 323993
* [ELF] Add --print-icf-sections flagJames Henderson2018-02-014-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Currently ICF information is output through stderr if the "--verbose" flag is used. This differs to Gold for example, which uses an explicit flag to output this to stdout. This commit adds the "--print-icf-sections" and "--no-print-icf-sections" flags and changes the output message format for clarity and consistency with "--print-gc-sections". These messages are still output to stderr if using the verbose flag. However to avoid intermingled message output to console, this will not occur when the "--print-icf-sections" flag is used. Existing tests have been modified to expect the new message format from stderr. Patch by Owen Reynolds. Differential Revision: https://reviews.llvm.org/D42375 Reviewers: ruiu, rafael Reviewed by: llvm-svn: 323976
* Simplify by sorting relocations before writing them.Rafael Espindola2018-02-011-17/+7
| | | | llvm-svn: 323944
* [ELF] Make overlapping output sections an errorAlexander Richardson2018-01-313-7/+107
| | | | | | | | | | | | | | | | | | | | | | | 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
* [ELF] - Do not forget file name when reporting duplicate symbol error for ↵George Rimar2018-01-311-4/+5
| | | | | | | | | | | | absolute symbols. When there is a duplicate absolute symbol, LLD reports <internal> instead of known object file name currently. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D42636 llvm-svn: 323849
* [LLD] Use Rela on PowerPC tooRui Ueyama2018-01-311-1/+2
| | | | | | | | | | | | | | | | Patch by Nicholas Allegra. The spec for ELF on PowerPC: http://refspecs.linux-foundation.org/elf/elfspec_ppc.pdf says: "The PowerPC family uses only the Elf32_Rela relocation entries with explicit addends." (EM_PPC64 should be covered by Config->Is64 already.) Differential Revision: https://reviews.llvm.org/D40826 llvm-svn: 323843
* Pass CPU string to LTO pipeline.Rafael Espindola2018-01-301-0/+1
| | | | | | | | | | Previously an empty CPU string was passed to the LTO engine which resulted in a generic CPU for which certain features like NOPL were disabled. This fixes that. Patch by Pratik Bhatu! llvm-svn: 323801
* Run dos2unix in a few files. NFC.Rafael Espindola2018-01-301-7/+7
| | | | llvm-svn: 323793
* Move function to the file where it is used.Rafael Espindola2018-01-303-30/+27
| | | | llvm-svn: 323780
* Sort orphan section if --symbol-ordering-file is given.Rafael Espindola2018-01-305-36/+18
| | | | | | Before this patch orphan sections were not sorted. llvm-svn: 323779
* [ELF] - Remove dead declaration. NFC.George Rimar2018-01-301-1/+0
| | | | llvm-svn: 323747
OpenPOWER on IntegriCloud