Rui Ueyama
0db335fd5e
ELF2: Move functions out of line.
...
llvm-svn: 249566
2015-10-07 16:58:54 +00:00
George Rimar
97aad172b8
[ELF2] -z now option implemented
...
When generating an executable or shared library, mark it to tell the dynamic linker to resolve all symbols when the program is started, or when the shared library is linked to using dlopen, instead of deferring function call resolution to the point when the function is first called.
Differential Revision: http://reviews.llvm.org/D13468
llvm-svn: 249551
2015-10-07 15:00:21 +00:00
Denis Protivensky
1ef7b3ff55
[ELF2] Handle -m option
...
Parse and apply emulation given with -m option.
Check input files to match ELF type and machine architecture provided with -m.
Differential Revision: http://reviews.llvm.org/D13055
llvm-svn: 249529
2015-10-07 09:13:03 +00:00
Denis Protivensky
92aa1c02df
[ELF2] Fix gcc build error
...
llvm-svn: 249524
2015-10-07 08:21:34 +00:00
Rafael Espindola
cea0b3b45d
Don't create dynamic relocations for weak undefined symbols.
...
llvm-svn: 249520
2015-10-07 04:22:55 +00:00
Rafael Espindola
e782f673a8
Skip entries handled by the dynamic linker.
...
We were writing got entries in the first positions, not in the positions
corresponding to locally defined symbols.
llvm-svn: 249518
2015-10-07 03:56:05 +00:00
Rafael Espindola
c05ad3dedb
Create linker generated symbols earlier.
...
We were incorrectly deciding that a dynamic relocation was needed for them.
llvm-svn: 249512
2015-10-07 02:51:44 +00:00
Rafael Espindola
52dca345db
Create simpler dynamic relocations for local symbols in got.
...
If the symbol is not preemptable, we can use a R_X86_64_RELATIVE.
llvm-svn: 249496
2015-10-07 00:58:20 +00:00
Rui Ueyama
ee59282bfd
ELF2: Implement OUTPUT() linker script directive.
...
llvm-svn: 249491
2015-10-07 00:25:09 +00:00
Rafael Espindola
3378526f34
Fix typo.
...
llvm-svn: 249488
2015-10-07 00:15:43 +00:00
Rafael Espindola
a662738e02
Don't create dynamic relocations when its known what the got points to.
...
llvm-svn: 249485
2015-10-06 23:56:53 +00:00
Michael J. Spencer
f32446fb65
[elf2] Correctly determine if we should ignore missing __tls_get_addr.
...
llvm-svn: 249462
2015-10-06 20:39:09 +00:00
Davide Italiano
aad4402097
[ELF2] Address r249428 post comit review. Style + test trim.
...
llvm-svn: 249451
2015-10-06 20:02:15 +00:00
Michael J. Spencer
fcacad263a
[elf2] Fix style.
...
llvm-svn: 249450
2015-10-06 19:57:05 +00:00
Rui Ueyama
ee8c53bbe2
ELF2: Inline small functions.
...
llvm-svn: 249449
2015-10-06 19:57:01 +00:00
Rui Ueyama
b5fb88584a
ELF2: Update README.
...
llvm-svn: 249447
2015-10-06 19:21:13 +00:00
Davide Italiano
ef4be6b4fe
[ELF2/AArch64] Function names should start with a verb (lower case).
...
Pointed out by: Rafael Espindola.
llvm-svn: 249443
2015-10-06 19:01:32 +00:00
Rui Ueyama
87bc41bcee
ELF2: Use shorter names before this file grows larger.
...
llvm-svn: 249441
2015-10-06 18:54:43 +00:00
Rui Ueyama
33bb1a23b3
ELF2: or{16,32,64}le should really do bitwise-OR.
...
llvm-svn: 249436
2015-10-06 18:11:18 +00:00
Rui Ueyama
190beb3144
ELF2: Define or{16,32,64}le that are analogous to add32le.
...
llvm-svn: 249435
2015-10-06 18:08:03 +00:00
Davide Italiano
c39c75dee4
[ELF2] Implement --{enable, disable}-new-dtags options.
...
llvm-svn: 249428
2015-10-06 16:20:00 +00:00
Rafael Espindola
85a6e0f870
Never fetch members for weak undefined symbols.
...
We were still fetching them when the archive was seen first.
We should experiment with just letting lazy symbols get to compare, it
might be cleaner for ELF.
llvm-svn: 249417
2015-10-06 15:18:50 +00:00
Rafael Espindola
b90582dbbd
Avoid recursive calls to init (we would crash).
...
llvm-svn: 249412
2015-10-06 15:03:52 +00:00
Rafael Espindola
8614c566e2
Handle strong undefined symbols fetching members after a weak undefined.
...
This is a case that requires --start-group --end-group with regular ELF
linkers. Fortunately it is still possible to handle it with lazy symbols without
taking a second look at archives.
Thanks to Michael Spencer for the bug report.
llvm-svn: 249406
2015-10-06 14:33:58 +00:00
Rafael Espindola
6f4bd532d3
Rearrange a bit for clarity. NFC.
...
llvm-svn: 249404
2015-10-06 14:17:53 +00:00
Rafael Espindola
03ab3368a0
External symbols need a full dynamic reloc, not R_X86_64_RELATIVE.
...
We were already doing the right thing if the symbol was seen in a shared
library, but not if it was completely missing.
llvm-svn: 249397
2015-10-06 12:39:58 +00:00
George Rimar
d01ffbdb1b
Fixed typo
...
llvm-svn: 249393
2015-10-06 12:08:08 +00:00
Michael J. Spencer
6e78d16b3b
[elf2] Address style comments.
...
llvm-svn: 249368
2015-10-06 02:13:54 +00:00
Michael J. Spencer
95538ca99a
[elf2] Add __preinit_array, and __fini_array start and end symbols.
...
llvm-svn: 249367
2015-10-06 01:16:17 +00:00
Michael J. Spencer
4c46f57a49
[elf2] Ignore __tls_get_addr when static linking.
...
llvm-svn: 249365
2015-10-06 00:45:42 +00:00
Rafael Espindola
41127ad7af
Fix R_X86_64_RELATIVE for local symbols that refer to other sections.
...
We were mixing up the relocated and target sections.
llvm-svn: 249360
2015-10-05 22:49:16 +00:00
Davide Italiano
b4606e183e
[ELF2/AArch64] Read the right amount of bytes.
...
This was clearly wrong (thanks Rui for spotting), and I honestly would
like to get this tested so such mistakes won't repeat. Unfortunately, I
wasn't (easily) able to craft a test that exposes the bad behavior.
Ideally, we would like to get tests of this kind for all relocations, but
at the time of writing, this is not true. So, for now just fix this bug
and try to re-evaluate a way to test this in the future.
llvm-svn: 249359
2015-10-05 22:43:42 +00:00
Rafael Espindola
9c3e4d2af5
Handle a common symbol needing a R_X86_64_RELATIVE.
...
llvm-svn: 249357
2015-10-05 21:23:08 +00:00
Rafael Espindola
3c83e2bbfb
Include existing addend when computing R_X86_64_RELATIVE.
...
llvm-svn: 249353
2015-10-05 21:09:37 +00:00
Rafael Espindola
ae24400424
Create R_X86_64_RELATIVE when needed.
...
The dynamic relocation code needs refactoring, but it is probably better
to do it with this test passing.
llvm-svn: 249340
2015-10-05 19:30:12 +00:00
Rafael Espindola
d1cf421bd5
Don't copy STT_SECTION from the inputs.
...
This matches the behavior of gold and bfd ld.
llvm-svn: 249326
2015-10-05 16:25:43 +00:00
Igor Kudrin
024c84c77c
Remove an extra blank line.
...
llvm-svn: 249324
2015-10-05 16:05:18 +00:00
Rafael Espindola
4f674ed138
Include hidden and internal symbols in the regular symbol table.
...
This matches the behavior of bfd ld and gold. It is also convenient for
testing other changes.
llvm-svn: 249323
2015-10-05 15:24:04 +00:00
Igor Kudrin
b1f2b51a89
[ELF2] Add DT_INIT and DT_FINI dynamic table entries
...
The entries are added if there are "_init" or "_fini" entries in
the symbol table respectively. According to the behavior of ld,
entries are inserted even for undefined symbols.
Symbol names can be overridden by using -init and -fini command
line switches. If used, these switches neither add new symbol table
entries nor require those symbols to be resolved.
Differential Revision: http://reviews.llvm.org/D13385
llvm-svn: 249297
2015-10-05 10:29:46 +00:00
Denis Protivensky
22220d5d5f
[ELF2] Add --undefined option
...
Add symbol specified with -u as undefined which may cause additional
object files from archives to be linked into the resulting binary.
Differential Revision: http://reviews.llvm.org/D13345
llvm-svn: 249295
2015-10-05 09:43:57 +00:00
Davide Italiano
df88f968e3
[ELF2/AArch64] Add support for AARCH64_ABS{16,32,64} relocations.
...
I saw these in the wild while trying to link shared libraries.
llvm-svn: 249254
2015-10-04 00:59:16 +00:00
Davide Italiano
0b6974bfe0
[ELF/AArch64] Support R_AARCH64_ADR_PREL_PG_H121 relocation.
...
llvm-svn: 249246
2015-10-03 19:56:07 +00:00
Ed Maste
2c86fb4bde
Accept --dynamic-linker in addition to -dynamic-linker.
...
This matches what bfd ld accepts.
llvm-svn: 249234
2015-10-03 09:32:48 +00:00
Ed Maste
21e4e148c6
Add -rpath= alias for -rpath
...
llvm-svn: 249230
2015-10-03 06:54:24 +00:00
Davide Italiano
d9b5be4c83
[ELF/AArch64] Fix a couple of typos. My bad, sorry.
...
llvm-svn: 249201
2015-10-02 22:17:09 +00:00
Rui Ueyama
5713b8d0db
ELF2: Use less templates so that we can use struct assignment. NFC.
...
llvm-svn: 249200
2015-10-02 22:17:07 +00:00
Davide Italiano
318ca22914
[ELF2/AArch64] Add comment and change name to match the one of the ABI.
...
Fix style while I'm here.
llvm-svn: 249198
2015-10-02 22:13:51 +00:00
Davide Italiano
1f31a2c11c
[ELF2/AArch64] Add support for R_AARCH64_ADR_PREL_PG_H121
...
llvm-svn: 249195
2015-10-02 22:00:42 +00:00
Michael J. Spencer
ed3476b79f
[elf2] Add STB_GNU_UNIQUE support.
...
llvm-svn: 249193
2015-10-02 21:57:52 +00:00
Rui Ueyama
04dae558f4
ELF2: Make Writer::assignAddress() a bit shorter. NFC.
...
llvm-svn: 249190
2015-10-02 21:23:17 +00:00