summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/Atoms.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove the old ELF linker.Rafael Espindola2016-02-281-495/+0
| | | | | | I think it is clear by now that the new linker is viable. llvm-svn: 262158
* Move SimpleDefinedAtom::addReference to DefinedAtom.Pete Cooper2016-02-011-0/+2
| | | | | | | | | | | | Most of the other methods to access Reference's were on DefinedAtom so this just keeps them all together. This will be used in a future patch in ObjCPass which needs to add new references. The method is virtual because we may add references to different data structures depending on whether we parsed a macho file or yaml. llvm-svn: 259436
* Fix Clang-tidy misc-use-override warnings, other minor fixes.Rui Ueyama2015-09-101-2/+2
| | | | | | Patch from Eugene Zelenko! llvm-svn: 247323
* ELF: Remove redundant namespace qualifiers.Rui Ueyama2015-04-141-1/+1
| | | | llvm-svn: 234938
* ELF: Simplify ELFDefinedAtom::contentType().Rui Ueyama2015-04-141-1/+2
| | | | llvm-svn: 234936
* ELF: Split Atoms.h to Atoms.{h,cpp}.Rui Ueyama2015-04-141-361/+22
| | | | llvm-svn: 234935
* Remove unused includes and forward declarations.Rui Ueyama2015-04-041-0/+1
| | | | llvm-svn: 234070
* Use C++ non-static member initialization.Rui Ueyama2015-04-011-12/+8
| | | | llvm-svn: 233859
* Rename all caps class names.Rui Ueyama2015-03-271-4/+4
| | | | | | | We have GOTAtom and PLTAtom classes because GOT or PLT are acronyms. "Dynamic offset table" or "dynamic" are not acronyms. llvm-svn: 233401
* Remove this->.Rui Ueyama2015-03-271-9/+7
| | | | llvm-svn: 233400
* [ARM] Handle mapping symbolsDenis Protivensky2015-03-261-3/+3
| | | | | | | | | | | Mapping symbols should have their own code models, and in some places must be treated in a specific way. Make $t denote Thumb code, and $a and $d denote ARM code. Set size, binding and type of mapping symbols to what the specification says. Differential Revision: http://reviews.llvm.org/D8601 llvm-svn: 233259
* Use alignment values everywhere instead of log2.Rui Ueyama2015-03-261-24/+11
| | | | | | | | This patch defines implicit conversion between integers and PowerOf2 instances, so uses of the classes is now implicit and look like regular integers. Now we are ready to remove the scaffolding. llvm-svn: 233245
* [ELF] GLOBAL_OFFSET_TABLE is a hidden symbolShankar Easwaran2015-03-201-1/+1
| | | | llvm-svn: 232868
* Garbage collect an unused class in Atoms.hDavide Italiano2015-03-111-30/+0
| | | | | | | | | | This will be replaced by a more generic class to handle all the default symbols in an executable, e.g. __init_array. Differential Revision: http://reviews.llvm.org/D8234 Reviewed by: shankare llvm-svn: 231906
* Remove sectionPosition attribute.Rui Ueyama2015-03-081-12/+0
| | | | | | | | This code is simply dead. No one is using it. http://reviews.llvm.org/D8125 llvm-svn: 231583
* Remove duplicate code. NFC.Rui Ueyama2015-03-071-1/+0
| | | | llvm-svn: 231570
* Remove else if a last block ends with return.Rui Ueyama2015-03-051-14/+10
| | | | llvm-svn: 231330
* Remove redundant virtual destructor.Rui Ueyama2015-03-051-3/+1
| | | | | | | DefinedAtom, which is the base class of ELFCommonAtom, has a virtual destructor, so this is redundant. llvm-svn: 231329
* [ELF] Create a map from Reference to Symbol.Shankar Easwaran2015-02-231-13/+6
| | | | | | | | | | | In LLD's model, symbol is a property of the node (atom) and not a property of edge (reference). Prior to this patch, we stored the symbol in the reference. From post-commit comments, it seemed better to create a map from the reference to the symbol instead and use this mapping wherever desired. Address comments from Ruiu/Simon Atanasyan. llvm-svn: 230273
* [ELF] Add comments in the ELF readerShankar Easwaran2015-02-231-0/+2
| | | | | | Address review comments from Ruiu, and add some more TODO's. llvm-svn: 230218
* [ELF] Add section group/COMDAT support.Shankar Easwaran2015-02-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | SHF_GROUP: Group Member Sections ---------------------------------- A section which is part of a group, and is to be retained or discarded with the group as a whole, is identified by a new section header attribute: SHF_GROUP This section is a member (perhaps the only one) of a group of sections, and the linker should retain or discard all or none of the members. This section must be referenced in a SHT_GROUP section. This attribute flag may be set in any section header, and no other modification or indication is made in the grouped sections. All additional information is contained in the associated SHT_GROUP section. SHT_GROUP: Section Group Definition ------------------------------------- Represents a group section. The section group's sh_link field identifies a symbol table section, and its sh_info field the index of a symbol in that section. The name of that symbol is treated as the identifier of the section group. More information: https://mentorembedded.github.io/cxx-abi/abi/prop-72-comdat.html Added a lot of extensive tests, that tests functionality. llvm-svn: 230195
* [ELF] Add .gnu.linkonce support.Shankar Easwaran2015-02-231-3/+14
| | | | | | | | | | | | | When the GNU linker sees two input sections with the same name, and the name starts with ".gnu.linkonce.", the linker will only keep one copy and discard the other. Any section whose name starts with “.gnu.linkonce.” is a COMDAT section. Some architectures like Hexagon use this section to store floating point constants, that need be deduped. This patch adds gnu.linkonce functionality to the ELFReader. llvm-svn: 230194
* [ELF] Add symbol to ELFReference.Shankar Easwaran2015-02-221-6/+13
| | | | | | | | | Relocation handling need more information about the Symbol that we are creating references for. No change in functionality. llvm-svn: 230191
* [ELF] Remove FIXME(s) that are already fixed.Shankar Easwaran2015-02-211-4/+2
| | | | | | | | FIXME code was left around in few places where its already been taken care of. This removes the FIXME's that are not needed. llvm-svn: 230139
* Remove unused parameter.Rui Ueyama2015-02-071-1/+1
| | | | llvm-svn: 228476
* Remove remaining code for PPC ELF target.Rui Ueyama2015-01-301-5/+0
| | | | llvm-svn: 227534
* Use Reference::KindValue instead of uint16_t to pass and save a relocation kindSimon Atanasyan2015-01-271-15/+15
| | | | | | No functional changes. llvm-svn: 227233
* [lld] Correct forming of ARM/Thumb atomsDenis Protivensky2015-01-271-3/+13
| | | | | | | | | | | | Symbols addressing Thumb code have zero bit set in st_value to distinguish them from ARM instructions. This caused wrong atoms' forming because of offset of one byte brought in by that corrected st_value. Fixed reading of st_value & st_value-related things in ARMELFFile while forming atoms. Symbol table generation is also fixed for Thumb atoms. Differential Revision: http://reviews.llvm.org/D7161 llvm-svn: 227174
* [ELF] Minimal implementation for ARM static linkingGreg Fitzgerald2015-01-211-0/+5
| | | | | | | | | | | | | | The code is able to statically link the simplest case of: int main() { return 0; } * Only works with ARM code - no Thumb code, no interwork (-marm -mno-thumb-interwork) * musl libc built with no interwork and no Thumb code Differential Revision: http://reviews.llvm.org/D6716 From: Denis Protivensky <dprotivensky@accesssoftek.com> llvm-svn: 226643
* ELF: Handle sh_addralign being set to zeroWill Newton2015-01-201-0/+3
| | | | | | | | sh_addralign of zero is equivalent to sh_addralign of one, meaning no alignment specified. Avoid calculating Log2 or modulus when sh_addralign is zero as the results will not be useful. llvm-svn: 226572
* [ELF] Remove isThumb().Shankar Easwaran2014-12-121-2/+0
| | | | llvm-svn: 224099
* [ELF] Use getVisibility() function to access st_other fieldSimon Atanasyan2014-11-051-4/+4
| | | | | | | The st_other field can contains not only visibility flag so we should retrieve a visibility flag using a bit-mask. llvm-svn: 221397
* Fix warnings about missing override.Rafael Espindola2014-11-031-6/+0
| | | | llvm-svn: 221165
* [ELF] Add Readers for all the ELF subtargets.Shankar Easwaran2014-10-181-3/+0
| | | | | | | | | This would permit the ELF reader to check the architecture that is being selected by the linking process. This patch also sorts the include files according to LLVM conventions. llvm-svn: 220129
* Revert "[ELF] Only mark as DT_NEEDED libs that are strictly necessary"Rui Ueyama2014-10-091-6/+1
| | | | | | This reverts commit r219353 because that seems to break buildbots. llvm-svn: 219369
* [ELF] Only mark as DT_NEEDED libs that are strictly necessaryRafael Auler2014-10-081-1/+6
| | | | | | | | | | | | | | | | | | | | | Enhances the creation of an ELF dynamic executable by avoiding recording unnecessary shared libraries as NEEDED to load a program. To do this, we must keep track of not only symbols that were referenced but also of COPY relocations, which steal the symbol from a shared library but does not store from which lib this symbol came from. To fix this, this commit changes ObjectSymbol to store the original library from which this symbol came. With this information, we are able to build a list of the exact shared libraries that must be marked as DT_NEEDED, instead of blindly marking all shared libraries as needed. This logic originally came from the MIPS backend with some adaptation. Reviewers: atanasyan, shankar.easwaran http://reviews.llvm.org/D5574 llvm-svn: 219353
* [lld] [ELF] Support for general dynamic TLS relocations on X86_64Rafael Auler2014-09-291-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support for the general dynamic TLS access model for X86_64 (see www.akkadia.org/drepper/tls.pdf). To properly support TLS, the patch also changes the __tls_get_addr atom to be a shared library atom instead of a regularly defined atom (the previous lld approach). This closely models the reality of a function that will be resolved at runtime by the dynamic linker and loader itself (ld.so). I was tempted to force LLD to link against ld.so itself to resolve these symbols, but since GNU ld does not need the ld.so library to resolve this symbol, I decided to mimic its behavior and keep hardwired a definition of __tls_get_addr in the lld code. This patch also moves some important logic that previously was only available to the MIPS lld backend to be used to all ELF backends. This logic, which now lives in the DefaultLayout class, will monitor which external (shared lib) symbols are really imported by the current module and will only populate the dynamic symbol table with used symbols, as opposed to the previous approach of dumping all shared lib symbols in the dynamic symbol table. This is important to this patch to avoid __tls_get_addr from getting injected into all dynamic symbol tables. By solving the previous problem of always adding __tls_get_addr, now the produced symbol tables are slightly smaller. But this impacted several tests that relied on hardwired/predefined sizes of the symbol table, requiring this patch to update such tests. Test Plan: Added a LIT test case that exercises a simple use case of TLS variable in a shared library. Reviewers: ruiu, rafael, Bigcheese, shankarke Reviewed By: Bigcheese, shankarke Subscribers: emaste, shankarke, joerg, kledzik, mcrosier, llvm-commits Projects: #lld Differential Revision: http://reviews.llvm.org/D5505 llvm-svn: 218633
* [AArch64] Initial ELF/AArch64 SupportChad Rosier2014-08-131-0/+5
| | | | | | | | | | This patch adds the initial ELF/AArch64 support to lld. Only a basic "Hello World" app has been successfully tested for both dynamic and static compiling. Differential Revision: http://reviews.llvm.org/D4778 Patch by Daniel Stewart <stewartd@codeaurora.org>! llvm-svn: 215544
* Move Simple.h and Alias.h to include/Core.Rui Ueyama2014-06-111-1/+1
| | | | | | | | Because the files in Core actually depend on these files. Differential Revision: http://reviews.llvm.org/D4000 llvm-svn: 210710
* Re-submit r207884: Remove dead codeRui Ueyama2014-05-051-7/+0
| | | | | | Differential Revision: http://reviews.llvm.org/D3599 llvm-svn: 207989
* Revert "Remove dead code."Rui Ueyama2014-05-021-0/+7
| | | | | | This reverts commit r207884 which was prematurely committed by accident. llvm-svn: 207886
* Remove dead code.Rui Ueyama2014-05-021-7/+0
| | | | | | | | | | | | | | | isAlias always returns false and no one is using it. It was originally added Atom to query if an atom is an alias for another atom, assuming that alias atoms are different from normal atoms. We now support atom aliasing, but the way that's implemented is in a different way than what isAlias assumed. An alias atom is just a regular defined atom with no content, and it has a layout- before edge to alias-to atom so that they are layed out at the same location in the result. So this is dead code, and it doesn't make much sense to keep it. llvm-svn: 207884
* This is yet another case clang-modernize failed to add "override".Rui Ueyama2014-04-041-6/+3
| | | | llvm-svn: 205644
* [ELF] Add "override" and remove "virtual".Rui Ueyama2014-03-281-201/+143
| | | | llvm-svn: 205056
* Add "override" and remove "virtual" where appropriate.Rui Ueyama2014-03-061-1/+1
| | | | | | | For the record, I used clang-modernize to add "override" and perl to remove "virtual". llvm-svn: 203164
* [C++11] Replace LLVM_OVERRIDE with just "override" now that we're allChandler Carruth2014-03-021-1/+1
| | | | | | using MSVC 2012 or newer. llvm-svn: 202627
* [ELF] Add Target specific Readers.Shankar Easwaran2014-01-271-69/+10
| | | | | | No change in functionality. llvm-svn: 200175
* Run clang-format on r197727.Rui Ueyama2013-12-201-70/+45
| | | | llvm-svn: 197788
* [lld] Introduce registry and Reference kind tupleNick Kledzik2013-12-191-51/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main changes are in: include/lld/Core/Reference.h include/lld/ReaderWriter/Reader.h Everything else is details to support the main change. 1) Registration based Readers Previously, lld had a tangled interdependency with all the Readers. It would have been impossible to make a streamlined linker (say for a JIT) which just supported one file format and one architecture (no yaml, no archives, etc). The old model also required a LinkingContext to read an object file, which would have made .o inspection tools awkward. The new model is that there is a global Registry object. You programmatically register the Readers you want with the registry object. Whenever you need to read/parse a file, you ask the registry to do it, and the registry tries each registered reader. For ease of use with the existing lld code base, there is one Registry object inside the LinkingContext object. 2) Changing kind value to be a tuple Beside Readers, the registry also keeps track of the mapping for Reference Kind values to and from strings. Along with that, this patch also fixes an ambiguity with the previous Reference::Kind values. The problem was that we wanted to reuse existing relocation type values as Reference::Kind values. But then how can the YAML write know how to convert a value to a string? The fix is to change the 32-bit Reference::Kind into a tuple with an 8-bit namespace (e.g. ELF, COFFF, etc), an 8-bit architecture (e.g. x86_64, PowerPC, etc), and a 16-bit value. This tuple system allows conversion to and from strings with no ambiguities. llvm-svn: 197727
* Add explictly exported atoms and export R_*_COPY'ed atoms.Michael J. Spencer2013-11-081-0/+2
| | | | llvm-svn: 194278
OpenPOWER on IntegriCloud