summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Config.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Change the implementation of --dynamic-list to use linker script parsing.Rafael Espindola2016-12-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | The feature is documented as ----------------------------- The format of the dynamic list is the same as the version node without scope and node name. See *note VERSION:: for more information. -------------------------------- And indeed qt uses a dynamic list with an 'extern "C++"' in it. With this patch we support that The change to gc-sections-shared makes us match bfd. Just because we kept bar doesn't mean it has to be in the dynamic symbol table. The changes to invalid-dynamic-list.test and reproduce.s are because of the new parser. The changes to version-script.s are the only case where we change behavior with regards to bfd, but I would like to see a mix of --version-script and --dynamic-list used in the wild before complicating the code. llvm-svn: 289082
* Make a decision about whether we should warn on missing entry or not early.Rui Ueyama2016-12-071-1/+1
| | | | | | | Config->WarnMissingEntry is a single-purpose boolean variable, and I think it's easier to understand than Config->HasEntry. llvm-svn: 288883
* Simplify -e <number> option handling.Rui Ueyama2016-12-071-1/+0
| | | | | | This patch is to parse the entry symbol name lazily. llvm-svn: 288882
* [ELF] Shared libraries should have entry pointPetr Hosek2016-12-071-0/+1
| | | | | | | | | | | Shared libraries should have entry set following the same rules as for regular binaries. The only difference is that in case the default entry point (_start or __start) isn't found (unless it was set explicitly), we shouldn't give a warning as in case of regular binaries. Differential Revision: https://reviews.llvm.org/D27497 llvm-svn: 288878
* [ELF] - Implemented -N (-omagic) command line option.George Rimar2016-11-291-0/+1
| | | | | | | | | | -N (-omagic) Set the text and data sections to be readable and writable. Also, do not page-align the data segment. Differential revision: https://reviews.llvm.org/D26888 llvm-svn: 288123
* [ELF] - Implemented -no-rosegment.George Rimar2016-11-281-0/+1
| | | | | | | | --no-rosegment: Do not put read-only non-executable sections in their own segment Differential revision: https://reviews.llvm.org/D26889 llvm-svn: 288020
* Make getColorDiagnostics return a boolean value instead of an enum.Rui Ueyama2016-11-261-5/+2
| | | | | | | Config->ColorDiagnostics was of type enum before. Now it is just a boolean flag. Thanks Rafael for suggestion. llvm-svn: 287978
* [ELF] Be compliant with LLVM and rename Lto into LTO. NFCI.Davide Italiano2016-11-261-5/+5
| | | | llvm-svn: 287967
* Support -color-diagnostics={auto,always,never}.Rui Ueyama2016-11-251-0/+4
| | | | | | | | | | | | | | | | -color-diagnostics=auto is default because that's the same as Clang's default. When color is enabled, error or warning messages are colored like this. error: <bold>ld.lld</bold> <red>error:</red> foo.o: no such file warning: <bold>ld.lld</bold> <magenta>warning:</magenta> foo.o: no such file Differential Revision: https://reviews.llvm.org/D27117 llvm-svn: 287949
* Fix uninitialized variable access.Rui Ueyama2016-11-231-1/+1
| | | | llvm-svn: 287797
* Limit default maximum number of errors to 20.Rui Ueyama2016-11-231-0/+1
| | | | | | | | | | | | | | | | | | This is in the context of https://llvm.org/bugs/show_bug.cgi?id=31109. When LLD prints out errors for relocations, it tends to print out extremely large number of errors (like millions) because it would print out one error per relocation. This patch makes LLD bail out if it prints out more than 20 errors. You can configure the limitation using -error-limit argument. -error-limit=0 means no limit. I chose the flag name because Clang has the same feature as -ferror-limit. "f" doesn't make sense to us, so I omitted it. Differential Revision: https://reviews.llvm.org/D26981 llvm-svn: 287789
* Use consistent variable name.Rui Ueyama2016-11-181-1/+1
| | | | llvm-svn: 287318
* Use uint16_t instead of size_t for symbol version ID.Rui Ueyama2016-11-171-2/+2
| | | | | | Because it is uint16_t in the ELF spec. Using size_t was confusing. llvm-svn: 287198
* [ELF] - Separate locals list from versions.George Rimar2016-11-161-1/+1
| | | | | | | | | This change separates all versioned locals to be a separate list in config, that was suggested by Rafael and simplifies the logic a bit. Differential revision: https://reviews.llvm.org/D26754 llvm-svn: 287132
* [ELF] - Add support for locals list in version script.George Rimar2016-11-121-0/+1
| | | | | | | | | | | | | | | | | | | Previously we did not support anything except "local: *", patch changes that. Actually GNU rules of proccessing wildcards are more complex than that (http://www.airs.com/blog/archives/300): There are 2 iteration for wildcards, at first iteration "*" wildcards are ignored and handled at second iteration. Since we previously decided not to implement such complex rules, I suggest solution that is implemented in this patch. So for "local: *" case nothing changes, but if we have wildcarded locals, they are processed before wildcarded globals. This should fix several FreeBSD ports, one of them is jpeg-turbo-1.5.1 and currently blocks about 5k of ports. Differential revision: https://reviews.llvm.org/D26395 llvm-svn: 286713
* [ELF] - Implemented --symbol-ordering-file option.George Rimar2016-11-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Patch allows to pass a symbols file to linker. LLD will map symbols to sections and sort sections in output according to symbol ordering file. That can help to reduce the startup time and/or amount of pagefaults during startup. Also, interesting benchmark result was produced by Rafael Espíndola. After applying the symbols file for clang he timed compiling X86MCTargetDesc.ii to an object file. The page faults went from just 56,988 to 56,946 since most faults are not in the binary. Running time went from 4.403053515 to 4.178112244. The speedup seems to be because of better cache locality. Differential revision: https://reviews.llvm.org/D26130 llvm-svn: 286440
* [ELF][MIPS] N32 ABI supportSimon Atanasyan2016-11-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | In short the patch introduces support for linking object file conform MIPS N32 ABI [1]. This ABI is similar to N64 ABI but uses 32-bit pointer size. The most non-trivial requirement of this ABI is one more relocation packing format. N64 ABI puts multiple relocation type into the single relocation record. The N32 ABI uses series of successive relocations with the same offset for this purpose. In this patch, new function `mergeMipsN32RelTypes` handle this case and "convert" N32 relocation to the N64 relocation so the rest of the code keep unchanged. For now, linker does not support series of relocations applied to sections without SHF_ALLOC bit. Probably later I will add the support or insert some sort of assert into the `relocateNonAlloc` routine to catch this case. [1] ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf Differential revision: https://reviews.llvm.org/D26298 llvm-svn: 286052
* Store OSABI in Config.Rafael Espindola2016-10-271-0/+1
| | | | | | This allows us to set a value for it based on -m. llvm-svn: 285294
* Call _exit.Rafael Espindola2016-10-261-0/+1
| | | | | | | | | | | | | As the state of lld gets more complicated, shutting down gets more expensive. In a normal lld run we can just call _exit immediately after renaming the temporary output file. We still want the ability to run a full shutdown since that is useful for detecting memory leaks. This patch adds a --full-shutdown flag and changes lit to use it. llvm-svn: 285224
* [ELF] - Partial support of --gdb-index command line option (Part 1).George Rimar2016-10-201-0/+1
| | | | | | | | | | | | | | | In this patch partial gdb_index section is created. For costructing the .gdb_index section 6 steps should be performed (details are in SplitDebugInfo.cpp file header), this patch do first 3: Creates proper section header. Fills list of compilation units. Types CU list area is not supposed to be supported, so it is ignored and therefore can be treated as implemented either. Differential revision: https://reviews.llvm.org/D24706 llvm-svn: 284708
* Remove Config::Binary.Rui Ueyama2016-10-201-1/+0
| | | | | | This member is used only by LinkerDriver, so move it to LinkerDriver. llvm-svn: 284696
* Allow linker-script-defined entry symbols.Rui Ueyama2016-10-201-1/+0
| | | | | | | | Previously, we were checking the existence of an entry symbol too early. It was done before the linker script processor creates symbols defined in scripts. Fixes bug 30743. llvm-svn: 284676
* [ELF] Support for R_ARM_TARGET2 relocationPeter Smith2016-10-171-0/+4
| | | | | | | | | | | | | | | | | The R_ARM_TARGET2 relocation is used in ARM exception tables to encode a data dependency that will only be dereferenced by code in the run-time support library. In a similar way to R_ARM_TARGET1 the handling of the relocation is target specific, it maps to one of R_ARM_ABS32, R_ARM_REL32 or R_ARM_GOT_PREL. The choice depends on the run-time library. R_ARM_GOT_PREL is used for linux and BSD, R_ARM_ABS32 and R_ARM_REL32 are used for bare-metal. The command line option --target2=<target> can be used to select the relocation used for R_ARM_TARGET2. The default is R_ARM_GOT_PREL. Differential revision: https://reviews.llvm.org/D25684 llvm-svn: 284404
* [ELF] - Implemented -z wxneeded.George Rimar2016-10-141-0/+1
| | | | | | | | | | | | | -z wxneeded creates a PHDR PT_OPENBSD_WXNEEDED. PT_OPENBSD_WXNEEDED The array element specifies that a process executing this file may need to be able to map or protect memory regions as simultaneously executable and writable. If the system is unable or unwilling to permit that for this executable then it may fail immediately. This segment type is meaningful only for executable files and is ignored in other objects. http://man.openbsd.org/OpenBSD-current/man5/elf.5 Differential revision: https://reviews.llvm.org/D25472 llvm-svn: 284226
* Make variable name consistent with other -z options.Rui Ueyama2016-10-111-1/+1
| | | | llvm-svn: 283910
* [LTO] Split the options for ThinLTO jobs and Regular LTO partitionsDavide Italiano2016-10-101-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D25452 llvm-svn: 283817
* [ELF] Support -z max-page-size optionPetr Hosek2016-09-281-1/+2
| | | | | | | | | | | | This options issupported by both BFD ld and gold and allows overriding the max page size whose default values are defined by the target. https://llvm.org/bugs/show_bug.cgi?id=30541 Differential Revision: https://reviews.llvm.org/D24891 llvm-svn: 282596
* Rename SortSectionPolicy::IgnoreConfig to None.Rui Ueyama2016-09-161-1/+1
| | | | | | Because it corresponds to SORT_NONE. None was renamed Default. llvm-svn: 281776
* [ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.George Rimar2016-09-161-0/+4
| | | | | | | | | | | | | | | | This fixes Bug 30385 - SORT_NONE not implemented, `SORT_NONE' disables section sorting by ignoring the command line section sorting option. That is why this patch also implements --sort-section option. Description of sorting rules available at https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html Differential revision: https://reviews.llvm.org/D24604 llvm-svn: 281771
* [ELF] - Implemented --section-start, -Ttext, -Tdata, -Tbss options.George Rimar2016-09-141-0/+1
| | | | | | | | | | | | | | | | | | --section-start=sectionname=org Locate a section in the output file at the absolute address given by org. You may use this option as many times as necessary to locate multiple sections in the command line. org must be a single hexadecimal integer; for compatibility with other linkers, you may omit the leading `0x' usually associated with hexadecimal values. Note: there should be no white space between sectionname, the equals sign (“<=>”), and org. -Tbss=org -Tdata=org -Ttext=org Same as --section-start, with .bss, .data or .text as the sectionname. Differential revision: https://reviews.llvm.org/D24294 llvm-svn: 281458
* Use murmurhash2 instead of fnv.Rafael Espindola2016-09-141-1/+1
| | | | | | It is substantially faster by processing 8 bytes at a time. llvm-svn: 281454
* [ELF] Add support for -b binaryMichael J. Spencer2016-09-091-0/+1
| | | | | | | | | | Implemented by building an ELF file in memory. elf, default, and binary match gold behavior. Differential Revision: https://reviews.llvm.org/D24060 llvm-svn: 281108
* Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.George Rimar2016-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed code that was not checked before on windows for me, because of testcases that are disabled on that platform atm. Inital commit message: "[ELF] - Versionscript: do not treat non-wildcarded names as wildcards." Previously we incorrectly handled cases when symbol name in extern c++ tag was enclosed in quotes. Next case was treated as wildcard: GLIBCXX_3.4 { extern "C++" { "aaa*" } But it should have not. Quotes around aaa here means that we should have do exact name matching. That is PR30268 which has name with pointer is interpreted as wildcard by lld: extern "C++" { "operator delete[](void*)"; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D24229 llvm-svn: 281049
* Revert r281045, it broke BB.George Rimar2016-09-091-1/+0
| | | | | | | Broken BB: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27211 llvm-svn: 281046
* Recommit [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.George Rimar2016-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixed code that was not checked by testcases that are disabled on windows. Inital commit message: "[ELF] - Versionscript: do not treat non-wildcarded names as wildcards." Previously we incorrectly handled cases when symbol name in extern c++ tag was enclosed in quotes. Next case was treated as wildcard: GLIBCXX_3.4 { extern "C++" { "aaa*" } But it should have not. Quotes around aaa here means that we should have do exact name matching. That is PR30268 which has name with pointer is interpreted as wildcard by lld: extern "C++" { "operator delete[](void*)"; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D24229 llvm-svn: 281045
* [ELF] - Revert r281038 to see if that unbreaks build bot.George Rimar2016-09-091-1/+0
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/19703 llvm-svn: 281041
* [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.George Rimar2016-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | Previously we incorrectly handled cases when symbol name in extern c++ tag was enclosed in quotes. Next case was treated as wildcard: GLIBCXX_3.4 { extern "C++" { "aaa*" } But it should have not. Quotes around aaa here means that we should have do exact name matching. That is PR30268 which has name with pointer is interpreted as wildcard by lld: extern "C++" { "operator delete[](void*)"; Patch fixes the issue. Differential revision: https://reviews.llvm.org/D24229 llvm-svn: 281038
* Set entry address to 0x0 if no _start symbolEugene Leviant2016-09-081-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D23925 llvm-svn: 280912
* Rename UnresolvedPolicy::Error -> UnresolvedPolicy::ReportError.Rui Ueyama2016-09-021-1/+1
| | | | | | | | "Error" looks like it is indicating a parse error. "Error" actually instructs the later process to report an error if there's an error condition. Thus the new name. llvm-svn: 280529
* Add -nostdlib.Rui Ueyama2016-09-021-0/+1
| | | | llvm-svn: 280528
* [ELF] - Fix for: bug 30237 - lld does not implement -f optionGeorge Rimar2016-09-021-0/+1
| | | | | | | | | | | | | FreeBSD's libstdc++ build (used on tier-2 architectures) uses GNU ld's -f <name> option, which sets the DT_AUXILIARY field to the specified name. Multiple -f options may be specified and the DT_AUXILIARY entries will be added in the order in which they appear. Patch implements that option. Differential revision: https://reviews.llvm.org/D24139 llvm-svn: 280475
* [ELF] - Introduce DiscardPolicy instead of 3 relative bool fields.George Rimar2016-08-311-3/+4
| | | | | | | | | | | DiscardPolicy is enum replacing several boolean options. This approach is not only consistent with what we use for unresolveds (UnresolvedPolicy), but also should help to solve a problem of options with opposing meanings, mentioned in PR28843 Differential revision: https://reviews.llvm.org/D23868 llvm-svn: 280209
* [ELF] - Introduce StripPolicy instead of Config->StripAll/StripDebug flags.George Rimar2016-08-311-2/+6
| | | | | | | | | | This approach is not only consistent with UnresolvedPolicy, but also should help to solve a problem of options with opposing meanings, mentioned in PR28843 Differential revision: https://reviews.llvm.org/D23869 llvm-svn: 280206
* Implement support for --build-id=uuid switchEugene Leviant2016-08-261-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D23349 llvm-svn: 279810
* [ELF] - Implemented --oformat binary option.George Rimar2016-08-251-0/+1
| | | | | | | | | | | -oformat output-format `-oformat' option can be used to specify the binary format for the output object file. Patch implements binary format output type. Differential revision: https://reviews.llvm.org/D23769 llvm-svn: 279726
* [ELF] Allow specifying the stack sizePetr Hosek2016-08-171-0/+1
| | | | | | | | | This option can be used to specify the stack size of the PT_GNU_STACK segment. Differential Revision: https://reviews.llvm.org/D23538 llvm-svn: 279013
* [ELF/ARM] Add support for R_ARM_TARGET1 relocation.Davide Italiano2016-08-011-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D22990 llvm-svn: 277369
* Remove dead code.Rui Ueyama2016-07-171-2/+0
| | | | llvm-svn: 275724
* Handle versioned symbols efficiently.Rui Ueyama2016-07-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Versions can be assigned to symbols in two different ways. One is the usual version scripts, and the other is special symbol suffix '@'. If a symbol contains '@', the string after that is considered to specify a version name. Previously, we look for '@' for all symbols. Anything that works on every symbol can be expensive because the linker has to handle a lot of symbols. The search for '@' was not an exception. In this patch, I made two optimizations. The first optimization is to handle '@' only when at least one version is defined. If no versions are defined, no versions can be assigned to any symbols, so it's waste of time to search for '@'. The second optimization is to scan only suffixes of symbol names instead of entire symbol names. Symbol names can be very long, but symbol versions are usually short, so scanning entire symbol names is waste of time, too. There are some error cases which we no longer be able to detect with this patch. I don't think it's a major drawback because they are minor errors. Speed is more important. This change improves LLD with debug info self-link time from 6.6993 seconds to 6.3426 seconds (or -5.3%). Differential Revision: https://reviews.llvm.org/D22433 llvm-svn: 275711
* Recommit r275257 "[ELF] - Implement extern "c++" version script tag"George Rimar2016-07-161-2/+7
| | | | | | | | | | | | | | | | | | | | | BSD toolchain contains a bug: https://sourceforge.net/p/elftoolchain/tickets/491/ In short demangler works differently, fix was to update the testcase. It should fix the FreeBSD bot failture: http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/19432/steps/test_lld/logs/stdio Original commit message was: [ELF] - Implement extern "c++" version script tag Patch implements 'extern' version script tag. Currently only values in quotes(") are supported. Matching of externs is performed in the same pass as exact match of globals. Differential revision: http://reviews.llvm.org/D21930 llvm-svn: 275682
OpenPOWER on IntegriCloud