summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO
Commit message (Collapse)AuthorAgeFilesLines
...
* Only emit files with subsections_via_symbols if all inputs had that set.Pete Cooper2016-01-163-9/+32
| | | | | | | | | | | | When generating a relocatable file, its only valid to set this flag if all of the inputs also had the flag. Otherwise we may atomize incorrectly when we link the relocatable file again. Reviewed by Lang Hames. Differential Revision: http://reviews.llvm.org/D16018 llvm-svn: 257976
* Give error on binaries containing GC objc image infos.Pete Cooper2016-01-161-4/+12
| | | | | | | | The image info struct contains flags for what kind of GC/retain/release is required. Give an error if we parse GC flags as these are unsupported. llvm-svn: 257974
* Add checking of differing swift versions in input files.Pete Cooper2016-01-163-0/+18
| | | | | | | Swift versions are part of the objc image info section, and must match for all files linked which actually have an image info section llvm-svn: 257964
* Check that the objc image info version is exactly 0Pete Cooper2016-01-151-0/+8
| | | | llvm-svn: 257953
* Error check the size of the __objc_imageinfo sectionPete Cooper2016-01-141-0/+44
| | | | llvm-svn: 257841
* Check for mismatched arch and OS when linking MachO files.Pete Cooper2016-01-143-0/+36
| | | | | | | | | | | | This patch makes use of the handleLoadedFile hook added in r257814. That method is used to check the arch and the OS of the files we are linking against the arch and OS on the context. The first test to use this ensures that we do not try to combine i386 Mac OS code with i386 simulator code. llvm-svn: 257837
* Add File::kind's for all subclasses of File.Pete Cooper2016-01-143-5/+11
| | | | | | | | | | | | 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-0/+4
| | | | | | | | | | | | | | 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
* Update for LLVM function name change.Rui Ueyama2016-01-142-12/+10
| | | | llvm-svn: 257801
* Always generate the fixup content for unwindFDEToFunction as we noPete Cooper2016-01-071-3/+11
| | | | | | longer emit it. llvm-svn: 257100
* Don't emit relocs for the __eh_frame section as they can be implicit.Pete Cooper2016-01-073-8/+34
| | | | | | | | | | | | | | The __eh_frame section contains relocations which can always be implicitly generated. This patch tracks whether sections have only implicitly relocations and skips emitting them to the object file if that is the case. The test case here ensures that this is the case for __eh_frame sections. Reviewed by Lang Hames. http://reviews.llvm.org/D15594 llvm-svn: 257099
* 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
* Fix MachO arm64 delta32ToGOT reloc encoding in -r.Pete Cooper2016-01-061-1/+1
| | | | | | | | | | | | | The fixup content we encode here should be the offset from the fixup location back to the last nonlocal label. We were only encoding the address of the fixup, and not taking in to account the base address of the atom we are in. Updated the test case here to have a text section which will come before the data section where the relocation lives. .data being at offset 0 had previously been hiding this bug. llvm-svn: 256974
* Improved debugging printing. NFCPete Cooper2016-01-052-9/+54
| | | | llvm-svn: 256805
* Sort sections in relocatable files.Pete Cooper2016-01-041-102/+62
| | | | | | | | | | | | | | | | | The final section order in relocatable files was just a side effect of the atom sorter. This meant that sections like __data were before __text because __data has RW permissions and __text RX and RW was less than RX in our enum. Final linked images had an actual section/segment sorter. There was no reason for the difference, so simplify a bunch of code and just use the same sorted for everything. Reviewed by Lang Hames. http://reviews.llvm.org/D15868 llvm-svn: 256786
* Fix x86_64 delta*Anon relocs.Pete Cooper2016-01-041-2/+22
| | | | | | | | | | | | | | | | | | The encoded value should be an offset from the fixup location, which means that it should take in to account the fixup offset in its section. We weren't subtracting the base address of the atom, which meant that when we parsed the file again for a round trip, we had 2x the atom address in our target address. I've also improved comments for these to try and describe what is going on. There's no test case right now, as the bug is only exhibited when __data is at a non-zero address in a -r link. A commit will soon sort the sections differently and move __data to after __text. Then these relocations in test/mach-o/parse-data-relocs-x86_64.yaml will test for this bug. llvm-svn: 256779
* Fix negDelta32 relocatable fixups for arm64 in mach-o.Pete Cooper2015-12-161-1/+1
| | | | | | | | | | | negDelta32 is only ever implicitly generated as the FDE->CIE reference. We therefore don't emit a relocation for it in the object file in -r mode. The value we write in to the FDE location therefore needs to point to the final target address of the CIE, and not the inAtomAddress as it was currently doing. llvm-svn: 255835
* Add more debugging output to MachO lld. NFC.Pete Cooper2015-12-162-0/+25
| | | | | | | 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-0/+2
| | | | | | | | | | | | 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][MachO] Recognize __thread_bss sections as zero-fill and set all theLang Hames2015-12-117-14/+39
| | | | | | | | | appropriate bits. This fixes the remaining clang regression test failures when linking clang with lld on Darwin. llvm-svn: 255390
* Verify that macho-o delta64 relocs have the same offset.Pete Cooper2015-12-102-21/+50
| | | | | | | | | | The delta64 relocation is represented as the pair ARM64_RELOC_SUBTRACTOR and ARM64_RELOC_UNSIGNED. Those should always have the same offset, so this adds a check and tests to ensure this is the case. Also updated the error printing in this case to shows both relocs when erroring on pair. llvm-svn: 255274
* [lld][MachO] Always reserve space for the empty string in the mach-o symbolLang Hames2015-12-101-1/+1
| | | | | | | | | | | | | table. The first entry in the MachO symbol table is always the empty string: make sure we reserve space for it, or we will overflow the symbol table by one byte. No test case - this manifests as an occasional memory error. In the near future I hope to set up a bot building and runnnig LLD with sanitizers - that should catch future instances of this issue. llvm-svn: 255178
* Don't bypass the GOT for delta32toGOT references.Pete Cooper2015-12-091-0/+6
| | | | | | | | | | | The gcc_except_tab was generating these references to point to the typeinfo in the data section. gcc_except_tab also had the DW_EH_PE_indirect flag set which means that at runtime we are going to dereference this entry as if it is in the GOT. Reviewed by Nick Kledzik in http://reviews.llvm.org/D15360. llvm-svn: 255085
* Fix Clang-tidy modernize-use-auto warnings, other minor fixes.Eugene Zelenko2015-11-107-82/+29
| | | | | | Differential revision: http://reviews.llvm.org/D14553 llvm-svn: 252661
* Fix Clang-tidy modernize-use-override warnings, other minor fixes.Eugene Zelenko2015-11-041-5/+4
| | | | | | Differential revision: http://reviews.llvm.org/D14310 llvm-svn: 252034
* [lld][MachO] Make sure LC_RPATH command size is a multiple of the pointer size.Lang Hames2015-10-291-2/+2
| | | | llvm-svn: 251637
* [lld][MachO] Use a std::string rather than a StringRef for the section name inLang Hames2015-10-291-1/+1
| | | | | | | | | MachODefinedCustomSectionAtom. The section names for these atoms are initialized from temporaries (e.g. segName + "/" + sectName), so we can't use StringRef here. llvm-svn: 251610
* [lld][Darwin] Add support for the -sectcreate option.Lang Hames2015-10-242-0/+109
| | | | llvm-svn: 251183
* [lld][MachO] Prune unused EH frames.Lang Hames2015-10-231-0/+51
| | | | llvm-svn: 251095
* [lld][MachO] Fix indentation.Lang Hames2015-10-201-2/+2
| | | | llvm-svn: 250863
* [lld][MachO] Fix typo in comment.Lang Hames2015-10-201-1/+1
| | | | llvm-svn: 250861
* [LLD] Fix Clang-tidy modernize-use-nullptr warnings; other minor cleanups.Rui Ueyama2015-10-022-17/+2
| | | | | | Patch from Eugene Zelenko! llvm-svn: 249111
* [lld][MachO] Fix a think-o to get the twolevel/dynamic_lookup test passing.Lang Hames2015-09-282-7/+5
| | | | llvm-svn: 248736
* [lld][MachO] Initial implementation of -flat_namespace and -undefined.Lang Hames2015-09-284-12/+111
| | | | | | | | | This is a basic initial implementation of the -flat_namespace and -undefined options for LLD-darwin. It ignores several subtlties, but the result is close enough that we can now link LLVM (but not clang) on Darwin and pass all regression tests. llvm-svn: 248732
* [LLD][MachO] Fix a FIXME: Subtract base address from atom address when buildingLang Hames2015-09-212-1/+4
| | | | | | export trie. llvm-svn: 248217
* Fix Clang-tidy misc-use-override warnings, other minor fixes.Rui Ueyama2015-09-106-44/+17
| | | | | | Patch from Eugene Zelenko! llvm-svn: 247323
* Update for llvm api change.Rafael Espindola2015-08-131-6/+5
| | | | llvm-svn: 244849
* Wdeprecated: Remove unnecessary user-defined dtor that was getting in the ↵David Blaikie2015-08-121-1/+0
| | | | | | way of the default ops (copy construction, assignment, etc) llvm-svn: 244836
* [lld] Add MachO thread-local storage support.Lang Hames2015-06-238-6/+223
| | | | | | | | This allows LLD to correctly link MachO objects that use thread-local storage. Differential Revision: http://reviews.llvm.org/D10578 llvm-svn: 240454
* [MachO] Initialize all fields of NormalizedFile.Benjamin Kramer2015-06-231-20/+14
| | | | | | | | | The ObjectFileYAML.roundTrip serializes a default-constructed NormalizedFile to YAML, triggering uninitialized memory reads. While there use in-class member initializers. llvm-svn: 240446
* Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&David Blaikie2015-06-196-30/+30
| | | | | | | | None of the implementations replace the SimpleFile with some other file, they just modify the SimpleFile in-place, so a direct reference to the file is sufficient. llvm-svn: 240167
* [lld] Allow LLD passes to return error codes.Lang Hames2015-06-196-10/+20
| | | | llvm-svn: 240147
* [lld] Make the MachO -stack_size default '0', add a test case.Lang Hames2015-05-222-2/+2
| | | | | | Addresses some review comments for r237841. llvm-svn: 237979
* [LLD] Add support for the -stack_size option to Darwin ld.Lang Hames2015-05-205-4/+7
| | | | llvm-svn: 237841
* [LLD] Make sure MachO FDEs read their augmentation data strings from the rightLang Hames2015-05-161-18/+28
| | | | | | CIE, not just the most recently encountered one. llvm-svn: 237491
* [LLD] Properly relocate the LSDA field of MachO eh-frames.Lang Hames2015-05-131-40/+153
| | | | | | | Previously the LSDA field was not being relocated during linking, leading to failures for some EH tests. llvm-svn: 237222
* [LLD] Add support for MachO ripRel32MinusNAnon relocations.Lang Hames2015-05-131-2/+48
| | | | llvm-svn: 237219
* [LLD] Add a mutex to prevent concurrent modification of the dylib maps inLang Hames2015-05-131-0/+1
| | | | | | MachOLinkingContext. llvm-svn: 237217
* Use MemoryBufferRef instead of MemoryBuffer&. NFC.Rafael Espindola2015-04-273-9/+7
| | | | | | This just reduces the noise from another patch. llvm-svn: 235933
* Use MemoryBufferRef instead of MemoryBuffer&. NFC.Rafael Espindola2015-04-241-2/+2
| | | | | | This just reduces the noise from another patch. llvm-svn: 235776
OpenPOWER on IntegriCloud