summaryrefslogtreecommitdiffstats
path: root/lld
Commit message (Collapse)AuthorAgeFilesLines
* [Mips] Replace assembler code by YAML to make the 'gotsym.test' testSimon Atanasyan2014-08-021-13/+24
| | | | | | target independent. llvm-svn: 214641
* [Mips] Replace assembler code by YAML to make the 'interpreter.test' testSimon Atanasyan2014-08-011-10/+21
| | | | | | target independent. llvm-svn: 214495
* [PECOFF] Fix section header.Rui Ueyama2014-07-3112-26/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PE/COFF spec says that SizeOfRawData field in the section header must be a multiple of FileAlignment from the optional header. LLD emits 512 as FileAlignment, so it must have been a multiple of 512. LLD did not follow that. It emitted the actual section size without the last padding as the SizeOfRawData. Although it's not correct as per the spec, the Windows loader doesn't seem to actually bother to check that. Executables created by LLD worked fine. However, tools dealing with executalbe files may expect it to be the correct value, and one instance of it is mt.exe tool distributed as a part of Windows SDK. If CMake is invoked with "-E vs_link_exe" option, it silently run mt.exe to embed a resource file to the resulting file. And mt.exe sometimes breaks an input file if it's section header does not follow the standard. That caused a misterous error that CMake with Ninja occasionally produces a broken executable. This patch fixes the section header to make mt.exe and other tools happy. llvm-svn: 214453
* XFAIL the ARM test when we don't have this target.Simon Atanasyan2014-07-312-0/+3
| | | | llvm-svn: 214420
* [mach-o] wire up -t optionNick Kledzik2014-07-312-0/+6
| | | | llvm-svn: 214414
* Update for llvm api change.Rafael Espindola2014-07-312-2/+2
| | | | llvm-svn: 214378
* [mach-o] Fix test case comment and stray file copyNick Kledzik2014-07-301-2/+2
| | | | llvm-svn: 214278
* [mach-o] Fix arm interworking with movw/movtNick Kledzik2014-07-302-0/+401
| | | | | | | | In some cases the address of a function will be materialized with a movw/movt pair. If the function is a thumb function, the low bit needs to be set on the movw immediate value. llvm-svn: 214277
* [mach-o] Add support for -sectalign optionNick Kledzik2014-07-307-45/+237
| | | | | | | | | | | | The -sectalign option is used to increase the alignment required for a section. It required some reworking of how the __TEXT segment is laid out because that segment also contains the mach_header and load commands. And the size of load commands depend on the number of segments, sections, and dependent dylibs used. Using this option will simplify some future test cases because the final address of code can be pinned down, making tests of its content easier. llvm-svn: 214268
* [mach-o] fix non-debug warningsNick Kledzik2014-07-281-4/+4
| | | | llvm-svn: 214145
* [mach-o] Implement interworking between thumb and arm codeNick Kledzik2014-07-284-45/+584
| | | | | | | | | | | All iOS arm processor support switching between arm and thumb mode at call sites by using the BLX instruction (instead of BL). But the compiler does not know the implementation mode for extern functions, so the linker must update BL/BLX instructions to match what is linked is actually linked together. In addition, pointers to functions (such as vtables) must have the low bit set if the target of the pointer is a thumb mode function. llvm-svn: 214140
* [PECOFF] Fix failing test.Rui Ueyama2014-07-281-6/+0
| | | | | | This should be covered by the Driver's unit tests. llvm-svn: 214134
* [Mips] Remove redundant REQUIRES clause.Simon Atanasyan2014-07-281-2/+0
| | | | | | The exe-got.test test case is target independent. llvm-svn: 214085
* [PECOFF] Add /profile command line option.Rui Ueyama2014-07-253-0/+19
| | | | llvm-svn: 213984
* Fix unsafe memory accessRui Ueyama2014-07-251-2/+11
| | | | | | | | | | | | | | The following expression m[i] = m[j] where m is a DenseMap and i != j is not safe. m[j] returns a reference, which would be invalidated when a rehashing occurs. If rehashing occurs to make room for m[i], m[j] becomes invalid, and that invalid reference would be used as the RHS value of the expression. llvm-svn: 213969
* [mach-o] Add support for LC_DATA_IN_CODENick Kledzik2014-07-2411-25/+521
| | | | | | | | | | | | | | Sometimes compilers emit data into code sections (e.g. constant pools or jump tables). These runs of data can throw off disassemblers. The solution in mach-o is that ranges of data-in-code are encoded into a table pointed to by the LC_DATA_IN_CODE load command. The way the data-in-code information is encoded into lld's Atom model is that that start and end of each data run is marked with a Reference whose offset is the start/end of the data run. For arm, the switch back to code also marks whether it is thumb or arm code. llvm-svn: 213901
* [Mips] Replace assembler code by YAML to make the 'exe-dynsym.test' testSimon Atanasyan2014-07-241-14/+34
| | | | | | target independent. llvm-svn: 213868
* Change the signature of insertElementAt and rename addInputElementFrontRui Ueyama2014-07-243-20/+8
| | | | | | | | | | insertElementAt(x, END) does the identical thing as addInputElement(x), so the only reasonable use of insertElementAt is to call it with the other possible argument, BEGIN. That means the second parameter of the function is just redundant. This patch is to remove the second parameter and rename the function accordingly. llvm-svn: 213821
* [PECOFF] Simplify.Rui Ueyama2014-07-231-4/+2
| | | | | | insertElementAt(x, END) is the same as addInputElement(x). llvm-svn: 213818
* [PECOFF] Add the entry point file at the right place.Rui Ueyama2014-07-234-24/+33
| | | | | | | | | The entry point file needs to be processed after all other object files and before all .lib files. It was processed after .lib files. That caused an issue that the entry point function was not resolved from the standard library files. llvm-svn: 213804
* [PECOFF] Fix entry point address.Rui Ueyama2014-07-234-4/+19
| | | | | | | Because of a bug, the entry point address in the PE/COFF header was not correct. llvm-svn: 213802
* [PECOFF] Fix entry point functions selectionRui Ueyama2014-07-2311-121/+178
| | | | | | | | | | | | | | | | | | | | | On Windows there are four "main" functions -- main, wmain, WinMain, or wWinMain. Their parameter types are diffferent. The standard library provides four different entry functions (i.e. {w,}{WinMain,main}CRTStartup) for them. You need to use the right entry routine for your "main" function. If you give an /entry option, the specified name is used unconditionally. Otherwise, the linker needs to select the right one based on user-supplied entry point function. This can be done after the linker reads all the input files. This patch moves the code to determine the entry point function from the driver to a virtual input file. It also implements the correct logic for the entry point function selection. llvm-svn: 213713
* [mach-o] add initial support for modes in arm code.Nick Kledzik2014-07-236-7/+103
| | | | | | | | | This patch just supports marking ranges that are thumb code (vs arm code). Future patches will mark data and jump table ranges. The ranges are encoded as References with offsetInAtom being the start of the range and the target being the same atom. llvm-svn: 213712
* [mach-o] add support for round tripping all arm/thumb relocationsNick Kledzik2014-07-223-62/+471
| | | | | | | Update the parse-arm-relocs.yaml test case to run the linker back to back to ensure all relocations round trip in and out of mach-o. llvm-svn: 213700
* [PECOFF] Parameterize ResovalbeSymbols object.Rui Ueyama2014-07-222-10/+10
| | | | | | So that it can be shared by multiple input files. llvm-svn: 213699
* [PECOFF] Remember /noentry option so that later passes can handle it.Rui Ueyama2014-07-222-2/+12
| | | | | | | | | | This is a part of a larger change to move the entry point processing to a later pass than the driver. On Windows the default entry point function varies depending on user-provided functions. That means the driver is not able to correctly know the entry point function name. Only passes after the core linker can infer it. llvm-svn: 213697
* [Mips] Replace assembler code by YAML to make the 'entry-name.test' test targetSimon Atanasyan2014-07-221-13/+23
| | | | | | independent. llvm-svn: 213690
* [mach-o] Add test case for armv6 (arm not thumb) hello worldNick Kledzik2014-07-223-7/+101
| | | | llvm-svn: 213592
* [mach-o] add support for old x86 __eh_frame sectionsNick Kledzik2014-07-214-27/+369
| | | | | | | Over time the symbols and relocations have changed for dwarf unwind info in the __eh_frame section. Add test cases for older and new style. llvm-svn: 213585
* Fix lld build for llvm API changes committed in r213557David Blaikie2014-07-211-1/+1
| | | | llvm-svn: 213560
* [Mips] Fix typo in the comment.Simon Atanasyan2014-07-211-1/+1
| | | | llvm-svn: 213520
* [Mips] Replace assembler code by YAML to make the 'dynlib-fileheader.test'Simon Atanasyan2014-07-201-13/+43
| | | | | | test target independent. llvm-svn: 213480
* [Mips] Replace assembler code by YAML to make the test 'dynlib-dynamic.test'Simon Atanasyan2014-07-191-23/+84
| | | | | | target independent. llvm-svn: 213462
* [Mips] Replace assembler code by YAML to make the test 'base-address.test'Simon Atanasyan2014-07-181-13/+57
| | | | | | target independent. llvm-svn: 213390
* 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-182-30/+83
| | | | llvm-svn: 213344
* [mach-o] Add support for x86 CALL instruction that uses a scattered relocationNick Kledzik2014-07-182-50/+147
| | | | llvm-svn: 213340
* [mach-o] implement more x86 and x86_64 relocation supportNick Kledzik2014-07-179-107/+638
| | | | | | | | | 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-173-18/+5
| | | | 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-172-0/+9
| | | | | | | 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
* Update .gitignore to ignore hidden MacOSX Finder droppingsNick Kledzik2014-07-161-0/+2
| | | | llvm-svn: 213195
* [mach-o] refactor KindHandler into ArchHandler and simplify passes.Nick Kledzik2014-07-1633-2417/+2518
| | | | | | | | | | | 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-159-11/+93
| | | | | | | | | | | | | | | | | | 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
* [Mips] Fix test case expectations due the latest changes in the LLVM.Simon Atanasyan2014-07-148-59/+59
| | | | llvm-svn: 212949
* [Mips] Remove unused test input file.Simon Atanasyan2014-07-141-55/+0
| | | | llvm-svn: 212927
* [Mips] Make rel-dynamic-11.test test case independent from external input files.Simon Atanasyan2014-07-111-9/+35
| | | | llvm-svn: 212813
OpenPOWER on IntegriCloud