summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Config.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r311468: If --dynamic-list is given, only those symbols are preemptibleRui Ueyama2017-08-221-1/+0
| | | | | | This reverts commit r311468 because it broke some CFI bots. llvm-svn: 311497
* If --dynamic-list is given, only those symbols are preemptibleRui Ueyama2017-08-221-0/+1
| | | | | | | | | | | | | | | | | Patch by Rafael Espíndola. This is PR34053. The implementation is a bit of a hack, given the precise location where IsPreemtible is set, it cannot be used from SymbolTable::handleAnonymousVersion. I could add another method to SymbolTable if you think that would be better. Differential Revision: https://reviews.llvm.org/D36499 llvm-svn: 311468
* [ELD] - Sorted in ASCIIbetical order. NFC.George Rimar2017-07-271-1/+1
| | | | llvm-svn: 309254
* [ELF] - Change way how we handle --noinhibit-execGeorge Rimar2017-07-261-1/+2
| | | | | | | | | | | | | Previously we handled this option implicitly, only for infering unresolved symbols handling policy. ld man says: "--noinhibit-exec Retain the executable output file whenever it is still usable", and we may want to handle other cases too. Differential revision: https://reviews.llvm.org/D35793 llvm-svn: 309091
* Add the --chroot option for --reproduce.Rui Ueyama2017-07-201-0/+1
| | | | | | | | | | | | | | | Summary: If the linker is invoked with `--chroot /foo` and `/bar/baz.o`, it tries to read the file from `/foo/bar/baz.o`. This feature is useful when you are dealing with files created by the --reproduce option. Reviewers: grimar Subscribers: llvm-commits, emaste Differential Revision: https://reviews.llvm.org/D35517 llvm-svn: 308646
* [ELF] - Implement filter library support (-F / --filter)George Rimar2017-07-171-0/+1
| | | | | | | | | | | | | | | | | | This is PR33766. -F name --filter=name When creating an ELF shared object, set the internal DT_FILTER field to the specified name. This tells the dynamic linker that the symbol table of the shared object which is being created should be used as a filter on the symbol table of the shared object name. If you later link a program against this filter object, then, when you run the program, the dynamic linker will see the DT_FILTER field. The dynamic linker will resolve symbols according to the symbol table of the filter object as usual, but it will actually link to the definitions found in the shared object name. Thus the filter object can be used to select a subset of the symbols provided by the object name. (https://linux.die.net/man/1/ld). Shared Objects as Filters: https://docs.oracle.com/cd/E19683-01/817-3677/chapter4-31738/index.html Differential revision: https://reviews.llvm.org/D35352 llvm-svn: 308167
* [lld/pdb] Add some basic linker module symbols.Zachary Turner2017-07-101-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D35152 llvm-svn: 307590
* Keep the original symbol name when renamed.Rui Ueyama2017-06-221-1/+1
| | | | | | | | | | | | | | Previously, when symbol A is renamed B, both A and B end up having the same name. This is because name is a symbol's attribute, and we memcpy symbols for symbol renaming. This pathc saves the original symbol name and restore it after memcpy to keep the original name. This patch shouldn't change program's meaning, but names in symbol tables make more sense than before. llvm-svn: 306036
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-1/+1
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* Symbols re-defined with -wrap and -defsym need to be excluded from inter-Dmitry Mikulin2017-06-051-0/+7
| | | | | | | | | | procedural optimizations to prevent dropping symbols and allow the linker to process re-directs. PR33145: --wrap doesn't work with lto. Differential Revision: https://reviews.llvm.org/D33621 llvm-svn: 304719
* [lld][ELF]Add option to make .dynamic read onlyPetr Hosek2017-05-261-0/+1
| | | | | | | | | | | | | | The .dynamic section of an ELF almost doesn't need to be written to with the exception of the DT_DEBUG entry. For several reasons having a read only .dynamic section would be useful. This change adds the -z keyword "rodynamic" which forces .dynamic to be read-only. In this case DT_DEBUG will not be emited. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D33251 llvm-svn: 304024
* [ELF] - Stop support of DF_STATIC_TLS flag.George Rimar2017-05-121-1/+0
| | | | | | | | This reverts changes introduced in r302414 "[ELF] - Set DF_STATIC_TLS flag for i386 target." Because DF_STATIC_TLS does not look to be used by glibc or anything else. llvm-svn: 302884
* [ELF] - Set DF_STATIC_TLS flag for i386 target.George Rimar2017-05-081-0/+1
| | | | | | | | | | | | | | | | | | This is PR32437. DF_STATIC_TLS If set in a shared object or executable, this flag instructs the dynamic linker to reject attempts to load this file dynamically. It indicates that the shared object or executable contains code using a static thread-local storage scheme. Implementations need not support any form of thread-local storage. Patch checks if IE/LE relocations were used to check if code uses static model. If so it sets the DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D32354 llvm-svn: 302414
* Accept archive files with no symbol table instad of warning on them.Rui Ueyama2017-05-031-1/+0
| | | | | | | | | | | | | It seems virtually everyone who tries to do LTO build with Clang and LLD was hit by a mistake to forget using llvm-ar command to create archive files. I wasn't an exception. Since this is an annoying common issue, it is probably better to handle that gracefully rather than reporting an error and tell the user to redo build with different configuration. Differential Revision: https://reviews.llvm.org/D32721 llvm-svn: 302083
* Rename RPath Rpath for consistency. NFC.Rui Ueyama2017-04-291-1/+1
| | | | | | | For an option -foo-bar-baz, we have Config->FooBarBaz. Since -rpath is -rpath and not -r-path, it should be Config->Rpath instead Config->RPath. llvm-svn: 301759
* [ELF] - Implemented --compress-debug-sections option.George Rimar2017-04-171-0/+1
| | | | | | | | | | | | | | Patch implements --compress-debug-sections=zlib. In compare with D20211 (a year old patch, abandoned), it implementation uses streaming and fully reimplemented, does not support zlib-gnu for simplification. This is PR32308. Differential revision: https://reviews.llvm.org/D31941 llvm-svn: 300444
* [ELF] Remove unused member [NFC]Rui Ueyama2017-04-141-1/+0
| | | | | | | | Patch by Alexander Richardson. Differential Revision: https://reviews.llvm.org/D32077 llvm-svn: 300359
* [ELF] Add -z nodlopen option.Davide Italiano2017-03-231-0/+1
| | | | | | Patch by Mark Kettenis. llvm-svn: 298567
* Define Config::Is64.Rui Ueyama2017-03-221-1/+4
| | | | | | | | This is a shorthand for Config->Wordsize == 8. So this is not strictly necessary but seems handy. "Is 64 bit?" is easier to read than "Is wordsize 8 byte?" llvm-svn: 298463
* Define Config::Endianness.Rui Ueyama2017-03-211-0/+4
| | | | | | This is a shorthand for `Config->IsLE ? support::little : support::big`. llvm-svn: 298445
* Compute Config member function return values only once.Rui Ueyama2017-03-171-36/+31
| | | | | | | | | | | We had a few Config member functions that returns configuration values. For example, we had is64() which returns true if the target is 64-bit. The return values of these functions are constant and never change. This patch is to compute them only once to make it clear that they'll never change. llvm-svn: 298168
* Define Config::isLE and Config::wordsize.Rui Ueyama2017-03-171-0/+6
| | | | | | | isLE() return true if the target is little-endian. wordsize() returns 8 for 64-bit and 4 for 32-bit. llvm-svn: 298167
* recommend using llvm-ar when finding undefined references and empty archivesBob Haarman2017-03-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: When we perform LTO builds with a version of ar that does not understand LLVM bitcode objects, we end up with undefined references, because our archive files do not list the bitcode symbols in their indices. The error messages do not make it clear what the real problem is. This change adds a note that points out the likely problem and solution. It is similar in spirit to r282633, but aims to avoid false positives by only triggering when we see both undefined references and archives without symbols in their indices. Fixes PR32281. Reviewers: davide, ruiu, tejohnson Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31011 llvm-svn: 298124
* ELF: Add cache pruning support.Peter Collingbourne2017-03-171-0/+2
| | | | | | | | | | This patch causes us to use pruneCache() to prune the ThinLTO cache after completing LTO. A new flag --thinlto-cache-policy allows users to configure the policy. Differential Revision: https://reviews.llvm.org/D31021 llvm-svn: 298036
* [ELF] - Rename Config->Is64Bit() to is64(). NFC.George Rimar2017-03-161-2/+2
| | | | | | Addresses post commit review comment. llvm-svn: 297953
* [ELF] - Detemplate GotPltSection and IgotPltSection sections.George Rimar2017-03-151-3/+5
| | | | | | | | | Patch introduces Config->is64Bit() and with help of that detemplates GotPltSection and IgotPltSection sections Differential revision: https://reviews.llvm.org/D30944 llvm-svn: 297813
* Handle ":" as a regular token character in linker scripts.Rui Ueyama2017-03-091-3/+2
| | | | | | | | | This is an alternative to https://reviews.llvm.org/D30500 to simplify the version definition parser and allow ":" in symbol names. Differential Revision: https://reviews.llvm.org/D30722 llvm-svn: 297402
* [ELF] - Implemented -znotextGeorge Rimar2017-03-091-0/+1
| | | | | | | | | | | | | gold linker manual describes them as: -z text Do not permit relocations in read-only segments -z notext Permit relocations in read-only segments (default) In LLD default is to not permit them. Patch implements -z notext. Differential revision: https://reviews.llvm.org/D30530 llvm-svn: 297366
* Remove Config->Rela and define Config->isRela() instead.Rui Ueyama2017-03-071-0/+20
| | | | llvm-svn: 297108
* Remove Config->Mips64EL and define Config->isMips64EL() instead.Rui Ueyama2017-03-071-1/+15
| | | | llvm-svn: 297107
* ELF: Add ThinLTO caching support.Peter Collingbourne2017-03-011-0/+1
| | | | | | | | | | This patch adds an option named --thinlto-cache-dir, which specifies the path to a directory in which to cache native object files for ThinLTO incremental builds. Differential Revision: https://reviews.llvm.org/D30509 llvm-svn: 296702
* [ELF] - Allow the Code Model flag when using LTOMartell Malone2017-02-281-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D29445 llvm-svn: 296542
* Remove a default value that is always overwritten.Rui Ueyama2017-02-251-1/+1
| | | | llvm-svn: 296230
* Do not handle -strip in a special way. NFC.Rui Ueyama2017-02-251-1/+1
| | | | llvm-svn: 296227
* Factor out code to parse -hash-style.Rui Ueyama2017-02-251-2/+2
| | | | llvm-svn: 296226
* Rename OMagic -> Omagic for consistency.Rui Ueyama2017-02-251-1/+1
| | | | llvm-svn: 296225
* Add `-z nocopyreloc` option.Rui Ueyama2017-02-211-0/+1
| | | | | | | This option disable creating copy relocations. ld.bfd and ld.gold have the same option. llvm-svn: 295772
* Remove stray semicolon.Rui Ueyama2017-02-141-1/+1
| | | | llvm-svn: 295077
* Do not store a computable attributes to Config.Rui Ueyama2017-02-141-2/+8
| | | | llvm-svn: 295031
* [LTO] Add support for optimization remarks.Davide Italiano2017-02-131-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D29878 llvm-svn: 294971
* Recommit r294464 "[ELF] - Added partial support for --emit-relocs (no ↵George Rimar2017-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | --gc-section case, no /DISCARD/ support) #3" with temporarily file name fix in testcase. Original commit message: -q, --emit-relocs - Generate relocations in output Simplest implementation: * no GC case, * no "/DISCARD/" linkerscript command support. This patch is extracted from D28612 / D29636, Relative to PR31579. Differential revision: https://reviews.llvm.org/D29663 llvm-svn: 294469
* Reverted r294464 "[ELF] - Added partial support for --emit-relocs (no ↵George Rimar2017-02-081-2/+0
| | | | | | | | | --gc-section case, no /DISCARD/ support) #3" Broked build bot: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/5835/steps/test/logs/stdio llvm-svn: 294466
* [ELF] - Added partial support for --emit-relocs (no --gc-section case, no ↵George Rimar2017-02-081-0/+2
| | | | | | | | | | | | | | | | | | /DISCARD/ support) #3 -q, --emit-relocs - Generate relocations in output Simplest implementation: * no GC case, * no "/DISCARD/" linkerscript command support. This patch is extracted from D28612 / D29636, Relative to PR31579. Differential revision: https://reviews.llvm.org/D29663 llvm-svn: 294464
* Fix and simplify the reporting of undefined symbols.Rafael Espindola2017-01-271-1/+1
| | | | | | | | | | | | Now reportUndefined only has to look at Config->UnresolvedSymbols and the symbol. getUnresolvedSymbolOption does all the hard work of mapping options like -shared and -z defs to one of the UnresolvedPolicy enum entries. The critical fix is that now "-z defs --warn-unresolved-symbols" only warns. llvm-svn: 293290
* Change the --retain-symbols-file implementation.Rafael Espindola2017-01-251-3/+2
| | | | | | | | | | | | | | | | It now uses the same infrastructure as symbol versions. This fixes us creating a dynamic relocation without a corresponding dynamic symbol. This also means that unlike gold and bfd we keep a STB_LOCAL in the static symbol table. It seems an odd feature to offer precise control over what is in a symbol table that is not used by the dynamic linker. We can bring this back if needed, but it would probably be better to just have --discard option that tells the linker to keep in the static symbol table only what is in the dynamic one. Should fix the eog build. llvm-svn: 293093
* Do not allocate space for common symbols with -rRui Ueyama2017-01-241-0/+1
| | | | | | | | | | | | | | | Currently ld.lld -r allocates space for common symbols, whereas ld.bfd -r doesn't. As a result the OpenBSD makefile bits for creating libraries fail as they use ld -X -r to strip local symbols, which results in duplicate symbol errors because space for the common symbols has been allocated. The diff also implements the --define-commons option such that allocation of commons can be forced even if -r is used. Patch by Mark Kettenis. llvm-svn: 292878
* Implement -Map.Rafael Espindola2017-01-131-0/+1
| | | | | | | The format is not exactly the same as the one in bfd since bfd always follows a linker script and prints it along. llvm-svn: 291958
* Simplify type of Config->SymbolOrderingFile.Rui Ueyama2016-12-201-1/+1
| | | | | | | | | | | That variable was of type DenseMap<StringRef, unsigned>, but the unsigned numbers needed to be monotonicly increasing numbers because the implementation that used the variable depended on that fact. That was an implementation detail and shouldn't have leaked into Config. This patch simplifies its type to std::vector<StringRef>. llvm-svn: 290151
* [ELF] - Implemented --retain-symbols-file optionGeorge Rimar2016-12-191-2/+4
| | | | | | | | | | | | | | | | --retain-symbols-file=filename Retain only the symbols listed in the file filename, discarding all others. filename is simply a flat file, with one symbol name per line. This option is especially useful in environments (such as VxWorks) where a large global symbol table is accumulated gradually, to conserve run-time memory. Note: though documentation says "--retain-symbols-file does not discard undefined symbols, or symbols needed for relocations.", both bfd and gold do that, and this patch too, like testcase show. Differential revision: https://reviews.llvm.org/D27716 llvm-svn: 290122
* Remove inappropriate use of CachedHashStringRef.Rui Ueyama2016-12-191-2/+1
| | | | | | | | | Use of CachedHashStringRef makes sense only when we reuse hash values. Sprinkling it to all DenseMap has no benefits and just complicates data types. Basically we shouldn't use CachedHashStringRef unless there is a strong reason to to do so. llvm-svn: 290076
OpenPOWER on IntegriCloud