summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* swapStruct extracted into include/llvm/Support/MachO.h (no functional change)Artyom Skrobov2014-07-181-155/+0
| | | | llvm-svn: 213362
* [mach-o] Add support for x86 pointers which use scattered relocationsNick Kledzik2014-07-181-4/+20
| | | | llvm-svn: 213344
* [mach-o] Add support for x86 CALL instruction that uses a scattered relocationNick Kledzik2014-07-181-14/+47
| | | | llvm-svn: 213340
* [mach-o] implement more x86 and x86_64 relocation supportNick Kledzik2014-07-176-100/+614
| | | | | | | | | Add support for adding section relocations in -r mode. Enhance the test cases which validate the parsing of .o files to also round trip. They now write out the .o file and then parse that, verifying all relocations survived the round trip. llvm-svn: 213333
* References cannot be bound to null.Joerg Sonnenberger2014-07-171-2/+0
| | | | llvm-svn: 213323
* [PECOFF] Split ExportedSymbolRenameFile.Rui Ueyama2014-07-171-31/+44
| | | | | | | | | The code to manage resolvable symbols is now separated from ExportedSymbolRenameFile so that other class can reuse it. I'm planning to use it to find the entry function symbol based on resolvable symbols. llvm-svn: 213322
* Remove all uses of llvm::function_ref from LLD.Rui Ueyama2014-07-171-1/+1
| | | | llvm-svn: 213313
* Use std::function instead of llvm::function_ref.Rui Ueyama2014-07-172-16/+2
| | | | llvm-svn: 213312
* [Mips] s/context/ctx/ for consistency and reduce lines lengths.Simon Atanasyan2014-07-178-48/+42
| | | | | | No functional changes. llvm-svn: 213310
* [PECOFF] Set DLL bit in PE header if DLL.Rui Ueyama2014-07-171-0/+2
| | | | | | | Windows loader can load a DLL without this bit but it wouldn't call the initializer function in the DLL if the bit is absent. llvm-svn: 213216
* [mach-o] refactor KindHandler into ArchHandler and simplify passes.Nick Kledzik2014-07-1624-2377/+2270
| | | | | | | | | | | All architecture specific handling is now done in the appropriate ArchHandler subclass. The StubsPass and GOTPass have been simplified. All architecture specific variations in stubs are now encoded in a table which is vended by the current ArchHandler. llvm-svn: 213187
* [ELF] Implement parsing `-l` prefixed items in the `GROUP` linker script ↵Simon Atanasyan2014-07-153-6/+46
| | | | | | | | | | | | | | | | | | command. There are two forms of `-l` prefixed expression: * -l<libname> * -l:<filename> In the first case a linker should construct a full library name `lib + libname + .[so|a]` and search this library as usual. In the second case a linker should use the `<filename>` as is and search this file through library search directories. The patch reviewed by Shankar Easwaran. llvm-svn: 213077
* [PECOFF] s/context/ctx/ for consistency.Rui Ueyama2014-07-101-16/+16
| | | | llvm-svn: 212766
* [PECOFF] Set resource table entry in header.Rui Ueyama2014-07-101-0/+3
| | | | | | | The resource table entry should have the RVA of the embedded resource file. llvm-svn: 212765
* [PECOFF] Invoke cvtres.exe in the driver.Rui Ueyama2014-07-102-147/+99
| | | | | | | | | | | | | | | | | Previously we invoked cvtres.exe for each compiled Windows resource file. The generated files were then concatenated and embedded to the executable. That was not the correct way to merge compiled Windows resource files. If you just concatenate generated files, only the first file would be recognized and the rest would be ignored as trailing garbage. The right way to merge them is to call cvtres.exe with multiple input files. In this patch we do that in the Windows driver. llvm-svn: 212763
* [mach-o]: support -Z option to skip standard library pathsTim Northover2014-07-102-2/+7
| | | | llvm-svn: 212713
* [mach-o]: support user-specified (-L) library search pathsTim Northover2014-07-102-3/+7
| | | | llvm-svn: 212712
* [mach-o]: support -syslibroot and -l optionsTim Northover2014-07-103-4/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | These behave slightly idiosyncratically in the best of cases, and have additional hacks layered on top of that for compatibility with badly behaved build systems (via ld64). For -lXYZ: + If XYZ is actually XY.o then search all library paths for XY.o + Otherwise search all library paths, first for libXYZ.dylib, then libXYZ.a + By default the library paths are /usr/lib and /usr/local/lib in that order. For -syslibroot: + -syslibroot options apply to absolute paths in the search order. + All -syslibroot prefixes that exist are added to the search path *instead* of the original. + If no -syslibroot prefixed path exists, the original is kept. + Hacks^WExceptions: + If only 1 -syslibroot is given and doesn't contain /usr/lib or /usr/local/lib, that path is dropped entirely. (rdar://problem/6438270). + If the last -syslibroot is "/", all of them are ignored entirely. (rdar://problem/5829579). At least, that's my best interpretation of what ld64 does in buildSearchPaths. llvm-svn: 212706
* Move GOTPass and StubsPass from Core to MachONick Kledzik2014-07-098-71/+111
| | | | llvm-svn: 212652
* [all]: Use range-based ArgList adapter instead of filtered_begin/filtered_endTim Northover2014-07-093-31/+17
| | | | | | Some of those loops were pretty monstrous. llvm-svn: 212616
* [PECOFF] Fix .bss section alignmentRui Ueyama2014-07-081-4/+5
| | | | | | | | | | Previously the alignment of the .bss section was not properly set because of a bug in AtomizeDefinedSymbolsInSection. We set the alignment of the section at the end of the function, but we use an eraly return for the .bss section, so the code had been skipped. llvm-svn: 212571
* Update for llvm api change.Rafael Espindola2014-07-065-19/+23
| | | | llvm-svn: 212407
* Update for llm api change.Rafael Espindola2014-07-057-14/+18
| | | | llvm-svn: 212372
* [mach-o] Add parsing of arm/thumb relocationsNick Kledzik2014-07-045-95/+528
| | | | | | | | | | This converts the very complicated mach-o arm relocations into the simple Reference Kinds in lld. The next patch will use the internal Reference kinds to fix up arm/thumb code. llvm-svn: 212306
* [mach-o] add x86 test case to build hello world. Fix bugs it uncovered.Nick Kledzik2014-07-034-35/+43
| | | | llvm-svn: 212247
* [mach-o] Fix warning on enumeration cases not handledNick Kledzik2014-07-031-0/+10
| | | | llvm-svn: 212241
* [mach-o] add parsing of x86 relocationsNick Kledzik2014-07-024-30/+259
| | | | llvm-svn: 212239
* [mach-o]: make the default dylib install-name the output filename.Tim Northover2014-07-011-0/+4
| | | | llvm-svn: 212094
* [mach-o] add representation for LC_ID_DYLIB to MachONormalizedFileTim Northover2014-07-015-3/+36
| | | | | | | It still needs to be tied into BinaryReader, but this allows reasonably sensible creation of SharedLibrary atoms on MachO. llvm-svn: 212093
* [mach-o] improve errors when mixing architecturesNick Kledzik2014-06-303-19/+29
| | | | llvm-svn: 212072
* [mach-o] x86_64 relocation code review fixesNick Kledzik2014-06-302-5/+5
| | | | llvm-svn: 212068
* MachO: stop iterating past the end of an arrayTim Northover2014-06-301-8/+7
| | | | | | | | When trying to map atom types to sections, we were iterating through an array until we hit a sentinel value. There's no need for such dances when range-based for loops are available. llvm-svn: 212035
* MachO: re-enable writing of compact-unwind sections.Tim Northover2014-06-301-1/+7
| | | | | | | | | | | | This isn't really the right place to put them in final object files (that would be __TEXT,__unwind_info), but the format is different between relocatable and final objects, which means we really need a pass to handle the translation. For now, re-emitting in __LD,__compact_unwind is harmless (dyld ignores it and moves straight on to inspecting __TEXT,__eh_frame), and sidesteps an assertion failure when processing files containing compact-unwind info. llvm-svn: 212032
* MachO: align segment virtual addresses to page size.Tim Northover2014-06-301-2/+5
| | | | | | | | | Segments must occupy a multiple of the page size in memory (4096 currently). We check for this when emitting files, but the placement algorithm broke down for the second non-__TEXT segment encountered: the offset wasn't aligned up to 4096 before starting its layout. llvm-svn: 212031
* MachO: calculate segment offsets in final MachO files properly.Tim Northover2014-06-301-6/+16
| | | | | | | | | Because of how we were calculating fileOffset and fileSize for segments, most ended up at a single offset in a finalised MachO file. This meant the data often didn't even get written in the final object, let alone where it would be useful. llvm-svn: 212030
* MachO: support atomization of dylibs.Tim Northover2014-06-305-1/+118
| | | | | | | For .dylib files, we refrain from actually creating any atoms until they're requested via the "exports" method. llvm-svn: 212027
* [mach-o] fix struct initialization to work with Windows compilerNick Kledzik2014-06-271-6/+14
| | | | llvm-svn: 211951
* [mach-o] refactor x86_64 relocation handling.Nick Kledzik2014-06-278-109/+727
| | | | | | | | | | | | | | This is first step in reworking how mach-o relocations are processed. The existing KindHandler is going to become a delgate/helper object for processing architecture specific references. The KindHandler knows how to convert mach-o relocations into References and back, as well, as fixing up the content the relocation is on. One of the messy things about mach-o relocations is that they sometime come in pairs, but the pairs still convert to one lld::Reference. So, the conversion has to detect pairs (arch specific) and change the stride. llvm-svn: 211921
* [Driver] Improve the `isPathUnderSysroot()` function. Now it returns aSimon Atanasyan2014-06-261-7/+5
| | | | | | | correct result even if checking paths: a) symlinks and/or b) contains relative parts like /dir1/dir2/../dir2. llvm-svn: 211772
* [mach-o]: make sure custom sort method is irreflexive.Tim Northover2014-06-251-2/+2
| | | | | | | | | | | The previous function returned true for "s < s", which could completely mess up the sorting of symbols within a section. Unfortunately, I don't think there's a robust way to write a test for this. Anything I come up with will be making assumptions about the particular implementation of std::sort. llvm-svn: 211704
* [mach-o]: atomize zero-terminated literals correctly.Tim Northover2014-06-251-5/+5
| | | | | | | | | When looking through sections with zero-terminated string-literals (__cstring or __ustring) we were constantly rechecking the first few bytes of the string for '\0' rather than advancing along. This obviously failed unless all strings within the section had the same length as that first one. llvm-svn: 211682
* [mach-o] don't assume all sections have symbolsTim Northover2014-06-251-4/+6
| | | | | | | | We were trying to examine the first symbol in a section that we wanted to atomize by symbols, even when there wasn't one. Instead, we should make the initial anonymous symbol cover the entire section in that situation. llvm-svn: 211681
* [ELF] Add two new virtual functions to the `OutputELFWriter` class to controlSimon Atanasyan2014-06-255-2/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update for llvm api change.Rafael Espindola2014-06-241-5/+3
| | | | llvm-svn: 211596
* Update for llvm api change.Rafael Espindola2014-06-232-2/+2
| | | | llvm-svn: 211548
* [Mips] Remove redundant checking from the RelocationPass::isDynamic() function.Simon Atanasyan2014-06-211-8/+1
| | | | | | No functional changes. llvm-svn: 211431
* PE/COFF: move PAGE_SIZE into the PECOFFLinkingContext.Tim Northover2014-06-201-16/+13
| | | | | | A refactoring, with the added benefit of helping OS X builds. llvm-svn: 211371
* MachO: rename _outputFileType to avoid shadowing parent field.Tim Northover2014-06-205-27/+26
| | | | llvm-svn: 211367
* [PECOFF] Support COMDAT associative sections.Rui Ueyama2014-06-174-13/+60
| | | | | | | | | | | | | | | | | | | COFF supports a feature similar to ELF's section groups. This patch implements it. In ELF, section groups are identified by their names, and they are treated somewhat differently from regular symbols. In COFF, the feature is realized in a more straightforward way. A section can have an annotation saying "if Nth section is linked, link this section too." I added a new reference type, kindAssociate. If a target atom is coalesced away, the referring atom is removed by Resolver, so that they are treated as a group. Differential Revision: http://reviews.llvm.org/D4028 llvm-svn: 211106
* Update for llvm api change.Rafael Espindola2014-06-161-10/+12
| | | | llvm-svn: 211034
OpenPOWER on IntegriCloud