summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove unused variants of make_dynamic_error_code. NFC.Pete Cooper2016-03-311-8/+0
| | | | | | | | | | | | | | | | | make_dynamic_error_code was used to create a std::error_code with a std::string message. Now that we are migrating to llvm::Error, there are no calls to these make_dynamic_error_code methods. There is one single call to make_dynamic_error_code remaining, the one inside GenericError::convertToErrorCode(). That method is only called from File::doParse() which should be a temporary situation. We need to work out how to deal with File::parse() caching the error result from doParse(). Caching errors isn't supported in the new scheme, and probably isn't needed here, but we need to work that out. Once thats done, dynamic error and all utilities around it can be deleted. llvm-svn: 264982
* Convert lld file writing to llvm::Error. NFC.Pete Cooper2016-03-301-1/+1
| | | | | | | This converts the writeFile method, as well as some of the ones it calls in the normalized binary file writer and yaml writer. llvm-svn: 264961
* Fix -Wpessimizing-move warnings.Rui Ueyama2016-03-301-2/+2
| | | | llvm-svn: 264951
* Convert file handle* methods to llvm::Error instead of std::error_code. NFC.Pete Cooper2016-03-301-22/+31
| | | | | | | This updates most of the file handling methods in the linking context and resolver to use the new API. llvm-svn: 264924
* Change getReferenceInfo/getPairReferenceInfo to use new Error handling. NFC.Pete Cooper2016-03-301-0/+8
| | | | | | | | | | | | Adds a GenericError class to lld/Core which can carry a string. This is analygous to the dynamic_error we currently use in lld/Core. Use this GenericError instead of make_dynamic_error_code. Also, provide an implemention of GenericError::convertToErrorCode which for now converts it in to the dynamic_error_code we used to have. This will go away once all the APIs are converted. llvm-svn: 264910
* Remove dead flags.Rui Ueyama2016-03-281-35/+11
| | | | | | | | | | | searchArchivesToOverrideTentativeDefinitions and searchSharedLibrariesToOverrideTentativeDefinitions are always false. For the dead flags, we have a fairly large amount of code which is never be executed. http://reviews.llvm.org/D17791 llvm-svn: 264653
* Use owning pointers instead of raw pointers for Atom's to fix leaks.Pete Cooper2016-03-222-72/+71
| | | | | | | | | | | | | | | | | | | | | | | | This is a re-commit of r264022 with a fix for MSVC. The issue there was that the code was running DefinedAtom::~Atom() for some value and instead needed to cast to Atom before running ~Atom. Original commit message follows. Currently each File contains an BumpPtrAllocator in which Atom's are allocated. Some Atom's contain data structures like std::vector which leak as we don't run ~Atom when they are BumpPtrAllocate'd. Now each File actually owns its Atom's using an OwningAtomPtr. This is analygous to std::unique_ptr and may be replaced by it if possible. An Atom can therefore only be owned by a single File, so the Resolver now moves them from one File to another. The MachOLinkingContext owns the File's and so clears all the Atom's in ~MachOLinkingContext, then delete's all the File's. This makes sure all Atom's have been destructed before any of the BumpPtrAllocator's in which they run have gone away. Should hopefully fix the remaining leaks. Will keep an eye on the bots to make sure. llvm-svn: 264067
* Revert "Use owning pointers instead of raw pointers for Atom's to fix leaks."Pete Cooper2016-03-222-71/+72
| | | | | | | | | | | | This reverts commit r264022. This breaks the Window's bots which don't like that i'm calling ~Atom when the this pointer is a sublcass of Atom. Reverting for now until I try find a better fix. I tried using std::unique_ptr with a custom deleter as a quick fix, but it didn't work well in the YAML parser. llvm-svn: 264023
* Use owning pointers instead of raw pointers for Atom's to fix leaks.Pete Cooper2016-03-222-72/+71
| | | | | | | | | | | | | | | | | | | | Currently each File contains an BumpPtrAllocator in which Atom's are allocated. Some Atom's contain data structures like std::vector which leak as we don't run ~Atom when they are BumpPtrAllocate'd. Now each File actually owns its Atom's using an OwningAtomPtr. This is analygous to std::unique_ptr and may be replaced by it if possible. An Atom can therefore only be owned by a single File, so the Resolver now moves them from one File to another. The MachOLinkingContext owns the File's and so clears all the Atom's in ~MachOLinkingContext, then delete's all the File's. This makes sure all Atom's have been destructed before any of the BumpPtrAllocator's in which they run have gone away. Should hopefully fix the remaining leaks. Will keep an eye on the bots to make sure. llvm-svn: 264022
* Use C++11 initializers for data members.Rui Ueyama2016-03-021-7/+1
| | | | llvm-svn: 262447
* Remove more dead code.Rui Ueyama2016-03-021-1/+1
| | | | llvm-svn: 262445
* Remove default implementations that are always overridden by subclasses.Rui Ueyama2016-03-021-7/+0
| | | | llvm-svn: 262444
* Remove more dead code.Rui Ueyama2016-03-021-1/+0
| | | | llvm-svn: 262443
* Remove dead code for ELF.Rui Ueyama2016-02-282-50/+11
| | | | llvm-svn: 262195
* Remove dead code for ELF.Rui Ueyama2016-02-281-34/+1
| | | | | | The preload feature was buggy that we had disabled it even for ELF. llvm-svn: 262194
* Remove remaining code for COFF.Rui Ueyama2016-02-281-22/+0
| | | | llvm-svn: 262193
* Delete more COFF and ELF bits from the old linker.Rafael Espindola2016-02-282-27/+1
| | | | llvm-svn: 262184
* Delete more ELF bits from the old linker.Rafael Espindola2016-02-284-68/+2
| | | | llvm-svn: 262181
* Remove dead code. This error type is for the old linker script reader.Rui Ueyama2016-02-281-36/+0
| | | | llvm-svn: 262166
* Remove a few bits of elf from the old linker.Rafael Espindola2016-02-281-1/+0
| | | | llvm-svn: 262164
* Use __nl_symbol_ptr instead of __got in the stubs pass on x86 archs.Pete Cooper2016-02-091-0/+1
| | | | | | | | | | The non lazy atoms generated in the stubs pass use an image cache to hold all of the pointers. On arm archs, this is the __got section, but on x86 archs it should be __nl_symbol_ptr. rdar://problem/24572729 llvm-svn: 260271
* Fix handling of mach header and DSO handle symbols.Pete Cooper2016-02-022-0/+2
| | | | | | | | | | | | | | | | | The magic file which contained these symbols inherited from archive which meant that the resolver didn't add the required atoms as archive members only get added when referenced. Instead we now inherit from SimpleFile which always links in the atoms needed. The second issue was in the handling of these symbols when we emit the MachO. The mach header symbol needs to be in the atom list as it gets an offset (0), and being in the atom list makes sure it is emitted to the symbol table. DSO handles are not emitted to the symbol table. rdar://problem/24450654 llvm-svn: 259574
* Add ObjC method list atom type. NFC.Pete Cooper2016-02-011-0/+1
| | | | | | | | | | An upcoming patch will use this to create lists of ObjC methods. Adding it now to reduce the amount of code in that patch. Test cases will follow in the other patch too. llvm-svn: 259440
* Add an ObjCPass to the MachO linker.Pete Cooper2016-01-191-0/+1
| | | | | | | | | This pass currently emits an objc image info section if one is required. This section contains the aggregated version and flags for all of the input files. llvm-svn: 258197
* Add File::kind's for all subclasses of File.Pete Cooper2016-01-142-4/+17
| | | | | | | | | | | | This is to enable isa<> support for any files which need it. It will be used in an upcoming patch to differentiate MachOFile from other implicitly generated files. Reviewed by Lang Hames. Differential Revision: http://reviews.llvm.org/D16103 llvm-svn: 257830
* Add handleLoadedFile hook to the context.Pete Cooper2016-01-141-22/+60
| | | | | | | | | | | | | | This is called from the resolver on each file we decide we actually want to use. Future commits will make use of this to extract useful information from the files and do error checking against the context. For example, ensure that files are the same arch as each other. Reviewed by Lang Hames. Differential Revision: http://reviews.llvm.org/D16093 llvm-svn: 257814
* Set CMake ADDITIONAL_HEADER_DIRS on libraries with headers in /include. NFC.Pete Cooper2016-01-071-0/+4
| | | | | | | | | | | In a UI such as XCode, it can group the headers for a library with that library. This is done in the CMakeLists.txt for the library itself by setting the path(s) as ADDITIONAL_HEADER_DIRS. LLVM already does this for all of its libraries, so just adding this to lld to make things easier. Should be NFC. llvm-svn: 257002
* Set the folder for libraries to 'lld libraries'. NFC.Pete Cooper2016-01-071-1/+1
| | | | | | | | | | | | In a UI such as XCode, LLVM source files are in 'libraries' while clang files are in 'clang libraries'. This change moves the lld source to 'lld libraries' to make code browsing easier. It should be NFC as the build itself is still the same, just the structure in a UI differs. llvm-svn: 257001
* Add more debugging output to MachO lld. NFC.Pete Cooper2015-12-161-5/+24
| | | | | | | In debug builds there's now a dump method on Section and improved printing of atoms. llvm-svn: 255826
* Added some DEBUG() prints to make it clearer what the mach-o passes are ↵Pete Cooper2015-12-161-2/+25
| | | | | | | | | | | | doing. NFC. We had some DEBUG prints these passes, but add more so that its clear where we are dumping things, and what state we are in when we do so. I'll be adding more and more DEBUG printing to try make it easier to observe whats going on without having to attach a debugger. llvm-svn: 255805
* [lld][Darwin] Add support for the -sectcreate option.Lang Hames2015-10-241-0/+1
| | | | llvm-svn: 251183
* Fix Clang-tidy misc-use-override warnings, other minor fixes.Rui Ueyama2015-09-101-3/+2
| | | | | | Patch from Eugene Zelenko! llvm-svn: 247323
* [LinkerScript] Process program header in PHDRS commandDenis Protivensky2015-08-121-0/+6
| | | | | | | | | | Add PT_PHDR segment depending on its availability in linker script's PHDRS command, fallback if no linker script is given. Handle FILEHDR, PHDRS and FLAGS attributes of program header. Differential Revision: http://reviews.llvm.org/D11589 llvm-svn: 244743
* [LinkerScript] Add matching of output sections to segmentsDenis Protivensky2015-06-151-0/+2
| | | | | | | | | | | Add method to query segments for specified output section name. Return error if the section is assigned to unknown segment. Check matching of sections to segments during layout on the subject of correctness. NOTE: no actual functionality of using custom segments is implemented. Differential Revision: http://reviews.llvm.org/D10359 llvm-svn: 239719
* [ARM] Move out .ARM.exidx related things to ARM backendDenis Protivensky2015-05-261-1/+0
| | | | llvm-svn: 238191
* [ARM] Generation of .ARM.exidx/.ARM.extab sectionsLeny Kholodov2015-05-081-0/+1
| | | | | | | | | | | | This patch provides generation of .ARM.exidx & .ARM.extab sections which are used for unwinding. The patch adds new content type typeARMExidx for atoms from .ARM.exidx section and integration of atoms with such type to the ELF ReaderWriter. exidx.test has been added with checking of contents of .ARM.exidx section and .ARM.extab section. Differential Revision: http://reviews.llvm.org/D9324 llvm-svn: 236873
* Use MemoryBufferRef instead of MemoryBuffer&. NFC.Rafael Espindola2015-04-241-1/+1
| | | | | | This just reduces the noise from another patch. llvm-svn: 235776
* Return ErrorOr<std::unique_ptr<File>>. NFC.Rafael Espindola2015-04-241-8/+3
| | | | llvm-svn: 235744
* Remove unused enum value. NFC.Rafael Espindola2015-04-241-2/+0
| | | | llvm-svn: 235742
* Return an ErrorOr<std::unique_ptr<File>>. NFC.Rafael Espindola2015-04-241-1/+4
| | | | llvm-svn: 235741
* Delete unnecessary generality in loadFile.Rafael Espindola2015-04-241-3/+2
| | | | | | | | | | | | | loadFile could load mulitple files just because yaml has a feature for putting multiple documents in one file. Designing a linker around what yaml can do seems like a bad idea to me. This patch changes it to read a single file. There are further improvements to be done to the api and they will follow shortly. llvm-svn: 235724
* Define make_dynamic_error_code(const char *).Rui Ueyama2015-04-141-0/+4
| | | | | | | | | | | | The function took either StringRef or Twine. Since string literals are ambiguous when resolving the overloading, many code calls used this function with explicit type conversion. That led awkward code like make_dynamic_error_code(Twine("Error occurred")). This patch adds a function definition for string literals, so that you can directly call the function with literals. llvm-svn: 234841
* Do s/_context/_ctx/g globally.Rui Ueyama2015-04-101-7/+6
| | | | | | | | I believe this patch eliminates all remaining uses of _context or _linkingContext variable names. Consistent naming improves readability. llvm-svn: 234645
* Remove the Native file format.Rui Ueyama2015-04-102-51/+0
| | | | | | | | | | | | | The Native file format was designed to be the fastest on-memory or on-disk file format for object files. The problem is that no one is working on that. No LLVM tools can produce object files in the Native, thus the feature of supporting the format is useless in the linker. This patch removes the Native file support. We can add it back if we really want it in future. llvm-svn: 234641
* Reapply r234378, with test fixed (by emaste).Davide Italiano2015-04-101-1/+1
| | | | | | Hopefully this time the build won't be broken. llvm-svn: 234553
* Rename atom_collection -> AtomVector.Rui Ueyama2015-04-081-4/+4
| | | | | | Type names should start with an uppercase letter in the LLVM coding style. llvm-svn: 234452
* Merge atom_collection_vector with atom_collection.Rui Ueyama2015-04-081-4/+4
| | | | | | | atom_collection_vector is the only derived class of atom_collection. This patch merges the two. llvm-svn: 234443
* Remove atom_collection_empty class.Rui Ueyama2015-04-081-4/+4
| | | | llvm-svn: 234442
* Revert "Allow undefined symbols in shared library by default."Rui Ueyama2015-04-081-1/+1
| | | | | | This reverts commit r234378 because it broke buildbots. llvm-svn: 234414
* Allow undefined symbols in shared library by default.Davide Italiano2015-04-081-1/+1
| | | | | | | | | | | | It's not our business to resolve those undefined symbols. We just trust the linker will load the library and its dependencies correctly, which is actually what happens, modulo bugs in the dynamic linker itself. PR: 23035 Differential Revision: http://reviews.llvm.org/D8886 llvm-svn: 234378
OpenPOWER on IntegriCloud