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
Rui Ueyama
8bc43a142b
COFF: ARM: Fix relocations to thumb code.
...
Windows ARM is the thumb ARM environment, and pointers to thumb code
needs to have its LSB set. When we apply relocations, we need to
adjust the LSB if it points to an executable section.
llvm-svn: 243560
2015-07-29 19:25:00 +00:00
Rui Ueyama
56965f4b32
COFF: ARM: Fix DLL import table.
...
The previous test was testing -flavor link. This patch correctly
tests link2 and fixes a bug that we didn't emit import thunks.
llvm-svn: 243559
2015-07-29 19:24:58 +00:00
Rui Ueyama
308915ade2
COFF: Fix seh.test.
...
seh.test was testing -flavor link. This should have been testing
-flavor link2.
llvm-svn: 243557
2015-07-29 19:17:15 +00:00
Rui Ueyama
eb26e1d03c
COFF: Fix SECREL and SECTION relocations.
...
SECREL should sets the 32-bit offset of the target from the beginning
of *target's* output section. Previously, the offset from the beginning
of source's output section was used instead.
SECTION means the target section's index, and not the source section's
index. This patch fixes that issue too.
llvm-svn: 243535
2015-07-29 16:30:45 +00:00
Rui Ueyama
29f74c312a
COFF: Set load config table entry on non-x86.
...
llvm-svn: 243532
2015-07-29 16:30:31 +00:00
Michael J. Spencer
5a6f5f178e
[ELF2] Emit correct section types.
...
llvm-svn: 243509
2015-07-29 00:52:17 +00:00
Michael J. Spencer
8039dae26d
[ELF2] Emit section table.
...
llvm-svn: 243506
2015-07-29 00:30:10 +00:00
Rui Ueyama
506f6d1ae1
COFF: _tls_used is __tls_used on x86.
...
llvm-svn: 243495
2015-07-28 22:56:02 +00:00
Rui Ueyama
9420dee328
COFF: Fix export symbol names for x86.
...
I don't fully understand the rationale behind the name mangling
scheme used for the DLL export table and the import library.
Why only leading "_" is dropped for the import library while
both "_" and "@" are dropped from DLL symbol table? But this seems
to be what MSVC linker does.
llvm-svn: 243490
2015-07-28 22:34:24 +00:00
Rui Ueyama
cfb874a3d4
COFF: Do not ignore /merge if /debug is specified.
...
Previously, we ignore /merge option if /debug is specified
because I thought that was MSVC linker did. This was wrong.
/merge shouldn't be ignored even in debug mode.
llvm-svn: 243375
2015-07-28 03:24:23 +00:00