summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert a check to checkLazy.Rafael Espindola2017-12-061-2/+3
| | | | | | | This brings memory allocations when linking clang from 270.96MB to 267.80MB. llvm-svn: 319932
* Convert a few uses of check to checkLazy.Rafael Espindola2017-12-061-7/+9
| | | | | | Linking clang goes from 292.68MB to 281.80MB allocated. llvm-svn: 319927
* Convert a call to check to checkLazy.Rafael Espindola2017-12-061-3/+4
| | | | | | Linking clang goes from 300.82MB to 292.68MB allocated. llvm-svn: 319926
* Replace one use of check with checkLazy.Rafael Espindola2017-12-061-2/+2
| | | | | | Reduce total allocation when linking clang from 320.04MB to 300.82MB. llvm-svn: 319924
* Add a checkLazy error checking variant.Rafael Espindola2017-12-061-8/+4
| | | | | | | | | This avoids allocating the error message when there is no error that check requires. It avoids the code duplication of inlining check. llvm-svn: 319922
* Don't allocate memory for an error message on success.Rafael Espindola2017-12-061-1/+4
| | | | | | | This takes memory allocations when linking clang-fsds from 342.08MB to 320.04MB. llvm-svn: 319918
* Don't allocate an error message when there is no error.Rafael Espindola2017-12-061-2/+4
| | | | | | | According to heaptrack this takes "bytes allocated in total" when linking clang-fsds from 405.69MB to 342.08MB. llvm-svn: 319916
* Use Symbol::File directly.Rafael Espindola2017-11-291-2/+2
| | | | | | | We are already paying the cost of storing a InputFile in every Symbol, so use it uniformly. llvm-svn: 319378
* [ELF] Make sure SHT_ARM_ATTRIBUTES is only recognized by Arm TargetsPeter Smith2017-11-291-0/+2
| | | | | | | | The SHT_ARM_ATTRIBUTES section type is in the processor specific space adding guard to make sure that it is only recognized when EMachine is EM_ARM. llvm-svn: 319304
* Move Memory.{h,cpp} to Common.Rui Ueyama2017-11-281-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D40571 llvm-svn: 319221
* [ELF] Read ARM BuildAttributes section to determine supported features.Peter Smith2017-11-281-5/+53
| | | | | | | | | | | | | | | | | | | lld assumes some ARM features that are not available in all Arm processors. In particular: - The blx instruction present for interworking. - The movt/movw instructions are used in Thunks. - The J1=1 J2=1 encoding of branch immediates to improve Thumb wide branch range are assumed to be present. This patch reads the ARM Attributes section to check for the architecture the object file was compiled with. If none of the objects have an architecture that supports either of these features a warning will be given. This is most likely to affect armv6 as used in the first Raspberry Pi. Differential Revision: https://reviews.llvm.org/D36823 llvm-svn: 319169
* Simplify as-needed handling.Rafael Espindola2017-11-221-1/+1
| | | | | | This is a reduction of a patch by Rui Ueyama. llvm-svn: 318852
* [ELF] - Allow applying SHF_MERGE optimization for relocatable output.George Rimar2017-11-171-6/+0
| | | | | | | | | | | This fixes PR35223. Here I enabled SHF_MERGE section content merging for -r like we do for regular linking. Differential revision: https://reviews.llvm.org/D40026 llvm-svn: 318516
* Remove IsLocal.Rafael Espindola2017-11-171-11/+8
| | | | | | | Since we always have Binding in the current symbol design IsLocal is redundant. llvm-svn: 318497
* Remove an unnecessary constraint.Rafael Espindola2017-11-151-10/+1
| | | | | | | Our current implementation of SHF_MERGE can already handle over aligned elements. llvm-svn: 318310
* [DWARFv5] Support DW_FORM_strp in the .debug_line header.Paul Robinson2017-11-071-1/+3
| | | | | | | | Supporting this form in .debug_line.dwo will be done as a follow-up. Differential Revision: https://reviews.llvm.org/D33155 llvm-svn: 317607
* Report an error if an inferred alignment for a shared symbol is too large.Rui Ueyama2017-11-071-2/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D39697 llvm-svn: 317528
* ELF: Merge DefinedRegular and Defined.Peter Collingbourne2017-11-061-2/+2
| | | | | | | | | Now that DefinedRegular is the only remaining derived class of Defined, we can merge the two classes. Differential Revision: https://reviews.llvm.org/D39667 llvm-svn: 317448
* [ELF] - Fix error reporting with --strip-debug/--strip-all.George Rimar2017-11-041-4/+0
| | | | | | | | | | | Currently LLD tries to use information about functions and variables location taking it from debug sections. When --strip-* is given we discard such sections and that breaks error reporting. Patch stops discarding such sections and just removes them from InputSections list. Differential revision: https://reviews.llvm.org/D39550 llvm-svn: 317405
* Rename SymbolBody -> SymbolRui Ueyama2017-11-031-7/+6
| | | | | | | | | | | | | Now that we have only SymbolBody as the symbol class. So, "SymbolBody" is a bit strange name now. This is a mechanical change generated by perl -i -pe s/SymbolBody/Symbol/g $(git grep -l SymbolBody lld/ELF lld/COFF) nd clang-format-diff. Differential Revision: https://reviews.llvm.org/D39459 llvm-svn: 317370
* [ELF] - Teach LLD to strip .zdebug_* sections when --strip-debug/--strip-all ↵George Rimar2017-11-031-1/+2
| | | | | | | | | | | is specified. Currently we do not strip .zdebug_*, what looks wrong. Also this simplifies the testcase we have for this options. Differential revision: https://reviews.llvm.org/D39552 llvm-svn: 317306
* [ELF] - Teach LLD to report line numbers for data symbols.George Rimar2017-11-011-3/+64
| | | | | | | | | | | | | | | | | | | This is PR34826. Currently LLD is unable to report line number when reporting duplicate declaration of some variable. That happens because for extracting line information we always use .debug_line section content which describes mapping from machine instructions to source file locations, what does not help for variables as does not describe them. In this patch I am taking the approproate information about variables locations from the .debug_info section. Differential revision: https://reviews.llvm.org/D38721 llvm-svn: 317080
* Merge SymbolBody and Symbol into one class, SymbolBody.Rui Ueyama2017-10-311-20/+14
| | | | | | | | | | | | | | | | | | | SymbolBody and Symbol were separated classes due to a historical reason. Symbol used to be a pointer to a SymbolBody, and the relationship between Symbol and SymbolBody was n:1. r2681780 changed that. Since that patch, SymbolBody and Symbol are allocated next to each other to improve memory locality, and they have 1:1 relationship now. So, the separation of Symbol and SymbolBody no longer makes sense. This patch merges them into one class. In order to avoid updating too many places, I chose SymbolBody as a unified name. I'll rename it Symbol in a follow-up patch. Differential Revision: https://reviews.llvm.org/D39406 llvm-svn: 317006
* Remove unnecessary code.Rui Ueyama2017-10-291-6/+3
| | | | | | | Discarded section's Repl always points to itself, so returning Sec is not different from returning Sec->Repl. llvm-svn: 316880
* Remove an obscure comment.Rui Ueyama2017-10-291-4/+1
| | | | llvm-svn: 316878
* Fix ubsan error that shift amount 64 is too large.Rui Ueyama2017-10-291-1/+3
| | | | llvm-svn: 316863
* Fix ubsan error.Rui Ueyama2017-10-281-1/+1
| | | | | | | This patch fixes ubsan's "shift exponent 64 is too large for 32-bit type 'int'" error. llvm-svn: 316849
* Rename V -> Ver for readability.Rui Ueyama2017-10-281-6/+6
| | | | llvm-svn: 316842
* Pass symbol attributes instead of ElfSym to Shared symbol ctor.Rui Ueyama2017-10-281-14/+18
| | | | | | | This change allows us to use less templates for Shared symbol and the functions that deals with shared symbols. llvm-svn: 316841
* Simplify error handling.Rui Ueyama2017-10-281-16/+9
| | | | | | | | I don't think we have to aim for precise bug compatibility. We can return a nullptr if a section is consumed by the linker, and the rest should naturally work. llvm-svn: 316817
* [lld] unified COFF and ELF error handling on new Common/ErrorHandlerBob Haarman2017-10-251-1/+1
| | | | | | | | | | | | | | | | | | | Summary: The COFF linker and the ELF linker have long had similar but separate Error.h and Error.cpp files to implement error handling. This change introduces new error handling code in Common/ErrorHandler.h, changes the COFF and ELF linkers to use it, and removes the old, separate implementations. Reviewers: ruiu Reviewed By: ruiu Subscribers: smeenai, jyknight, emaste, sdardis, nemanjai, nhaehnle, mgorny, javed.absar, kbarton, fedor.sergeev, llvm-commits Differential Revision: https://reviews.llvm.org/D39259 llvm-svn: 316624
* Use more precise type.Rui Ueyama2017-10-111-1/+1
| | | | llvm-svn: 315426
* Handle input section liveness only in MarkLive.cpp.Rui Ueyama2017-10-101-14/+0
| | | | | | | | | | | | The condition whether a section is alive or not by default is becoming increasingly complex, so the decision of garbage collection is spreading over InputSection.h and MarkLive.cpp, which is not a good state. This moves the code to MarkLive.cpp, to keep the file the central place to make decisions about garbage collection. llvm-svn: 315384
* Update for llvm change.Rafael Espindola2017-10-101-1/+1
| | | | llvm-svn: 315377
* [ELF] Don't crash when parsing a file with out-of-bounds version referencesAlexander Richardson2017-10-051-3/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: We were crashing when linking telnetd in FreeBSD because lld was emitting corrupted output files for --norosegment. In this file the version index of some symbols was set to 9 but lld only found 8 version definitions. I am not sure how to create a minimal .so file that also exposes this behaviour so I just added the one that initially caused the error to Inputs/ This partially addresses https://bugs.llvm.org/show_bug.cgi?id=34705 Reviewers: ruiu, rafael, pcc, grimar Reviewed By: ruiu Subscribers: emaste, krytarowski Tags: #lld Differential Revision: https://reviews.llvm.org/D38397 llvm-svn: 315036
* [ELF] Don't crash when parsing a file with external version definition ↵Alexander Richardson2017-10-051-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | references Summary: We were crashing when linking telnetd in FreeBSD because lld was emitting corrupted output files for --norosegment. In this file the version index of some symbols was set to 9 but lld only found 8 version definitions. I am not sure how to create a minimal .so file that also exposes this behaviour so I just added the one that initially caused the error to Inputs/ This partially addresses https://bugs.llvm.org/show_bug.cgi?id=34705 Reviewers: ruiu, rafael, pcc, grimar Reviewed By: ruiu Subscribers: emaste, krytarowski Tags: #lld Differential Revision: https://reviews.llvm.org/D38397 llvm-svn: 315035
* [ELF] - Update after LLVM r314883 change. NFC.George Rimar2017-10-041-1/+1
| | | | llvm-svn: 314884
* Make parameter lists of SymbolTable::add* functions more consistent. NFC.Rui Ueyama2017-09-301-3/+4
| | | | llvm-svn: 314591
* [ELF] - Introduce std::vector<InputFile *> global arrays.George Rimar2017-09-191-4/+5
| | | | | | | | | | | | This patch removes lot of static Instances arrays from different input file classes and introduces global arrays for access instead. Similar to arrays we have for InputSections/OutputSectionCommands. It allows to iterate over input files in a non-templated code. Differential revision: https://reviews.llvm.org/D35987 llvm-svn: 313619
* [ELF] Prevent crash with binary inputs with non-ascii file namesJames Henderson2017-09-071-1/+1
| | | | | | | | | | | | | | If using --format=binary with an input file name that has one or more non-ascii characters in, LLD has undefined behaviour (it crashes on my Windows Debug build) when calling isalnum with these non-ascii characters. Instead, of calling std::isalnum, this patch uses an internal version that ignores the locale and checks a specific subset of characters. Reviewers: ruiu Differential Revision: https://reviews.llvm.org/D37331 llvm-svn: 312705
* Rename {Lazy,}ObjectKind -> {Lazy,}ObjKind.Rui Ueyama2017-08-191-1/+1
| | | | | | | I renamed corresponding classes in r309199 but forgot to rename enums at the moment. Rename them now to make them consistent. llvm-svn: 311214
* Move File from SymbolBody to Symbol.Rafael Espindola2017-08-041-2/+2
| | | | | | | | | | | | | With this Symbol has the same size as before, but DefinedRegular goes from 72 to 64 bytes. I also find this a bit easier to read. There are fewer places initializing File for example. This has a small but measurable speed improvement on all tests (1% max). llvm-svn: 310142
* [ELF] - Move getSymbols() methods to InputFile.George Rimar2017-08-041-11/+5
| | | | | | | | It can help to detemplate code. Differential revision: https://reviews.llvm.org/D35936 llvm-svn: 310049
* Use more consistent namesRafael Espindola2017-08-021-16/+17
| | | | | | | | | | | | | | | | | | | | Reviewing another change I noticed that we use "getSymbols" to mean different things in different files. Depending on the file it can return ArrayRef<StringRef> ArrayRef<SymbolBody*> ArrayRef<Symbol*> ArrayRef<Elf_Sym> With this change it always returns an ArrayRef<SymbolBody*>. The other functions are renamed getELFsyms() and getSymbolNames(). Note that we cannot return ArrayRef<Symbol*> instead of ArreyRef<SymbolBody*> because local symbols have a SymbolBody but not a Symbol. llvm-svn: 309840
* Rename ObjectFile -> ObjFile.Rui Ueyama2017-07-261-44/+38
| | | | | | | Rename it because it was too easy to conflict with llvm::object::ObjectFile which broke buildbots several times. llvm-svn: 309199
* Remove unnecessary namespace specifier.Rui Ueyama2017-07-261-14/+12
| | | | | | I believe this compiles fine on all platforms, even on Windows. llvm-svn: 309182
* Detemplate SymbolTable.Rafael Espindola2017-07-261-33/+33
| | | | | | NFC, just makes it easier to access from non templated code. llvm-svn: 309152
* [ELF] Avoid data race in ObjectFile<ELFT>::getDILineInfo().Igor Kudrin2017-07-211-2/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D35537 llvm-svn: 308728
* Add the --chroot option for --reproduce.Rui Ueyama2017-07-201-0/+6
| | | | | | | | | | | | | | | 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
* Speed up gdb index creation.Rafael Espindola2017-07-191-22/+10
| | | | | | | | | | | With that in place we can use lld's own infrastructure for the low level detail of dwarf parsing. With this we don't decompress sections twice, we don't scan all realocations and even with this simplistic implementation linking clang with gdb index goes from 34.09 seconds to 20.80 seconds. llvm-svn: 308544
OpenPOWER on IntegriCloud