Commit Graph

1933 Commits

Author SHA1 Message Date
Simon Atanasyan 5ecadda642 [Mips] Replace assembler code by YAML to make the test 'dynlib-dynamic.test'
target independent.

llvm-svn: 213462
2014-07-19 20:18:46 +00:00
Simon Atanasyan f7ce3ea024 [Mips] Replace assembler code by YAML to make the test 'base-address.test'
target independent.

llvm-svn: 213390
2014-07-18 17:23:21 +00:00
Artyom Skrobov 7a86a548b9 swapStruct extracted into include/llvm/Support/MachO.h (no functional change)
llvm-svn: 213362
2014-07-18 09:28:10 +00:00
Nick Kledzik 7e246a47f9 [mach-o] Add support for x86 pointers which use scattered relocations
llvm-svn: 213344
2014-07-18 01:05:35 +00:00
Nick Kledzik 68a1abdf14 [mach-o] Add support for x86 CALL instruction that uses a scattered relocation
llvm-svn: 213340
2014-07-18 00:37:52 +00:00
Nick Kledzik 2d432353ba [mach-o] implement more x86 and x86_64 relocation support
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
2014-07-17 23:16:21 +00:00
Joerg Sonnenberger bbe75b99f0 References cannot be bound to null.
llvm-svn: 213323
2014-07-17 22:30:09 +00:00
Rui Ueyama f2dcc9139b [PECOFF] Split ExportedSymbolRenameFile.
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
2014-07-17 22:17:10 +00:00
Rui Ueyama 9ec7e659d8 Remove all uses of llvm::function_ref from LLD.
llvm-svn: 213313
2014-07-17 21:33:21 +00:00
Rui Ueyama d5ba2a6994 Use std::function instead of llvm::function_ref.
llvm-svn: 213312
2014-07-17 21:23:52 +00:00
Simon Atanasyan c2d8d6d489 [Mips] s/context/ctx/ for consistency and reduce lines lengths.
No functional changes.

llvm-svn: 213310
2014-07-17 20:57:54 +00:00
Rui Ueyama 286691ad5e [PECOFF] Set DLL bit in PE header if DLL.
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
2014-07-17 00:22:26 +00:00
Nick Kledzik 9185115abb Update .gitignore to ignore hidden MacOSX Finder droppings
llvm-svn: 213195
2014-07-16 21:01:17 +00:00
Nick Kledzik 2458bec7e7 [mach-o] refactor KindHandler into ArchHandler and simplify passes.
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
2014-07-16 19:49:02 +00:00
Simon Atanasyan 64c0ac2b35 [ELF] Implement parsing `-l` prefixed items in the `GROUP` linker script 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
2014-07-15 17:17:30 +00:00
Simon Atanasyan 35ad71adad [Mips] Fix test case expectations due the latest changes in the LLVM.
llvm-svn: 212949
2014-07-14 15:31:47 +00:00
Simon Atanasyan 355f7ed602 [Mips] Remove unused test input file.
llvm-svn: 212927
2014-07-14 08:54:40 +00:00
Simon Atanasyan c97126b1c9 [Mips] Make rel-dynamic-11.test test case independent from external input files.
llvm-svn: 212813
2014-07-11 13:42:04 +00:00
Rui Ueyama aea2bcf559 [PECOFF] s/context/ctx/ for consistency.
llvm-svn: 212766
2014-07-10 21:55:28 +00:00
Rui Ueyama 8cb0f1e3c0 [PECOFF] Set resource table entry in header.
The resource table entry should have the RVA of the
embedded resource file.

llvm-svn: 212765
2014-07-10 21:43:19 +00:00
Rui Ueyama 31fd9d09b2 [PECOFF] Invoke cvtres.exe in the driver.
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
2014-07-10 20:53:37 +00:00
Simon Atanasyan d092f0e64a [Mips] Make rel-dynamic-10.test test case independent from external input files.
llvm-svn: 212758
2014-07-10 19:47:23 +00:00
Tim Northover 73c532e8a9 [mach-o]: support -Z option to skip standard library paths
llvm-svn: 212713
2014-07-10 11:46:13 +00:00
Tim Northover 18af0573df [mach-o]: support user-specified (-L) library search paths
llvm-svn: 212712
2014-07-10 11:46:08 +00:00
Tim Northover 77d82202d1 [mach-o]: support -syslibroot and -l options
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
2014-07-10 11:21:06 +00:00
Nick Kledzik 0edfdeb0be Move GOTPass and StubsPass from Core to MachO
llvm-svn: 212652
2014-07-09 21:04:24 +00:00
Tim Northover b44143f496 [all]: Use range-based ArgList adapter instead of filtered_begin/filtered_end
Some of those loops were pretty monstrous.

