summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputSection.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Bring r267164 back with a fix.Rafael Espindola2016-04-221-8/+65
| | | | | | | | | | | | | | | | | The fix is to handle local symbols referring to SHF_MERGE sections. Original message: GC entries of SHF_MERGE sections. It is a fairly direct extension of the gc algorithm. For merge sections instead of remembering just a live bit, we remember which offsets were used. This reduces the .rodata sections in chromium from 9648861 to 9477472 bytes. llvm-svn: 267233
* Revert "GC entries of SHF_MERGE sections."Rafael Espindola2016-04-221-65/+8
| | | | | | | | | | | | This reverts commit r267164. Revert "Trying to fix the windows build." This reverts commit r267168. Debugging a bootstrap problem. llvm-svn: 267194
* Trying to fix the windows build.Rafael Espindola2016-04-221-1/+1
| | | | llvm-svn: 267168
* GC entries of SHF_MERGE sections.Rafael Espindola2016-04-221-8/+65
| | | | | | | | | | | It is a fairly direct extension of the gc algorithm. For merge sections instead of remembering just a live bit, we remember which offsets were used. This reduces the .rodata sections in chromium from 9648861 to 9477472 bytes. llvm-svn: 267164
* This reverts commit r267154 and r267161.Rafael Espindola2016-04-221-0/+19
| | | | | | | | | | | | | | | | It turns out that this will read data from the section to properly handle Elf_Rel implicit addends. Sorry for the noise. Original messages: Try to fix Windows lld build. Move getRelocTarget to ObjectFile. It doesn't use anything from the InputSection. llvm-svn: 267163
* Move getRelocTarget to ObjectFile.Rafael Espindola2016-04-221-19/+0
| | | | | | It doesn't use anything from the InputSection. llvm-svn: 267154
* Simplify mips gp0 handling.Rafael Espindola2016-04-201-5/+0
| | | | | | In all currently supported cases this is a nop. llvm-svn: 266888
* Simplify mips got handling.Rafael Espindola2016-04-191-2/+4
| | | | | | | This avoids computing the address of a position in the got just to then subtract got->getva(). llvm-svn: 266831
* Simplify handling of R_X86_64_TPOFF32. NFC.Rafael Espindola2016-04-181-1/+1
| | | | llvm-svn: 266609
* Have getRelExpr handle all cases on x86.Rafael Espindola2016-04-181-2/+16
| | | | | | | | This requires adding a few more expression types, but is already a small simplification. Having Writer.cpp know the exact expression will also allow further simplifications. llvm-svn: 266604
* Change how we apply relocations.Rafael Espindola2016-04-131-152/+96
| | | | | | | | | | | | | | | | | | | | | | | With this patch we use the first scan over the relocations to remember the information we found about them: will them be relaxed, will a plt be used, etc. With that the actual relocation application becomes much simpler. That is particularly true for the interfaces in Target.h. This unfortunately means that we now do two passes over relocations for non SHF_ALLOC sections. I think this can be solved by factoring out the code that scans a single relocation. It can then be used both as a scan that record info and for a dedicated direct relocation of non SHF_ALLOC sections. I also think it is possible to reduce the number of enum values by representing a target with just an OutputSection and an offset (which can be from the start or end). This should unblock adding features like relocation optimizations. llvm-svn: 266158
* Simplify handling of mips gp* symbols.Rafael Espindola2016-04-111-6/+4
| | | | | | Give them values instead of computing it during relocation. llvm-svn: 265986
* Update for llvm change.Rafael Espindola2016-04-051-3/+2
| | | | llvm-svn: 265404
* Don't store an Elf_Sym for most symbols.Rafael Espindola2016-04-041-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Don't apply a recolation that the dynamic linker will rewrite.Rafael Espindola2016-04-011-2/+2
| | | | | | | This matches the behavior of both bfd and gold. Looks like we just got here for mips because of a bad ordering of an if else chain. llvm-svn: 265147
* [ELF] Implement infrastructure for thunk code creationSimon Atanasyan2016-03-311-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some targets might require creation of thunks. For example, MIPS targets require stubs to call PIC code from non-PIC one. The patch implements infrastructure for thunk code creation and provides support for MIPS LA25 stubs. Any MIPS PIC code function is invoked with its address in register $t9. So if we have a branch instruction from non-PIC code to the PIC one we cannot make the jump directly and need to create a small stub to save the target function address. See page 3-38 ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf - In relocation scanning phase we ask target about thunk creation necessity by calling `TagetInfo::needsThunk` method. The `InputSection` class maintains list of Symbols requires thunk creation. - Reassigning offsets performed for each input sections after relocation scanning complete because position of each section might change due thunk creation. - The patch introduces new dedicated value for DefinedSynthetic symbols DefinedSynthetic::SectionEnd. Synthetic symbol with that value always points to the end of the corresponding output section. That allows to escape updating synthetic symbols if output sections sizes changes after relocation scanning due thunk creation. - In the `InputSection::writeTo` method we write thunks after corresponding input section. Each thunk is written by calling `TargetInfo::writeThunk` method. - The patch supports the only type of thunk code for each target. For now, it is enough. Differential Revision: http://reviews.llvm.org/D17934 llvm-svn: 265059
* No relocation needs bot SA and ZA.Rafael Espindola2016-03-301-3/+5
| | | | | | Pass only one of them to relocateOne. llvm-svn: 264866
* Simplify mips addend processing.Rafael Espindola2016-03-301-8/+6
| | | | | | | It is now added to the addend in the same way as a regular Elf_Rel addend. llvm-svn: 264864
* Fix handling of addends on i386.Rafael Espindola2016-03-301-0/+2
| | | | | | | Because of merge sections it is not sufficient to just add them while applying a relocation. llvm-svn: 264863
* Fix comments.Rui Ueyama2016-03-301-7/+6
| | | | | | | The original comments were separated by new code that is irrelevant to the comment. This patch moves the comment to the right place and update it. llvm-svn: 264816
* Simplify AHL handling.Rafael Espindola2016-03-291-20/+23
| | | | | | | | | | | | This simplifies a few things * Read the value as early as possible, instead of passing a pointer to the location. * Print the warning for missing pair close to where we find out it is missing. * Don't pass the value to relocateOne. llvm-svn: 264802
* Make needsPlt a plain function instead of a template.Rafael Espindola2016-03-241-1/+1
| | | | llvm-svn: 264267
* Revert "bar"Rafael Espindola2016-03-181-5/+91
| | | | | | | This reverts commit r263799. It was a mistake. Sorry about that. llvm-svn: 263801
* barRafael Espindola2016-03-181-91/+5
| | | | llvm-svn: 263799
* Use ELFT instead of ELFFile<ELFT>.Rui Ueyama2016-03-141-11/+6
| | | | llvm-svn: 263510
* Simplify. NFC.Rui Ueyama2016-03-131-4/+2
| | | | llvm-svn: 263391
* ELF: Redefine canBeDefined as a member function of SymbolBody.Rui Ueyama2016-03-131-4/+4
| | | | | | | | | We want to make SymbolBody the central place to query symbol information. This patch also renames canBePreempted to isPreemptible because I feel that the latter is slightly better (the former is three words and the latter is two words.) llvm-svn: 263386
* [ELF][MIPS] Add elf namespace name to the ObjectFile.Simon Atanasyan2016-03-131-1/+1
| | | | | | NFC. Follow-up to r263381. llvm-svn: 263382
* [ELF][MIPS] Factor out SumVA adjustments into a couple of separate ↵Simon Atanasyan2016-03-131-34/+47
| | | | | | | | | | | functions. NFC. The patch does not reduce the size of the code but makes InputSectionBase::relocate cleaner a bit. Differential Revision: http://reviews.llvm.org/D18119 llvm-svn: 263381
* Use RelTy instead of Elf_Rel_Impl<ELFT, isRela> for readability.Rui Ueyama2016-03-131-17/+14
| | | | llvm-svn: 263368
* Remove redundant check.Rui Ueyama2016-03-131-2/+0
| | | | | | The control reaches here only when linking MIPS binaries. llvm-svn: 263359
* Simplify findMipsPairedReloc function signature. NFC.Rui Ueyama2016-03-131-15/+18
| | | | llvm-svn: 263356
* [ELF][MIPS] Put type of symbol (local/global) to the findMipsPairedReloc and ↵Simon Atanasyan2016-03-121-10/+11
| | | | | | call it from the single place. NFC. llvm-svn: 263339
* Recommit of r263252, [ELF] - Change all messages to lowercase to be consistent.George Rimar2016-03-121-3/+3
| | | | | | | | | | | | | | | | | | | | | 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-8/+9
| | | | | | 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-9/+8
| | | | | | | | | | | | | | 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
* More MSVC fixes.Rafael Espindola2016-03-111-1/+1
| | | | llvm-svn: 263251
* Trying to fix the MSVC build.Rafael Espindola2016-03-111-5/+6
| | | | llvm-svn: 263249
* Represent local symbols with DefinedRegular.Rafael Espindola2016-03-111-4/+4
| | | | llvm-svn: 263237
* [ELF][MIPS] Update comment about creation local GOT entries for non-local ↵Simon Atanasyan2016-03-111-3/+5
| | | | | | symbols. NFC. llvm-svn: 263236
* Simplify now that local symbols can use getVA.Rafael Espindola2016-03-111-50/+42
| | | | | | | | It is really odd that Mips differentiates symbols that are born local and those that become local because of hidden visibility. I don't know enough mips to known if this is a bug or not. llvm-svn: 263228
* [ELF] - Early continue in InputSectionBase<ELFT>::relocate(). NFC.George Rimar2016-03-111-3/+3
| | | | llvm-svn: 263227
* [ELF] - Evaluate addend earlier and use it instead getAddend() calls. NFC.George Rimar2016-03-111-6/+3
| | | | llvm-svn: 263226
* Compute value of local symbol with getVA.Rafael Espindola2016-03-111-46/+12
| | | | llvm-svn: 263225
* Create a SymbolBody for locals.Rafael Espindola2016-03-111-43/+28
| | | | | | pr26878 shows a case where locals have to be in the got. llvm-svn: 263222
* Move getLocalRelTarget to the file where it is used.Rafael Espindola2016-03-101-0/+42
| | | | llvm-svn: 263152
* Remove an unnecessary hack.Rafael Espindola2016-03-081-1/+1
| | | | | | | It doesn't look like anything is depending on using local dynamic tls relocations with preemptable symbols. llvm-svn: 262957
* Delete isTlsDynRel.Rafael Espindola2016-03-081-6/+3
| | | | | | | | | | | | It was a badly specified hack for when a tls relocation should be propagated to the dynamic relocation table. This replaces it with a not as bad hack of saying that a local dynamic tls relocation is never preempted. I will try to remove even that second hack in the next patch. llvm-svn: 262955
* [ELF] - Simplify a SymbolBody class interface a bit.George Rimar2016-03-061-1/+1
| | | | | | | | | Get rid of few accessors in that class, and replace them with direct fields access. Differential revision: http://reviews.llvm.org/D17879 llvm-svn: 262796
* Refactor target independent code.Rafael Espindola2016-03-041-1/+1
| | | | | | | The rules for when we can relax tls relocations are target independent. The only things that are target dependent are the relocation values. llvm-svn: 262748
OpenPOWER on IntegriCloud