Commit Graph

85 Commits

Author SHA1 Message Date
Rui Ueyama 6be68525d0 Typedef uintX_t at beginning of a function just like others.
llvm-svn: 255853
2015-12-16 23:49:19 +00:00
Igor Kudrin b044af50f2 [ELF] Define symbols "_end" and "end" if referenced.
These symbols are expected to point to the end of the data segment.

Implements http://llvm.org/pr25528.

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

llvm-svn: 253637
2015-11-20 02:32:35 +00:00
Rui Ueyama 86696f38ea ELF2: Avoid bitwise-OR hack. NFC.
The previous code is too clever that that needs a bit more
brain power than this new code.

llvm-svn: 250934
2015-10-21 19:41:03 +00:00
Rui Ueyama 8f2c4da65a ELF2: Rename getMostConstrainingVisibility -> getVisibility. NFC.
The previous name was too long.

llvm-svn: 250920
2015-10-21 18:13:47 +00:00
Rui Ueyama aca48ffb41 ELF2: Inititalize other symbols only once as well.
llvm-svn: 249645
2015-10-08 00:44:28 +00:00
Rui Ueyama 833ce281db ELF2: Make member variable names shorter.
I'm going to use them in other patches, and the names feel too long
despite their narrow scope.

llvm-svn: 249642
2015-10-08 00:29:00 +00:00
Rui Ueyama 9ea49c7948 ELF2: Initialize SyntheticOptional only once.
llvm-svn: 249636
2015-10-07 23:46:11 +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 9d06ab6ded Rename Chunks.(h|cpp) to InputSection.(h|cpp). NFC.
llvm-svn: 248226
2015-09-22 00:01:39 +00:00
Rui Ueyama 6666f6ad73 ELF2: Reduce nesting by returning early. NFC.
llvm-svn: 247168
2015-09-09 17:55:09 +00:00
Rui Ueyama 7da94a58a0 ELF2: Return early. NFC.
llvm-svn: 247165
2015-09-09 17:40:51 +00:00
Rafael Espindola 18173d420e Start adding support for symbols in shared libraries.
llvm-svn: 247019
2015-09-08 15:50:05 +00:00
Michael J. Spencer 1b348a68e5 [elf2] Add basic archive file support.
llvm-svn: 246886
2015-09-04 22:28:10 +00:00
Rafael Espindola 78471f0ec1 Merge visibility from all symbols with the same name.
The ELF spec says:

... if any reference to or definition of a name is a symbol with a
non-default visibility attribute, the visibility attribute must be
propagated to the resolving symbol in the linked object. If different
visibility attributes are specified for distinct references to or
definitions of a symbol, the most constraining visibility attribute
must be propagated to the resolving symbol in the linked object. The
attributes, ordered from least to most constraining, are:
STV_PROTECTED, STV_HIDDEN and STV_INTERNAL.

llvm-svn: 246603
2015-09-01 23:12:52 +00:00
Rafael Espindola f31f9617ca Remember the maximum alignment used to refer to a common symbol.
llvm-svn: 246517
2015-09-01 01:19:12 +00:00
Rafael Espindola daa92a6193 Keep the largest common symbol.
This requires templating some functions over ELFT, but that opens other cleanup
opportunities for future patches.

llvm-svn: 246405
2015-08-31 01:16:19 +00:00
Rafael Espindola 30e1797b38 Turn resolution.s into an exhaustive testcase.
Now that we print a symbol table and all symbol kinds are at least declared,
we can test all combinations that don't produce an error.

This also includes a few fixes to keep the test passing:

* Keep the strong symbol in a weak X strong pair
* Handle common symbols.

The common X common case will be finished in a followup patch.

llvm-svn: 246401
2015-08-30 23:17:30 +00:00
Rafael Espindola 3a63f3fb22 Add support for weak absolute symbols.
On ELF being weak is independent of what we call the kind of the symbol. So
this also makes the code simpler.

llvm-svn: 246326
2015-08-28 20:19:34 +00:00
Rafael Espindola 0e0c1901c9 Start adding support for absolute symbols.
llvm-svn: 246147
2015-08-27 12:40:06 +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
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 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 df1e05a26c Delete broken code.
This was using a hard coded string table and getting it for every symbol.

The symbol name was already available.

llvm-svn: 244220
2015-08-06 15:33:21 +00:00
Rafael Espindola 49a2ca6ddd bar
llvm-svn: 244219
2015-08-06 15:33:19 +00:00
Rafael Espindola e3335d8a66 Delete dead code.
llvm-svn: 244040
2015-08-05 13:26:54 +00:00
Michael J. Spencer cdae0a4e2d [ELF2] Devirtualize SymbolBody.
llvm-svn: 243496
2015-07-28 22:58:25 +00:00
Rui Ueyama fdbbcdad87 ELF2: Inline very small functions.
llvm-svn: 243323
2015-07-27 20:39:04 +00:00
Rui Ueyama a7ccb2926f ELF2: Devirtualize SymbolBody::compare. NFC.
This is to make it consistent with COFF.

llvm-svn: 243321
2015-07-27 20:39:01 +00:00
Michael J. Spencer 84487f1174 [ELF2] Add a new ELF linker based on the new PE/COFF linker.
Differential Revision: http://reviews.llvm.org/D11188

llvm-svn: 243161
2015-07-24 21:03:07 +00:00
Michael J. Spencer bae540e945 Revert ELF port. Posting to mailing list.
llvm-svn: 242118
2015-07-14 04:49:48 +00:00
Michael J. Spencer f754b1fe12 Put explicit template instantiations in the correct namespace.
llvm-svn: 242093
2015-07-14 00:22:00 +00:00
Michael J. Spencer 8a4145411f Initial ELF port.
This is a direct port of the new PE/COFF linker to ELF.

It can take a single object file and generate a valid executable that executes at the first byte in the text section.

llvm-svn: 242088
2015-07-13 23:48:06 +00:00