Commit Graph

1432 Commits

Author SHA1 Message Date
Rui Ueyama 4eed0114c5 ELF2: Use 'a.out' as default output file name.
llvm-svn: 248831
2015-09-29 21:49:40 +00:00
Rafael Espindola 2d73648667 Update test to use invalid elf file in archives.
The code in driver is about to change so that the invalid files would no
longer be seen as ELF.

This makes sure that the error path will remain tested.

llvm-svn: 248820
2015-09-29 18:44:18 +00:00
Rui Ueyama 9d4c6d771b [ELF2] Implemented --entry flag.
Patch from George Rimar!

llvm-svn: 248806
2015-09-29 16:40:13 +00:00
Rafael Espindola 8acb95c7ab Add support for R_386_GOT32.
llvm-svn: 248799
2015-09-29 14:42:37 +00:00
Rafael Espindola be901e2dbc Don't apply a relocation if we create a dynamic reloc.
With RELA that is just wasteful, with REL the relocation gets applied
twice.

llvm-svn: 248795
2015-09-29 13:51:43 +00:00
Rafael Espindola 6d7fcdb518 Add R_386_GOTPC support.
llvm-svn: 248793
2015-09-29 13:36:32 +00:00
Simon Atanasyan 49829a1bfe [ELF2] Add initial MIPS support
Besides a trivial MIPS support the patch introduces new TargetInfo class
member getDefaultEntry() to override default name of the entry symbol.
MIPS uses __start for that.

Differential Revision:  http://reviews.llvm.org/D13227

llvm-svn: 248779
2015-09-29 05:34:03 +00:00
Lang Hames 9a4c94ec5a [lld][MachO] Fix a think-o to get the twolevel/dynamic_lookup test passing.
llvm-svn: 248736
2015-09-28 20:52:21 +00:00
Rafael Espindola 4b2ca85c1a Implement --allow-multiple-definition.
Patch by George Rimar!

llvm-svn: 248733
2015-09-28 20:30:11 +00:00
Lang Hames 5c692009bc [lld][MachO] Initial implementation of -flat_namespace and -undefined.
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
2015-09-28 20:25:14 +00:00
Rafael Espindola 085a8f5ea7 Don't include fully resolved relocations in the dynamic relocation table.
llvm-svn: 248731
2015-09-28 20:18:40 +00:00
Rafael Espindola 46e01554b1 Add support for got/ptl referring to symbols defined in .o files.
llvm-svn: 248730
2015-09-28 19:48:34 +00:00
Rafael Espindola dfc7200b18 Add support for local absolute symbols.
llvm-svn: 248726
2015-09-28 18:29:47 +00:00
Rui Ueyama c5e22d906b ELF2: Include file names in error messages.
llvm-svn: 248724
2015-09-28 18:20:41 +00:00
Igor Kudrin 1309fc0378 [ELF2] Add --sysroot command line switch
Reviewers: rafael, ruiu

Subscribers: llvm-commits

Projects: #lld

Differential Revision: http://reviews.llvm.org/D13209

llvm-svn: 248715
2015-09-28 15:01:59 +00:00
Rafael Espindola abb7b28686 Add support for -L and -l command line switches.
Patch by Igor Kudrin!

llvm-svn: 248708
2015-09-28 12:52:21 +00:00
Rafael Espindola 83af95d927 Enable the aarch64 tests.
llvm-svn: 248707
2015-09-28 12:22:25 +00:00
Davide Italiano 1d750a6fc3 [ELF2/AArch64] Support for R_AARCH64_ADR_PREL_LO21 relocation.
llvm-svn: 248679
2015-09-27 08:45:38 +00:00
NAKAMURA Takumi 00eecb88a4 lld/test/elf2/basic-aarch64.s should not REQUIRE x86.
FIXME: The feature "arm64" is not activated in lit.cfg.
llvm-svn: 248664
2015-09-26 09:21:58 +00:00
Davide Italiano f096e10a47 [ELF2] Spell llvm-readobj correctly.
llvm-svn: 248642
2015-09-26 00:43:49 +00:00
Davide Italiano cde9336717 [ELF2] Add initial AArch64 support.
Differential Revision:	http://reviews.llvm.org/D13167

llvm-svn: 248641
2015-09-26 00:32:04 +00:00
Tom Stellard d0626804fc ELF/AMDGPU: Text section should be called .hsatext
Reviewers: atanasyan, ruiu

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D12447

llvm-svn: 248621
2015-09-25 21:42:30 +00:00
Rafael Espindola 551dfd8818 Implement --noinhibit-exec.
Patch by George Rimar!

llvm-svn: 248605
2015-09-25 19:24:57 +00:00
Rafael Espindola 0e604f913a Add support for creating the symbols __init_array_start and __init_array_end.
llvm-svn: 248604
2015-09-25 18:56:53 +00:00
Rui Ueyama 548d22c073 COFF: ICF should not merge sectinos if their alignments are not the same.
There's actually a room to improve this patch. Instead of not merging
sections that have different alignements, we can choose the section that
has the largest alignment requirement among all sections that are otherwise
considered the same. Then all section alignments are satisfied, so we can
merge them.

I don't know if that improvement could make any difference for real-world
input, so I'll leave it alone. Would be interesting to revisit later.

llvm-svn: 248581
2015-09-25 16:50:12 +00:00
Rui Ueyama eeb22f8251 ELF2: Support reponse files.
http://reviews.llvm.org/D13148

llvm-svn: 248575
2015-09-25 15:37:33 +00:00
Davide Italiano aa7c533ec3 [ELF2] Fix binaries so they actually run on FreeBSD.
Since FreeBSD 4.1, the kernel expects binaries to be marked with
ELFOSABI_FREEBSD in the ELF header to exec() them. LLD unconditionally 
sets OSABI to ELF_OSABINONE, and everything linked with it won't run 
on FreeBSD (unless explicitly rebranded).