llvm-svn: 212616
2014-07-09 13:03:54 +00:00
Simon Atanasyan 0acd5447b4 [Mips] Make rel-dynamic-08.test test case independent from external input files.
llvm-svn: 212613
2014-07-09 12:31:11 +00:00
Nick Kledzik 2552a09978 Change llvm-nm to use -M instead of -s to work with latest llvm-nm
llvm-svn: 212579
2014-07-09 00:25:52 +00:00
Rui Ueyama 39dc40af07 [PECOFF] Fix .bss section alignment
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
2014-07-08 23:11:01 +00:00
Simon Atanasyan e693e8f8f0 [Mips] Make rel-dynamic-07.test test case independent from external input files.
llvm-svn: 212542
2014-07-08 15:47:55 +00:00
Simon Atanasyan 49eafe909b [Mips] Make rel-dynamic-05.test test case independent from external input files.
llvm-svn: 212480
2014-07-07 20:14:49 +00:00
Simon Atanasyan 611b7a11b5 [Mips] Make rel-dynamic-04.test test case independent from external input files.
llvm-svn: 212409
2014-07-06 17:44:40 +00:00
Rafael Espindola c2199ecf1e Update for llvm api change.
llvm-svn: 212407
2014-07-06 17:43:22 +00:00
Iain Sandoe 9734a53cf0 Fix build of DriverTests for config & make.
This adjusts the USED library list following recent changes in the object
file heirarchy.

llvm-svn: 212400
2014-07-06 11:28:56 +00:00
Rafael Espindola 22c187be1d Update for llm api change.
llvm-svn: 212372
2014-07-05 11:39:02 +00:00
Simon Atanasyan 778c029e04 Remove redundant "Standard: Cpp11" tag. The LLVM style has used the
Cpp11 standard since r202637.

llvm-svn: 212336
2014-07-04 12:08:03 +00:00
Nick Kledzik 4576c115ac [mach-o] Add parsing of arm/thumb relocations
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
2014-07-04 00:11:09 +00:00
Tim Northover ca2e63daf8 [mach-o]: remove dylib install-name test with a.out
Unfortunately, the creation of (the default) output file, a.out races with all
the other tests in this directory. When the wrong one is read by macho-dump,
the test fails.

llvm-svn: 212269
2014-07-03 12:50:23 +00:00
Nick Kledzik b6e8ce8250 [mach-o] add x86 test case to build hello world. Fix bugs it uncovered.
llvm-svn: 212247
2014-07-03 02:01:21 +00:00
Nick Kledzik cd2e17bd9c [mach-o] Fix warning on enumeration cases not handled
llvm-svn: 212241
2014-07-03 00:13:26 +00:00
Nick Kledzik de0860aae4 [mach-o] add parsing of x86 relocations
llvm-svn: 212239
2014-07-02 23:52:22 +00:00
Rui Ueyama 408d4d470d Add missing dependency to macho-dump.
r212094 added a few tests that use macho-dump.

llvm-svn: 212200
2014-07-02 18:16:31 +00:00
Tim Northover 9bdf90e5c2 [mach-o]: make the default dylib install-name the output filename.
llvm-svn: 212094
2014-07-01 08:41:45 +00:00
Tim Northover 301c4e690a [mach-o] add representation for LC_ID_DYLIB to MachONormalizedFile
It still needs to be tied into BinaryReader, but this allows reasonably
sensible creation of SharedLibrary atoms on MachO.

llvm-svn: 212093
2014-07-01 08:15:41 +00:00
Nick Kledzik 378066c80e [mach-o] improve errors when mixing architectures
llvm-svn: 212072
2014-06-30 22:57:33 +00:00
Nick Kledzik b201cf8883 [mach-o] x86_64 relocation code review fixes
llvm-svn: 212068
2014-06-30 20:44:47 +00:00
Tim Northover b5bf686b58 MachO: stop iterating past the end of an array
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
2014-06-30 10:30:00 +00:00
Tim Northover 9ee9935358 MachO: re-enable writing of compact-unwind sections.
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
2014-06-30 09:49:37 +00:00
Tim Northover 7b0a1306b4 MachO: align segment virtual addresses to page size.
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
2014-06-30 09:49:33 +00:00