Simon Atanasyan
814b705984
[Mips] Use 'or' for move instead of [d]addu in PLT entries
...
Patch by Simon Dardis.
Differential Revision: http://reviews.llvm.org/D12103
llvm-svn: 245491
2015-08-19 20:20:10 +00:00
Rui Ueyama
7171c82194
COFF: Allow forward reference for weak externals
...
Previously, weak external symbols could reference only symbols that
appeared before them. Although that covers almost all use cases
of weak externals, there are object files out there which contains
weak externals that have forward references.
This patch supports such weak externals.
llvm-svn: 245258
2015-08-17 23:35:43 +00:00
Rui Ueyama
27716bb9d9
COFF: Fix a broken test.
...
This test couldn't be run more than once because lib.exe does not work
if the files already exist.
llvm-svn: 245214
2015-08-17 11:06:21 +00:00
Rui Ueyama
d157088adb
COFF: Fix the order of the DLL import entry.
...
There are some DLLs whose initializers depends on other DLLs'
initializers. The initialization order matters for them.
MSVC linker uses the order of the libraries from the command line.
LLD used ASCII-betical order. So they were incompatible.
This patch makes LLD compatible with MSVC.
llvm-svn: 245201
2015-08-17 08:30:31 +00:00
Rafael Espindola
1bd885aba4
ELF: Also record the type of undefined symbols.
...
Tested with a weak undefined. Testing with a plain undefined will have to wait
for support for -shared.
llvm-svn: 245069
2015-08-14 16:46:28 +00:00
Rafael Espindola
c44d17ad45
Add the type of the symbols to the symbol table.
...
For now only defined symbols are covered. I will add undefined ones in the
next patch.
llvm-svn: 245057
2015-08-14 15:10:49 +00:00
Rafael Espindola
383c323d4d
ELF: Set the correct symbol binding.
...
llvm-svn: 245049
2015-08-14 13:52:36 +00:00
Rafael Espindola
62b81b875a
Start populating the symbol table.
...
With this patch only the name is set. I will set the other fields shortly.
For now the table doesn't include local symbols. This is equivalent to using
--discard-all with gnu ld. This is OK for now since the symbols are not
needed for execution and for testing symbol resolution we only need the
global symbols.
llvm-svn: 245044
2015-08-14 13:07:05 +00:00
Peter Collingbourne
526ff15546
COFF: Introduce flag /opt:lldlto=N for controlling LTO optimization level.
...
Differential Revision: http://reviews.llvm.org/D12024
llvm-svn: 245027
2015-08-14 04:47:07 +00:00
Rafael Espindola
f763ca3c9c
ELF: Create a symbol table.
...
For now it is empty. I will add the symbols in a followup patch.
llvm-svn: 245008
2015-08-14 02:42:20 +00:00
Rafael Espindola
2db634d8f1
Correctly align output sections.
...
They don't need to be aligned to page boundaries. Only segments need that.
llvm-svn: 244942
2015-08-13 20:24:18 +00:00
Rafael Espindola
0160a281c2
Record the alignment of the output sections.
...
llvm-svn: 244941
2015-08-13 20:13:39 +00:00
Rafael Espindola
64e888ba5f
Set the file offset of zero sized sections.
...
There is no reason not to do it and this matches what gold and bfd ld do.
llvm-svn: 244929
2015-08-13 18:23:43 +00:00
Rafael Espindola
a7471795ae
Take name, type and flags in consideration when concatenating sections.
...
This is mandated by the ELF spec.
llvm-svn: 244911
2015-08-13 17:04:50 +00:00
Rafael Espindola
ef1ac01c2e
Don't give an address to sections that are not allocated.
...
llvm-svn: 244900
2015-08-13 15:31:17 +00:00
Rafael Espindola
abad6186c3
Place SHF_ALLOC sections first in the output.
...
Having them in the middle of the file complicates the creation of segments.
llvm-svn: 244898
2015-08-13 15:23:46 +00:00
Rafael Espindola
cde251370a
Include non-alloca sections in the link.
...
llvm-svn: 244895
2015-08-13 14:45:44 +00:00
Rafael Espindola
40dfae36fc
This test needs lib.exe.
...
llvm-svn: 244844
2015-08-13 00:03:47 +00:00
Denis Protivensky
0c8beb1c95
[LinkerScript] Process program header in PHDRS command
...
Add PT_PHDR segment depending on its availability in linker script's
PHDRS command, fallback if no linker script is given.
Handle FILEHDR, PHDRS and FLAGS attributes of program header.
Differential Revision: http://reviews.llvm.org/D11589
llvm-svn: 244743
2015-08-12 12:31:35 +00:00
Rafael Espindola
91009b3856
Fix the alignment of the section headers.
...
Thanks a lot to Rui for noticing it.
llvm-svn: 244711
2015-08-12 01:45:28 +00:00
Rafael Espindola
6b83b90b6a
ELF: Create a string table.
...
For now only the sections are in it, but it already makes the output easier
to read and test.
llvm-svn: 244702
2015-08-12 00:00:24 +00:00
Rui Ueyama
fa071e13aa
COFF: Align sections to 512-byte boundaries on disk.
...
Sections must start at page boundaries in memory, but they
can be aligned to sector boundaries (512-bytes) on disk.
We aligned them to 4096-byte boundaries even on disk, so we
wasted disk space a bit.
llvm-svn: 244691
2015-08-11 23:09:00 +00:00
Rafael Espindola
76e24ea955
Add support for weak undefined symbols.
...
llvm-svn: 244640
2015-08-11 17:57:05 +00:00
Rafael Espindola
b13df6582a
Add support for weak symbols.
...
llvm-svn: 244636
2015-08-11 17:33:02 +00:00
Rafael Espindola
7c388187c9
Don't report a conflict between two local symbols.
...
llvm-svn: 244624
2015-08-11 16:30:34 +00:00
Rafael Espindola
904c81dc9e
Add a test for our handling of shndx.
...
It was already working, but missing a test.
llvm-svn: 244477
2015-08-10 18:28:24 +00:00
Tom Stellard
01da42d8db
ELF: Correctly identify SHT_NOTE sections with !SHF_ALLOC as type*Note
...
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D11266
llvm-svn: 244317
2015-08-07 14:36:04 +00:00
Rafael Espindola
525d0bf0b9
On freebsd it is possible to open a directory. Test with another error.
...
llvm-svn: 244249
2015-08-06 19:12:03 +00:00
Rui Ueyama
6872455c6d
COFF: Make test commands shorter. NFC.
...
llvm-svn: 244227
2015-08-06 16:47:46 +00:00
Rui Ueyama
251b0e268b
COFF: Remove the old COFF linker and make link an alias to link2.
...
It's time to remove old COFF linker because the new one is now complete.
llvm-svn: 244226
2015-08-06 16:19:35 +00:00
Rafael Espindola
08c1df6a45
Bring test back but don't check the filesytem dependent error.
...
llvm-svn: 244218
2015-08-06 15:18:59 +00:00
Rafael Espindola
3b8018069e
For completeness, add a 64 bit big endian test.
...
llvm-svn: 244183
2015-08-06 00:00:50 +00:00
Rafael Espindola
1c2f64d1a6
Add a big endian testcase.
...
llvm-svn: 244173
2015-08-05 23:40:20 +00:00
Rafael Espindola
4280a96468
Handle writeImportLibrary failing.
...
We were printing an error but exiting with 0.
Not sure how to test this. We could add a no-winlib feature,
but that is probably not worth it.
llvm-svn: 244109
2015-08-05 20:03:57 +00:00
Rafael Espindola
ccd3adc60b
lit fixes for lld.
...
It was not using LLVM_LIT_TOOLS_DIR and at least on my VM never finding lib.exe.
With this all the COFF tests show up as supported and pass.
llvm-svn: 244107
2015-08-05 19:55:17 +00:00
Rui Ueyama
ba7c041f21
COFF: ARM: Implepment BLX23T relocation and fix Branch20T.
...
I fed the same test to MSVC linker and got the same output,
so I believe this implementation is correct.
llvm-svn: 244102
2015-08-05 19:40:07 +00:00
Rafael Espindola
4b7c2fc64e
Add bare minimum to get a working i386 linux program.
...
llvm-svn: 244050
2015-08-05 15:08:40 +00:00
Rafael Espindola
d39c8cd087
Rename asm tests to .s. NFC.
...
llvm-svn: 244037
2015-08-05 12:14:51 +00:00
Rafael Espindola
3c9cb4b3d3
lld elf2: Diagnose trying to mix incompatible files.
...
This is also a step in instantiating the writer with the correct template
argument.
llvm-svn: 244035
2015-08-05 12:03:34 +00:00
Rafael Espindola
87ee8dcb64
Use ELFOSABI_NONE. This matches both bfd ld and gold.
...
llvm-svn: 244033
2015-08-05 11:55:52 +00:00
Rafael Espindola
aefd5c1617
Create ObjectFile with the correct endian and word size.
...
The writer is still hard coded to 64 bits le, but with this we can test for
invalid ELF files.
llvm-svn: 243993
2015-08-04 15:45:54 +00:00
Simon Atanasyan
7a400d9af4
[Mips] Implement definition of the DT_MIPS_RLD_MAP_REL dynamic tag
...
llvm-svn: 243835
2015-08-01 14:53:49 +00:00
David Majnemer
bf1e5c0ee9
COFF: Reenable the lld test disabled in r243758.
...
llvm-svn: 243762
2015-07-31 17:41:11 +00:00
Reid Kleckner
60dde1fbda
Disable objdump disassembly test after r243755
...
Right now PE image section addresses are RVAs and symbol addresses are
VAs. We should probably fix this by changing section addresses to match
symbol addresses. Fixing this might take a few hours, so temporarily
disable the objdump part of this test.
llvm-svn: 243758
2015-07-31 16:41:23 +00:00
Peter Collingbourne
e7107ec03b
COFF: When resolving _load_config_used, add it as a GC root.
...
This fixes the cases where the symbol is defined in a comdat or by bitcode.
Differential Revision: http://reviews.llvm.org/D11673
llvm-svn: 243735
2015-07-31 05:33:34 +00:00
Rui Ueyama
7ed10b84cc
Remove trailing whitespace.
...
llvm-svn: 243683
2015-07-30 20:47:17 +00:00
David Majnemer
13ac40ea6e
COFF: Sort output sections which start with .debug to the end of the file
...
We want to convince the NT loader not to map these sections into memory.
A good first step is to move them to the end of the executable.
Differential Revision: http://reviews.llvm.org/D11655
llvm-svn: 243680
2015-07-30 20:26:55 +00:00
Simon Atanasyan
98a857140b
[Mips] Implement definition of DT_MIPS_RLD_MAP dynamic tag, .rld_map section, and __RLD_MAP symbol
...
llvm-svn: 243626
2015-07-30 07:45:55 +00:00
Michael J. Spencer
44fc1c0a73
[ELF2] Templatize addChunk and handle section flags.
...
llvm-svn: 243579
2015-07-29 22:14:50 +00:00
Rui Ueyama
ff88d5a26f
COFF: Add /safeseh command line option.
...
If /safeseh is specified, all input files must be compatible with Safe SEH.
llvm-svn: 243565
2015-07-29 20:25:40 +00:00