Example:
% ./aarch64-hello
ELF binary type "0" not known.
zsh: exec format error: ./aarch64-hello

FreeBSD could be modified to accept ELF_OSABINONE, but that would break all
existing binaries, so the kernel needs to support both ABINONE and ABIFREEBSD.
I plan to push this change in FreeBSD one day, which, unfortunately, is 
not today. This code patches lld so it sets the header field correctly.

For completeness, the rationale of this change is explained in the FreeBSD 
commit message, and it's apparently to pleasee binutils maintainers at the time.
https://svnweb.freebsd.org/base?view=revision&revision=59342

Differential Revision:	 http://reviews.llvm.org/D13140

llvm-svn: 248554
2015-09-25 01:59:13 +00:00
Davide Italiano d75d3b94fd [ELF2] Add support for -discard-none.
Differential Revision:	http://reviews.llvm.org/D13083

llvm-svn: 248499
2015-09-24 15:08:23 +00:00
Rafael Espindola e0f09fac78 Add a test covering ELFFile's constructor failing.
llvm-svn: 248498
2015-09-24 14:55:25 +00:00
Rafael Espindola d27adc42e6 Add support for the _GLOBAL_OFFSET_TABLE_ symbol.
llvm-svn: 248490
2015-09-24 13:34:01 +00:00
Rafael Espindola cdfecffd80 Add support for relocating R_X86_64_GOTPCREL.
llvm-svn: 248425
2015-09-23 20:08:25 +00:00
Rafael Espindola c2d211994d Create the .bss section early so that we don't have to set it after the fact.
llvm-svn: 248412
2015-09-23 18:25:05 +00:00
Rafael Espindola 6173f848b9 Print more information about undefined symbols.
llvm-svn: 248382
2015-09-23 14:37:01 +00:00
Rafael Espindola 8e5560d894 Don't complain about symbols showing up in multible shared libraries.
llvm-svn: 248381
2015-09-23 14:23:59 +00:00
Rafael Espindola 1a49e58181 Print more information about duplicated symbols.
llvm-svn: 248380
2015-09-23 14:10:24 +00:00
Davide Italiano a89d178a4f [ELF2] Add ASCII representation of the string table to test.
Requested by: rafael

llvm-svn: 248361
2015-09-23 01:56:26 +00:00
Rafael Espindola 1ab429bf49 Fix a last minuted edit that should not have been committed.
Sorry about that.

llvm-svn: 248349
2015-09-22 23:42:55 +00:00
Rafael Espindola 05a3dd2cba Implement --export-dynamic.
llvm-svn: 248347
2015-09-22 23:38:23 +00:00
Rafael Espindola 3efa4e982e Add a token ppc64 reloc just to have a test showing that we handle BE.
llvm-svn: 248321
2015-09-22 21:12:55 +00:00
Rafael Espindola 01205f79a4 Start adding target abstractions.
This is just enough to get PLT working on 32 bit x86.

The idea behind using a virtual interface is that it should be easy to
convert any of the functions to template parameters if any turns out to be
performance critical.

llvm-svn: 248308
2015-09-22 18:19:46 +00:00
Rafael Espindola 50534c2b6f Fix the creation of Elf_Rel sections.
We were always incrementing the output buffer pointer by sizeof(Elf_Rela).

llvm-svn: 248303
2015-09-22 17:49:38 +00:00
Davide Italiano 25423d42bd [MachO] Use llvm-readobj in lieu of macho-dump.
The latter will be removed from the tree anytime soon.

llvm-svn: 248300
2015-09-22 17:31:01 +00:00
Rafael Espindola a794fd44a1 Add support for R_386_PC32.
llvm-svn: 248275
2015-09-22 13:47:45 +00:00
Rafael Espindola 21585757e6 Handle implicit addends in Elf_Rel.
llvm-svn: 248272
2015-09-22 13:35:00 +00:00
Rui Ueyama 9640173e16 COFF: Add /nosymtab command line option.
This is an LLD extension to MSVC link.exe command line. MSVC linker
does not write symbol tables for executables. We do unless no /debug
option is given.

There's a situation that we want to enable debug info but don't want
to emit the symbol table. One example is when we are comparing output
file size. With this patch, you can tell the linker to not create
a symbol table by just specifying /nosymtab.

llvm-svn: 248225
2015-09-21 23:43:31 +00:00
Lang Hames c803442890 [LLD][MachO] Fix a FIXME: Subtract base address from atom address when building
export trie.

llvm-svn: 248217
2015-09-21 22:06:02 +00:00
Davide Italiano 8ca741d51d [ELF2] Support relocs for local symbols
Differential Revision:	 http://reviews.llvm.org/D12978

llvm-svn: 248196
2015-09-21 19:30:11 +00:00
Rafael Espindola eb79273158 Start adding support for PLT.
For now this doesn't support lazy symbol resolution, but is enough to link
and run a program with

jmp foo@PLT

llvm-svn: 248165
2015-09-21 15:11:29 +00:00
Davide Italiano 5445b2de50 [ELF2] Implement support for -discard-locals.
This is not on by default, but it may make sense to change it in future.

llvm-svn: 248133
2015-09-20 21:58:12 +00:00
Rui Ueyama 5f38915624 COFF: Fix ICF regression.
This patch fixes a regression introduced by r247964. Relocations that
are referring the same symbol should be considered equal, but they
were not if they were pointing to non-section chunks.

llvm-svn: 248132
2015-09-20 20:19:12 +00:00