Rafael Espindola
29e8d343e4
Rename addSectionChunk to addChunk now that it can handle any Chunk.
...
llvm-svn: 244919
2015-08-13 17:35:13 +00:00
Rafael Espindola
375a508234
Pass the type and flags to the OutputSection constructor. NFC.
...
This will allow further cleanups.
llvm-svn: 244918
2015-08-13 17:32:30 +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
674b5d570f
Store the offset in the output section, no in the file.
...
That is the value that is stable as the we layout the output sections.
llvm-svn: 244904
2015-08-13 15:54:36 +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
25f51850a4
Delete dead code.
...
llvm-svn: 244896
2015-08-13 14:48:49 +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
f0461ba985
Update for llvm api change.
...
llvm-svn: 244856
2015-08-13 01:07:08 +00:00
Rafael Espindola
bdc8f2fb83
Update for llvm api change.
...
llvm-svn: 244849
2015-08-13 00:31:46 +00:00
Rafael Espindola
40dfae36fc
This test needs lib.exe.
...
llvm-svn: 244844
2015-08-13 00:03:47 +00:00
David Blaikie
a3191ef66b
Wdeprecated: Remove unnecessary user-defined dtor that was getting in the way of the default ops (copy construction, assignment, etc)
...
llvm-svn: 244836
2015-08-12 23:26:58 +00:00
Rafael Espindola
372889a8e6
Fix an use of uninitialized.
...
Should fix some tests on windows.
llvm-svn: 244834
2015-08-12 23:25:42 +00:00
Denis Protivensky
90512d5440
[ELF] Remove TargetLayout::getCustomSegments methods
...
llvm-svn: 244747
2015-08-12 13:27:27 +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
4f89fdad9f
ELF2: Make Defined{Regular,Weak} ctors look the same as other SymbolBody ctors.
...
llvm-svn: 244701
2015-08-11 23:37:25 +00:00
Rafael Espindola
021834046f
Template ELF's OutputSection.
...
This removes what I think is the last hard coded ELF64 structure.
llvm-svn: 244700
2015-08-11 23:34:29 +00:00
Rafael Espindola
52a0f1e8c6
Move more code that is local to Writer.cpp to an anonymous namespace.
...
llvm-svn: 244697
2015-08-11 23:22:24 +00:00
Rafael Espindola
5211c2a1a0
Delete dead code.
...
llvm-svn: 244696
2015-08-11 23:19:06 +00:00
Rafael Espindola
98f6bd09e4
Be a bit more consistent about using uintX_t for offsets and sizes. NFC.
...
llvm-svn: 244694
2015-08-11 23:14:13 +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
Rui Ueyama
880632c458
ELF2: Remove unused global variable.
...
A global variable "Driver" is to re-entry to the driver to parse a
.drectve section. Because the need is COFF-specific, we don't need
this variable for ELF.
llvm-svn: 244680
2015-08-11 21:45:55 +00:00
Reid Kleckner
f7b85e0ce2
Fix mismatched sign comparison
...
llvm-svn: 244653
2015-08-11 20:06:51 +00:00
Rafael Espindola
76e24ea955
Add support for weak undefined symbols.
...
llvm-svn: 244640
2015-08-11 17:57:05 +00:00
Rafael Espindola
791e9f9c59
Remove unused templating.
...
llvm-svn: 244639
2015-08-11 17:51:57 +00:00
Rafael Espindola
b13df6582a
Add support for weak symbols.
...
llvm-svn: 244636
2015-08-11 17:33:02 +00:00
Rafael Espindola
ae1b23bd61
Use real values for DefindeFirst and DefinedLast.
...
With this clang notices that switches are fully covered.
llvm-svn: 244632
2015-08-11 17:10:02 +00:00
Rafael Espindola
9247f165ff
Delete unused typedef.
...
llvm-svn: 244628
2015-08-11 16:55:28 +00:00
Rui Ueyama
3c4737db54
COFF: Ignore /editandcontinue option.
...
llvm-svn: 244626
2015-08-11 16:46:08 +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
Rui Ueyama
bc9891f01d
COFF: Update README.
...
It's no longer "new" because the old COFF linker has been removed.
Update the introduction accordingly.
llvm-svn: 244565
2015-08-11 03:44:51 +00:00
Rui Ueyama
857b30356f
Move file-local classes to an anonymous namespace. NFC.
...
llvm-svn: 244525
2015-08-10 23:02:57 +00:00
Rafael Espindola
b61d67cf89
Update for llvm api change.
...
llvm-svn: 244511
2015-08-10 21:30:13 +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
Rafael Espindola
d8340dae0c
Don't depend on getDotSymtabSec. It is going away.
...
llvm-svn: 244451
2015-08-10 15:12:17 +00:00
Rui Ueyama
107db55ac4
COFF: Define symbols for MSVC 2015 Control Flow Protection.
...
MSVC 2015's load configuration object (__load_config_used) contains
references to these symbols. I don't fully understand how it works,
but looks like these symbols are linker-defined ones. So I define them
here in the Driver. With this patch, LLD can self-host with MSVC 2015.
This patch is to link MSVC 2015-produced object files. It does not
implement Control Flow Protection. If I understand correctly, the
linker has to create a bitmap of function entry point addresses for
the CFG runtime. We don't do that yet. Produced executables will not
be protected by CFG.
llvm-svn: 244425
2015-08-09 21:01:06 +00:00
Rui Ueyama
27e470abae
COFF: Do not fall through if /lib is processed.
...
llvm-svn: 244424
2015-08-09 20:45:17 +00:00
Rui Ueyama
234afc4a0e
Remove unused `using`.
...
llvm-svn: 244422
2015-08-09 20:38:58 +00:00
Rui Ueyama
611add25e3
COFF: Simplify.
...
SymbolTable::find(mangle(X)) is equivalent to SymbolTable::findUnderscore(X)
except that the latter is slightly efficient as that doesn't allocate a new
string.
llvm-svn: 244377
2015-08-08 00:23:37 +00:00
Rui Ueyama
8ebdc8cedc
COFF: Handle _load_config_used in the same way as other special symbols.
...
Handling the symbol this way is consistent with other symbols, such as
_tls_used. NFC.
llvm-svn: 244367
2015-08-07 22:43:53 +00:00
Rui Ueyama
237c8ff796
Remove unused variable.
...
llvm-svn: 244365
2015-08-07 22:40:13 +00:00
Rui Ueyama
8c484af217
COFF: Remove lld-link2 alias.
...
llvm-svn: 244358
2015-08-07 21:02:36 +00:00
Rafael Espindola
b6aa962e42
Avoid using getDotDynSymSec in lld. It is going away.
...
llvm-svn: 244350
2015-08-07 20:01:24 +00:00
Rafael Espindola
1a9344fa26
Use already available symbol tables. NFC.
...
llvm-svn: 244336
2015-08-07 17:16:28 +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
Rui Ueyama
1574b8ecfb
COFF: Update a comment.
...
llvm-svn: 244258
2015-08-06 19:57:21 +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