summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/Mips
Commit message (Collapse)AuthorAgeFilesLines
...
* Follow-up to r221913. Fix some -Wcast-qual warning reasons.Simon Atanasyan2014-11-141-3/+3
| | | | llvm-svn: 221974
* [ELF] Add CodeModel attribute to the DefinedAtom classSimon Atanasyan2014-11-134-6/+87
| | | | | | | | | | | | | | | | | | | | | | MIPS ELF symbols might contain some additional MIPS-specific flags in the st_other field besides visibility ones. These flags indicate code properties like microMIPS / MIPS16 encoding, position independent code etc. We need to transfer the flags from input objects to the output linked file to write them into the symbol table, adjust symbols addresses etc. I add new attribute CodeModel to the DefinedAtom class to hold target specific flag and to get over YAML/Native format conversion barrier. Other architectures/targets can extend CodeModel enumeration by their own flags. MIPS specific part of this patch adds support for STO_MIPS_MICROMIPS flag. This flag marks microMIPS symbols. Such symbol should: a) Has STO_MIPS_MICROMIPS in the corresponding .symtab record. b) Has adjusted (odd) address in the corresponding .symtab and .dynsym records. llvm-svn: 221864
* [Mips] Replace the redundant condition by assert callSimon Atanasyan2014-11-101-3/+3
| | | | | | No functional changes. llvm-svn: 221603
* [Mips] Do not read addends for relocations which do not use themSimon Atanasyan2014-11-102-11/+8
| | | | | | No functional changes. llvm-svn: 221602
* [Mips] Do not hard-code the paired relocation typeSimon Atanasyan2014-11-071-11/+15
| | | | | | | | Request `getPairRelocation()` function to get paired relocation type. That allows us to look up another pairs like R_MICROMIPS_HI16/LO16 in the future. llvm-svn: 221539
* [ELF] Remove is64bits() and isLittlEndian().Shankar Easwaran2014-11-072-5/+0
| | | | | | | | | | ELFLinkingContext had these two functions, which is really not needed since the Writer uses a llvm::object template composed of Endianness, Alignment, Is32bit/64bit. We could just use that and not duplicate functionality. No Change In Functionality. llvm-svn: 221523
* [Mips] Take into account that PIC code is inherently CPICSimon Atanasyan2014-11-061-2/+7
| | | | | | Follow-up to r221439. llvm-svn: 221442
* [Mips] Follow-up to r221439. Include header to fix build on Windows.Simon Atanasyan2014-11-061-0/+1
| | | | llvm-svn: 221440
* [Mips] Check ELF flags to prevent linking of incompatible filesSimon Atanasyan2014-11-069-29/+191
| | | | | | | | | | | | | | | | | 1. The path checks ELF header flags to prevent linking of incompatible files. For example we do not allow to link files with different ABI, -mnan flags, some combination of target CPU etc. 2. The patch merge ELF header flags from input object files to put their combination to the generated file. For example, if some input files have EF_MIPS_NOREORDER flag we need to put this flag to the output file header. I use the `parseFile()` (not `canParse()`) method because in case of recognition of incorrect input flags combination we should show detailed error message and stop the linking process and should not try to use another `Reader`. llvm-svn: 221439
* Fix warnings about missing override.Rafael Espindola2014-11-032-4/+6
| | | | llvm-svn: 221165
* Fix unicode chars into ascii in comment lines.NAKAMURA Takumi2014-10-271-1/+1
| | | | llvm-svn: 220668
* [ELF] Remove duplicate code.Shankar Easwaran2014-10-213-26/+32
| | | | | | | The base class ELFObjectReader/ELFDSOReader implement the canParse functionaity with this change. llvm-svn: 220261
* [ELF] Check for target architecture.Shankar Easwaran2014-10-201-0/+13
| | | | | | | | | | The canParse function for all the ELF subtargets check if the input files match the subtarget. There were few mismatches in the input files that didnt match the subtarget for which the link was being invoked, which also acts as a test for this change. llvm-svn: 220182
* Sort include files according to convention.Shankar Easwaran2014-10-181-1/+0
| | | | llvm-svn: 220131
* [ELF] Add Readers for all the ELF subtargets.Shankar Easwaran2014-10-187-6/+6
| | | | | | | | | 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
* [CMake] lld: Introduce ${cmake_2_8_12_INTERFACE} onto each ↵NAKAMURA Takumi2014-10-171-1/+1
| | | | | | | target_link_libraries. [PR20254] FIXME: Dependencies should be reorganized. llvm-svn: 220000
* Reapply [ELF] Only mark as DT_NEEDED libs that are strictly necessary (r219353)Rafael Auler2014-10-096-34/+10
| | | | | | | | | | | | | | | | | | | | When committed in r219353, this patch originally caused problems because it was not tested in debug build. In such scenarios, Driver.cpp adds two additional passes. These passes serialize all atoms via YAML and reads it back. Since the patch changed ObjectAtom to hold a new reference, the serialization was removing the extra data. This commit implements r219853 in another way, similar to the original MIPS way, by using a StringSet that holds the names of all copied atoms instead of directly holding a reference to the copied atom. In this way, this commit is simpler and eliminate the necessity of changing the DefinedAtom hierarchy to hold a new data. Reviewers: shankarke http://reviews.llvm.org/D5713 llvm-svn: 219449
* Revert "[ELF] Only mark as DT_NEEDED libs that are strictly necessary"Rui Ueyama2014-10-097-11/+35
| | | | | | 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-087-35/+11
| | | | | | | | | | | | | | | | | | | | | 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
* [ELF] Fix inclusion of weak symbols in the dynamic symbol tableRafael Auler2014-10-081-2/+20
| | | | | | | | | | | | | | | | | This commit implements in the X86_64 ELF lld backend yet another feature that was only available in the MIPS backend. However, this patch changes generic ELF classes to make it trivial for other ELF backends to use this logic too. When creating a dynamic executable that has dynamic relocations against weak undefined symbols, these symbols must be exported to the dynamic symbol table to seek a possible resolution at run time. A common use case is the __gmon_start__ weak glibc undefined symbol. Reviewer: shankarke http://reviews.llvm.org/D5571 llvm-svn: 219349
* Revert "[ELF][AllArchs] Fix includes"Shankar Easwaran2014-10-0812-24/+24
| | | | | | This reverts commit e137dd93e1291a2d2fa7f41c8f8bcdb59c8b3225. llvm-svn: 219313
* [ELF][AllArchs] Fix includesShankar Easwaran2014-10-0812-24/+24
| | | | llvm-svn: 219278
* [lld] [ELF] [MIPS] Remove duplicate logicRafael Auler2014-10-023-12/+0
| | | | | | | | | | | | | | Summary: With r218633, the logic that monitors which shared library symbols were used was copied from the MIPS lld backend to ELF classes, making it available to all ELF backends. However, this made the isDynSymEntryRequired() functions in MipsDynamicLibraryWriter.h/MipsELFWriters.h/MipsExecutableWriter.h to be duplicated logic, since this is already implemented in OutputELFWriter<>/DefaultLayout. This patch removes this duplicated code from MIPS. Reviewers: Bigcheese, shankarke Reviewed By: shankarke Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5564 llvm-svn: 218846
* [lld] [ELF] Support for general dynamic TLS relocations on X86_64Rafael Auler2014-09-291-8/+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
* [Mips] Fix typo in the comment.Simon Atanasyan2014-07-211-1/+1
| | | | llvm-svn: 213520
* [Mips] s/context/ctx/ for consistency and reduce lines lengths.Simon Atanasyan2014-07-178-48/+42
| | | | | | No functional changes. llvm-svn: 213310
* Update for llm api change.Rafael Espindola2014-07-052-3/+4
| | | | llvm-svn: 212372
* [ELF] Add two new virtual functions to the `OutputELFWriter` class to controlSimon Atanasyan2014-06-254-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dynamic symbol table populating and DT_NEEDED tag creation. The `isDynSymEntryRequired` function returns true if the specified shared library atom requires a dynamic symbol table entry. The `isNeededTagRequired` function returns true if we need to create DT_NEEDED tag for the shared library defined specified shared atom. By default the both functions return true. So there is no functional changes for all targets except MIPS. Probably we need to spread the same modifications on other ELF targets but I want to implement and fully tested complete set of changes for MIPS target first. For MIPS we create a dynamic symbol table entry for a shared library atom iif this atom is referenced by a regular defined atom. For example, if library L1 defines symbol T1, library L2 defines symbol T2 and uses symbol T1 and executable file E1 uses symbol T2 but does not use symbol T1 we create an entry in the E1 dynamic symbol table for symbol T2 and do not create an entry for T1. The patch creates DT_NEEDED tags for shared libraries contain shared library atoms which a) referenced by regular defined atoms; b) have corresponding copy dynamic relocations (R_MIPS_COPY). Now the patch does not take in account --as-needed / --no-as-needed command line options. So it is too restrictive and create DT_NEEDED tags for really needed shared libraries only. I plan to fix that by subsequent patches. llvm-svn: 211674
* [Mips] Remove redundant checking from the RelocationPass::isDynamic() function.Simon Atanasyan2014-06-211-8/+1
| | | | | | No functional changes. llvm-svn: 211431
* More prefixing of error_code.Rafael Espindola2014-06-125-13/+13
| | | | llvm-svn: 210831
* Don't import error_code into the lld namespace.Rafael Espindola2014-06-121-5/+5
| | | | llvm-svn: 210785
* [Mips] Fix the bug -- symbol referred by the R_MIPS_TLS_GD relocationSimon Atanasyan2014-06-111-1/+1
| | | | | | does not get an entry in the dynamic symbol table. llvm-svn: 210648
* [Mips] Handle Mips TLS relocations R_MIPS_TLS_GOTTPREL / R_MIPS_TLS_GD / ↵Simon Atanasyan2014-06-077-27/+168
| | | | | | R_MIPS_TLS_LDM etc. llvm-svn: 210394
* Initial set of MakefilesIain Sandoe2014-06-041-0/+15
| | | | | | | | This provides support for the autoconfing & make build style. The format, style and implementation follows that used within the llvm and clang projects. TODO: implement out-of-source documentation builds. llvm-svn: 210177
* [Mips] Implement .{ctors,dtors}.<priority> sections ordering.Simon Atanasyan2014-06-015-0/+119
| | | | | | | | | | | | | Arrange .ctors/.dtors sections in the following order: .ctors from crtbegin.o or crtbegin?.o .ctors from regular object files .ctors.* (sorted) from regular object files .ctors from crtend.o or crtend?.o This order is specific for MIPS traget. For example, on X86 the .ctors.* sections are merged into the .init_array section. llvm-svn: 209987
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-315-6/+6
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209948
* [Mips] Do not mix _gp and _gp_disp symbols in relocation handling.Simon Atanasyan2014-05-282-14/+22
| | | | | | No functional changes. llvm-svn: 209709
* [Mips] Handle relocations against __gnu_local_gp symbol.Simon Atanasyan2014-05-271-0/+2
| | | | llvm-svn: 209644
* [Mips] Do not count global GOT entries using the separate variable. UseSimon Atanasyan2014-05-261-10/+4
| | | | | | size of global GOT entries map for that. llvm-svn: 209616
* [Mips] Reduce code duplication. Join relocation handling functions whichSimon Atanasyan2014-05-251-15/+6
| | | | | | perform calculations for R_MIPS_GOT16 and R_MIPS_CALL16 relocations. llvm-svn: 209594
* [Mips] Factor out the code assign a value to the absolute atom into theSimon Atanasyan2014-05-251-11/+9
| | | | | | separate function. llvm-svn: 209593
* [Mips] Factor out the code create Mips specific runtime file intoSimon Atanasyan2014-05-253-28/+13
| | | | | | the MipsELFWriters member function. llvm-svn: 209592
* [Mips] Remove unused class member declaration.Simon Atanasyan2014-05-251-3/+0
| | | | llvm-svn: 209591
* [Mips] Reduce code duplication. Join relocation handling functions whichSimon Atanasyan2014-05-251-18/+8
| | | | | | perform similar calculations. llvm-svn: 209590
* [Mips] Handle R_MIPS_TLS_TPREL_HI16 / R_MIPS_TLS_TPREL_LO16 relocations.Simon Atanasyan2014-05-244-20/+64
| | | | llvm-svn: 209582
* [Mips] Simplify handling of R_MIPS_LO16 / R_MIPS_HI16 relocationsSimon Atanasyan2014-05-211-8/+8
| | | | | | against _gp_disp symbol. llvm-svn: 209315
* [Mips] Show warning if the linker cannot find a pair for a R_MIPS_HI16Simon Atanasyan2014-05-191-4/+6
| | | | | | | relocation. In fact this case violates ABI but sometimes compilers might produce such code. llvm-svn: 209153
* [Mips] Fix calculation of initial GOT entry value when this entry isSimon Atanasyan2014-05-171-1/+1
| | | | | | referenced by a local symbol. llvm-svn: 209063
* [ELF] Use a range based access to the ELFFile's sections collection.Simon Atanasyan2014-05-051-5/+3
| | | | | | No functional changes. llvm-svn: 207953
* [Mips] R_MIPS_GPREL32 relocation support.Simon Atanasyan2014-05-054-5/+103
| | | | llvm-svn: 207949
OpenPOWER on IntegriCloud