summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a memory leak found by check-lld asan tests.Ivan Krasin2016-04-061-2/+2
| | | | | | | | | | | | | | | | | | Summary: This bug was introduced by http://reviews.llvm.org/rL265059, where InputSectionBase got Thunks field, which can do memory allocations. Since InputSectionBase destructors were never called (I count it as another bug), that caused a memory leak when 2 or more thunks are added to a section. The fix to is properly call InputSectionBase destructors from ~ObjectFile. Reviewers: atanasyan, ruiu, rafael Subscribers: rafael, krasin, pcc Differential Revision: http://reviews.llvm.org/D18809 llvm-svn: 265497
* Fix formatting.Rui Ueyama2016-04-051-1/+1
| | | | llvm-svn: 265424
* Update for llvm change.Rafael Espindola2016-04-051-2/+2
| | | | llvm-svn: 265404
* Remove redundant argument. NFC.Rafael Espindola2016-04-051-4/+3
| | | | llvm-svn: 265386
* Regenerate test file.Rafael Espindola2016-04-041-3/+0
| | | | | | | It had been created with a lld version that was producing an invalid sh_info. llvm-svn: 265305
* Don't store an Elf_Sym for most symbols.Rafael Espindola2016-04-041-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Our symbol representation was redundant, and some times would get out of sync. It had an Elf_Sym, but some fields were copied to SymbolBody. Different parts of the code were checking the bits in SymbolBody and others were checking Elf_Sym. There are two general approaches to fix this: * Copy the required information and don't store and Elf_Sym. * Don't copy the information and always use the Elf_Smy. The second way sounds tempting, but has a big problem: we would have to template SymbolBody. I started doing it, but it requires templeting *everything* and creates a bit chicken and egg problem at the driver where we have to find ELFT before we can create an ArchiveFile for example. As much as possible I compared the test differences with what gold and bfd produce to make sure they are still valid. In most cases we are just adding hidden visibility to a local symbol, which is harmless. In most tests this is a small speedup. The only slowdown was scylla (1.006X). The largest speedup was clang with no --build-id, -O3 or --gc-sections (i.e.: focus on the relocations): 1.019X. llvm-svn: 265293
* Revert "[ELF] SHF_MERGE section with 0 entsize is not fatal"Rafael Espindola2016-03-211-3/+1
| | | | | | | | | This reverts commit r263664. The reason we were getting broken files was lld -r, and that has been fixed. llvm-svn: 263944
* [ELF] SHF_MERGE section with 0 entsize is not fatalEd Maste2016-03-161-1/+3
| | | | | | | | | | For now just treat such sections as non-mergeable. Resubmit r263660 with test fix. Differential Revision: http://reviews.llvm.org/D18225 llvm-svn: 263664
* Revert r263660 as one of the tests is broken.Ed Maste2016-03-161-3/+1
| | | | llvm-svn: 263661
* [ELF] SHF_MERGE section with 0 entsize is not fatalEd Maste2016-03-161-1/+3
| | | | | | | | For now just treat such sections as non-mergeable. Differential Revision: http://reviews.llvm.org/D18222 llvm-svn: 263660
* Use ELFT instead of ELFFile<ELFT>.Rui Ueyama2016-03-141-8/+6
| | | | llvm-svn: 263510
* Error messages should start with lowercase letters.Rui Ueyama2016-03-141-3/+3
| | | | llvm-svn: 263496
* Remove uint32_X type.Rui Ueyama2016-03-131-3/+3
| | | | | | This type is equivalent to Elf_Word type. llvm-svn: 263397
* ELF: Split initializeSections and add comments.Rui Ueyama2016-03-131-18/+36
| | | | llvm-svn: 263395
* Recommit of r263252, [ELF] - Change all messages to lowercase to be consistent.George Rimar2016-03-121-14/+14
| | | | | | | | | | | | | | | | | | | | | which was reverted because included unrelative changes by mistake. Original commit message: [ELF] - Change all messages to lowercase to be consistent. That is directly opposite to http://reviews.llvm.org/D18045, which was reverted. This patch changes all messages to start from lowercase letter if they were not before. That is done to be consistent with clang. Differential revision: http://reviews.llvm.org/D18085 llvm-svn: 263337
* Revert r263252: "[ELF] - Change all messages to lowercase to be consistent."Rui Ueyama2016-03-111-51/+61
| | | | | | This reverts commit r263252 because the change contained unrelated changes. llvm-svn: 263272
* [ELF] - Change all messages to lowercase to be consistent.George Rimar2016-03-111-61/+51
| | | | | | | | | | | | | | That is directly opposite to http://reviews.llvm.org/D18045, which was reverted. This patch changes all messages to start from lowercase letter if they were not before. That is done to be consistent with clang. Differential revision: http://reviews.llvm.org/D18085 llvm-svn: 263252
* Avoid calling getNamedValue.Rafael Espindola2016-03-111-37/+47
| | | | | | | In lld we usually avoid hash lookups. In addition to that, IR names are not fully mangled, so it is best to avoid using them whenever possible. llvm-svn: 263248
* This reverts the r263125George Rimar2016-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | It was discussed to make all messages be lowercase to be consistent with clang. (also reverts the r263128 which fixed build bot fail after r263125) Original commit message: [ELF] - Consistent spelling for error/warning messages Previously error and warnings were not consistent in lld. Some of them started from lowercase letter, others from uppercase. Also there was one or two which had a dot at the end. This patch changes all messages to start from uppercase letter if they were not before. Differential revision: http://reviews.llvm.org/D18045 llvm-svn: 263240
* Represent local symbols with DefinedRegular.Rafael Espindola2016-03-111-5/+7
| | | | llvm-svn: 263237
* Remember the input section of locals.Rafael Espindola2016-03-111-1/+1
| | | | | | This is already a simplification, but will allow much more. llvm-svn: 263224
* Create a SymbolBody for locals.Rafael Espindola2016-03-111-25/+30
| | | | | | pr26878 shows a case where locals have to be in the got. llvm-svn: 263222
* Fix indentation.Sean Silva2016-03-111-1/+1
| | | | | | Somehow this slipped by in r263197. Thanks to Rui for noticing. llvm-svn: 263198
* [lto] The previous testcase was not useful enough.Sean Silva2016-03-111-0/+2
| | | | | | -shared was hiding the fact that the intrinsic wasn't being found. llvm-svn: 263197
* [lto] Make sure that ctors are added to the combined module.Sean Silva2016-03-111-1/+3
| | | | | | | | | | | | | | Summary: More generally, appending linkage is a special case that we don't want to create a SymbolBody for. Reviewers: rafael, ruiu Subscribers: Bigcheese, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D18012 llvm-svn: 263179
* [ELF] - Consistent spelling for error/warning messagesGeorge Rimar2016-03-101-1/+1
| | | | | | | | | | | | Previously error and warnings were not consistent in lld. Some of them started from lowercase letter, others from uppercase. Also there was one or two which had a dot at the end. This patch changes all messages to start from uppercase letter if they were not before. Differential revision: http://reviews.llvm.org/D18045 llvm-svn: 263125
* Fixed "not all control paths return a value" warning. NFC.George Rimar2016-03-091-0/+1
| | | | llvm-svn: 263040
* [ELF] - Issue an error if trying to link object that uses splitstacks.George Rimar2016-03-091-0/+3
| | | | | | | | | | | Each object file compiled in split stack mode will have an empty section with a special name: .note.GNU-split-stack We don't support this in linker now, so patch just adds an error out for that. Differential revision: http://reviews.llvm.org/D17918 llvm-svn: 263039
* Simplify: SHN_ABS is >= SHN_LORESERVE.Rafael Espindola2016-03-091-1/+1
| | | | llvm-svn: 263012
* [lto] Avoid duplicate symbol error for appending linkage.Sean Silva2016-03-091-0/+2
| | | | | | | | | | | | | | | | Summary: Is there any other code needed for correctly handling appending linkage? Do we need to do something more with @llvm.global_ctors in SymbolTable.cpp:addBitcodeFile; otherwise the combined bitcode module won't have all the global ctors. Reviewers: rafael Subscribers: Bigcheese, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D17975 llvm-svn: 262992
* Avoid unnecessary qualification.Sean Silva2016-03-091-1/+1
| | | | | | Thanks to Rui for spotting this. llvm-svn: 262983
* [lto] Record whether a variable is TLS.Sean Silva2016-03-091-0/+1
| | | | | | | | | | | | Summary: Reviewers: rafael Subscribers: Bigcheese, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D17974 llvm-svn: 262975
* Assume GV is not null for now.Rafael Espindola2016-03-091-8/+6
| | | | | | It will come back when we add support for inline asm in .bc files. llvm-svn: 262972
* [lto] Don't add variables with private linkage to the symbol table.Sean Silva2016-03-081-1/+3
| | | | | | | | | | | | | | | Summary: This causes the issue in PR26872 to go away now that we aren't creating symbols for the string literals, but that may just be concealing a deeper problem, so best to keep that PR open. Reviewers: rafael Subscribers: Bigcheese, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D17971 llvm-svn: 262968
* Add support for common symbols.Rafael Espindola2016-03-071-3/+10
| | | | llvm-svn: 262848
* Do not use "default" for a fully-covered switch.Rui Ueyama2016-03-071-2/+2
| | | | llvm-svn: 262846
* lto: Record visibility in defined symbols.Rafael Espindola2016-03-071-1/+1
| | | | llvm-svn: 262835
* Split BitcodeFile::parse. NFC.Rui Ueyama2016-03-071-11/+13
| | | | llvm-svn: 262813
* lto: Start taking symbol visibility into consideration.Rafael Espindola2016-03-051-2/+15
| | | | llvm-svn: 262761
* Use check function.Rui Ueyama2016-03-041-4/+1
| | | | llvm-svn: 262685
* Rename 'fatal' to 'check' when it doesn't always fail.Rafael Espindola2016-03-031-16/+16
| | | | llvm-svn: 262666
* Simplify error handling.Rafael Espindola2016-03-031-52/+24
| | | | | | | This makes fatal return T when there is no error. This avoids the need for quite a few temporaries. llvm-svn: 262626
* [ELF] - add support for relocations against local symbols when producing ↵George Rimar2016-03-031-1/+3
| | | | | | | | | | | | | relocatable output. There was a known limitation for -r option: relocations against local symbols were not supported. For example rel[a].eh_frame sections contained relocations against sections and that was not supported for -r before. Patch fixes that. Differential review: http://reviews.llvm.org/D17813 llvm-svn: 262590
* Replace ECRAII class with a function.Rui Ueyama2016-03-031-9/+7
| | | | | | RCRAII class was a bit tricky. This patch removes that. llvm-svn: 262586
* Handle comdat in LTO.Rafael Espindola2016-03-021-1/+16
| | | | llvm-svn: 262489
* lto: don't fetch members for weak undef.Rafael Espindola2016-02-291-3/+3
| | | | llvm-svn: 262225
* Rename elf2 to elf.Rafael Espindola2016-02-281-31/+31
| | | | llvm-svn: 262159
* ELF: Implement ICF.Rui Ueyama2016-02-251-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the same algorithm as LLD/COFF's ICF. I'm not going to repeat the same description about how it works, so you want to read the comment in ICF.cpp in this patch if you want to know the details. This algorithm should be more powerful than the ICF algorithm implemented in GNU gold. It can even merge mutually-recursive functions (which is harder than one might think). ICF is a fairly effective size optimization. Here are some examples. LLD: 37.14 MB -> 35.80 MB (-3.6%) Clang: 59.41 MB -> 57.80 MB (-2.7%) The lacking feature is "safe" version of ICF. This merges all identical sections. That is not compatible with a C/C++ language requirement that two distinct functions must have distinct addresses. But as long as your program do not rely on the pointer equality (which is in many cases true), your program should work with the feature. LLD works fine for example. GNU gold implements so-called "safe ICF" that identifies functions that are safe to merge by heuristics -- for example, gold thinks that constructors are safe to merge because there is no way to take an address of a constructor in C++. We have a different idea which David Majnemer suggested that we add NOPs at beginning of merged functions so that two or more pointers can have distinct values. We can do whichever we want, but this patch does not include neither. http://reviews.llvm.org/D17529 llvm-svn: 261912
* Add support for weak symbols in LTO.Rafael Espindola2016-02-251-2/+4
| | | | llvm-svn: 261881
* Remove unnecessary prefix.Rafael Espindola2016-02-251-1/+1
| | | | llvm-svn: 261880
OpenPOWER on IntegriCloud