summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO
Commit message (Collapse)AuthorAgeFilesLines
...
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-6/+3
| | | | | | No functionality change intended. llvm-svn: 284734
* [MachO] Factor out a fair amount of duplicated code. NFCI.Davide Italiano2016-09-121-26/+14
| | | | llvm-svn: 281260
* [MachO] Remove code accidentally cut'n'pasted 3 times.Davide Italiano2016-09-101-204/+0
| | | | | | | It wasn't harmful, just goofy. It's weird to see how this has fallen through the crack without anybody noticing for so long. llvm-svn: 281148
* Fix shared library build.Rafael Espindola2016-09-061-0/+1
| | | | llvm-svn: 280753
* Use the demangler in llvm.Rafael Espindola2016-09-061-7/+2
| | | | llvm-svn: 280733
* ReaderWriter: Use ilist_noalloc_traits for TrieEdge, NFCDuncan P. N. Exon Smith2016-09-031-8/+3
| | | | | | | Adopt r280128 in lld, specializing ilist_alloc_traits rather than reinventing the wheel. llvm-svn: 280566
* ADT: Remove uses of ilist_*sentinel_traits, NFCDuncan P. N. Exon Smith2016-08-221-4/+0
| | | | llvm-svn: 279458
* MachO: Use ilist_half_embedded_sentinel_traits, NFCDuncan P. N. Exon Smith2016-08-121-12/+4
| | | | | | | Use ilist_half_embedded_sentinel_traits for the list of lld::mach_o::normalized::TrieEdge, rather than duplicating the code. llvm-svn: 278523
* Dead strip DESC bits should only be set on object files.Pete Cooper2016-08-111-1/+2
| | | | | | It only makes sense to set on N_NO_DEAD_STRIP on a relocatable object file. Otherwise the bits aren't useful for anything. Matches the ld64 behaviour. llvm-svn: 278419
* Better compress lazy binding info to match ld64.Pete Cooper2016-08-111-8/+11
| | | | | | | | | We should be using one of BIND_OPCODE_SET_DYLIB_SPECIAL_IMM, BIND_OPCODE_SET_DYLIB_ORDINAL_IMM, and BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB depending on whether ordinals are <= 0, <= 15, > 15. This matches the behaviour of ld64. llvm-svn: 278407
* Generate slightly more compressed binding opcodes when entries are the same ↵Pete Cooper2016-08-111-12/+37
| | | | | | | | | | | | as last time. We already had logic for binding opcodes had the same addend as last time. This adds the cases where the ordinal, symbol name, type, and segment offsets are the same as the last emitted ordinal. This gets us one step closer to emitting rebase opcodes as compressed as ld64 can manage. llvm-svn: 278405
* Arm64 stubs alignment is 2, not 4.Pete Cooper2016-08-111-2/+2
| | | | | | This matches the behaviour of ld64 when looking at the alignment of the stubs section in the final image. llvm-svn: 278398
* Change when we choose to add an LC_LOAD_DYLIB to the final image.Pete Cooper2016-08-113-16/+17
| | | | | | | | | | | Currently we do this when an atom is used, but we need to do it when a dylib is referenced on the cmdline as this matches ld64. This fixes much confusion over which maps are indexed with installName vs path. There is likely other confusion so i'll be seeing if i can remove path() completely in a future commit as path() shouldn't really be needed by anyone. llvm-svn: 278396
* Fix off-by-one error in default currentVersion.Pete Cooper2016-08-111-2/+2
| | | | | | | | A version of 0x1000 is 0.16.0, not 1.0.0 as the comment said. Fix the value to match the comment, and also the one test case which had this wrong. llvm-svn: 278381
* [lld][MachO] Fix LC_SEGEMENT[_64] filesize computation in -r mode.Lang Hames2016-08-101-1/+3
| | | | | | | | | | Using vmsize to populate this file works when outputing MachO images, but fails when outputting relocatable objects. This patch fixes the computation to use file offsets, which works for both output types. Fixes <rdar://problem/27727666> llvm-svn: 278297
* The first string table entry should be a null terminated space, not just null.Pete Cooper2016-08-081-2/+5
| | | | | | | This matches the behaviour of ld64 which initializes the string table with ' ' then '\0'. lld only had the '\0' and needed the ' '. llvm-svn: 278071
* ExportTrie nodes need to be visisted in order.Pete Cooper2016-08-051-2/+30
| | | | | | | | The export trie was being emitted in the order the nodes were added to the vector, but instead needs to be visited in the order that the nodes are traversed. This matches the behaviour of ld64. llvm-svn: 277869
* [lld][MachO] Replace some std::string with char* buffers to eliminate mem leaks.Lang Hames2016-07-292-13/+15
| | | | | | | | | | | The MachO debug support code (committed in r276935) occasionally needs to allocate string copies, and was doing so by creating std::strings on a BumpPtrAllocator. The strings were untracked, so the destructors weren't being run and we were leaking the memory when the allocator was thrown away. Since it's easier than tracking the strings, this patch switches the copies to char buffers allocated directly in the bump-ptr allocator. llvm-svn: 277208
* [lld][MachO] Remove some debugging output code that was mistakenly left in inLang Hames2016-07-282-30/+0
| | | | | | r276935. llvm-svn: 276944
* [lld][MachO] Re-apply r276921 with fix - initialize strings for debug stringLang Hames2016-07-279-26/+863
| | | | | | copies. llvm-svn: 276935
* [lld][MachO] Temporarily revert r276921 - it's causing bot-failures on Linux.Lang Hames2016-07-279-862/+26
| | | | llvm-svn: 276928
* [lld][MachO] Add debug info support for MachO.Lang Hames2016-07-279-26/+862
| | | | | | | | | This patch causes LLD to build stabs debugging symbols for files containing DWARF debug info, and to propagate existing stabs symbols for object files built using '-r' mode. This enables debugging of binaries generated by LLD from MachO objects. llvm-svn: 276921
* [lld][MachO] Add support for S_ATTR_DEBUG to the MachO YAML reader/writer.Lang Hames2016-07-261-0/+2
| | | | | | | This enables proper recognition of debug sections by attribute, which will be used in the near future by test-cases for MachO debugging support. llvm-svn: 276770
* [lld][MachO] Remove SimpleFile::definedAtoms().Lang Hames2016-06-282-12/+12
| | | | | | This method just duplicates the functionality of SimpleFile::defined(). llvm-svn: 274048
* [lld][MachO] Remove stray comment.Lang Hames2016-06-271-2/+0
| | | | llvm-svn: 273917
* [lld][MachO] Add support for x86-64 negDelta64 references and fix negDelta32.Lang Hames2016-06-252-37/+61
| | | | | | | | | | These references are used to implement MachO/x64-64 subtractor relocations where the minuend is being fixed up, rather than the subtrahend. The 64-bit version was not previously supported, the 32-bit version was partially implemented but contained bugs not caught by existing test cases. This patch fixes both functionality and test coverage. llvm-svn: 273759
* Apply clang-tidy's misc-move-constructor-init to lld.Benjamin Kramer2016-06-031-1/+2
| | | | | | No functionality change intended. llvm-svn: 271686
* Fix some Include What You Use warnings; other minor fixes.Eugene Zelenko2016-04-291-3/+14
| | | | | | Differential revision: http://reviews.llvm.org/D19735 llvm-svn: 268093
* Add missing header (NFC)Mehdi Amini2016-04-181-0/+1
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266596
* [lld][MachO] Clean up some unnecessarily verbose code. NFC.Lang Hames2016-04-061-4/+1
| | | | | | Suggested by Dave Blaikie in review of r265447. Thanks Dave! llvm-svn: 265566
* [lld][MachO] Check Expected<T> for error prior to destruction.Lang Hames2016-04-051-15/+17
| | | | | | This should fix the failures on the LLD bots caused by r265446. llvm-svn: 265477
* Revert "Remove useless unreachable. Switch coverage already gives us this. ↵Pete Cooper2016-03-311-0/+1
| | | | | | | | | | | | NFC" This reverts commit r264945. The commit only removed an unreachable in a method with a covered switch, but GCC is likely to warn on this, and the coding standards recommend just leaving in the unreachable. llvm-svn: 264983
* Use Expected<T> instead of ErrorOr<T>in yaml reader. NFCPete Cooper2016-03-312-4/+5
| | | | llvm-svn: 264981
* Change library search methods to return Optional instead of ErrorOr.Pete Cooper2016-03-311-13/+14
| | | | | | | | | | | | These methods weren't really throwing errors. The only error used was that a file could not be found, which isn't really an error at all as we are searching paths and libraries for a file. All of the callers also ignored errors and just used the returned path if one was available. Changing to return Optional<StringRef> as that actually reflects what we are trying to do here: optionally find a given path. llvm-svn: 264979
* Fix a bunch more of -Wpessimizing-move issues.Pete Cooper2016-03-311-4/+4
| | | | | | Thanks to Rui for pointing out this warning was firing. llvm-svn: 264978
* Fix a bunch of -Wpessimizing-move issues.Pete Cooper2016-03-313-4/+4
| | | | | | Thanks to Rui for pointing out this warning was firing. llvm-svn: 264977
* Convert a few macho reader/writer helpers to new error handling. NFC.Pete Cooper2016-03-312-30/+34
| | | | | | | | These methods were responsible for some of the few remaining calls to llvm::errorCodeToError. Converting them makes us have more Error's in the api and fewer error_code's. llvm-svn: 264974
* Convert readBinary to llvm::Error. NFCPete Cooper2016-03-303-11/+12
| | | | llvm-svn: 264973
* Convert normalized file to atoms methods to new error handling. NFC.Pete Cooper2016-03-304-119/+128
| | | | | | | This converts almost all of the error handling in atom creation to llvm::Error instead of std::error_code. llvm-svn: 264968
* Convert lld file writing to llvm::Error. NFC.Pete Cooper2016-03-304-34/+35
| | | | | | | 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
* Remove useless unreachable. Switch coverage already gives us this. NFCPete Cooper2016-03-301-1/+0
| | | | llvm-svn: 264945
* Convert file handle* methods to llvm::Error instead of std::error_code. NFC.Pete Cooper2016-03-301-8/+8
| | | | | | | This updates most of the file handling methods in the linking context and resolver to use the new API. llvm-svn: 264924
* Convert lld Pass::runOnFile to llvm::Error from std::error_code. NFC.Pete Cooper2016-03-308-20/+20
| | | | | | | Pretty mechanical change here. Just replacing all the std::error_code() with llvm::Error() and make_dynamic_error_code with make_error<GenericError> llvm-svn: 264917
* Change getReferenceInfo/getPairReferenceInfo to use new Error handling. NFC.Pete Cooper2016-03-306-215/+209
| | | | | | | | | | | | 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-282-4/+2
| | | | | | | | | | | 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 None to construct an empty ArrayRef. NFC.Pete Cooper2016-03-241-1/+1
| | | | | | Suggested by David Blaikie in response to r264234. llvm-svn: 264311
* Avoid UB when creating empty atoms. NFC.Pete Cooper2016-03-241-0/+2
| | | | | | | | | The stack-size.yaml test had an empty atom content array. This is legal, but asking a BumpPtrAllocator for 0 sized data may not be legal. Instead just avoid requesting any data when we can just return an empty ArrayRef instead. llvm-svn: 264234
* Avoid UB deref of nullptr to reference. NFC.Pete Cooper2016-03-241-0/+5
| | | | | | | | | Its possible for file to have no entry atom which means that there is no atom to check for being a thumb function. Instead just skip the thumb check and set the entry address to 0, which matches the current behaviour of getting a default initialised int from a map. llvm-svn: 264233
* Use a memcpy to avoid unaligned store UB.Pete Cooper2016-03-241-6/+9
| | | | | | | On a 32-bit output, we may write LC_MAIN (which contains a uint64_t) to an unaligned address. This changes it to use a memcpy instead which is UB safe. llvm-svn: 264232
* Use unaligned read to fix UB. NFC.Pete Cooper2016-03-241-3/+4
| | | | | | | | | | | We were casting a potentially unaligned pointer to uint32_t and dereferencing. As the pointer ultimately comes from the object file, there's no way to guarantee alignment, so use the little32_t read instead. Also, little32_t knows about endianness, so in theory this may have broken on big endian machines. llvm-svn: 264231
OpenPOWER on IntegriCloud