Commit Graph

560 Commits

Author SHA1 Message Date
Eugene Leviant 41cf1f1aea [ELF] Fixed formatting. NFC
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@293278 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-27 11:06:23 +00:00
Eugene Leviant 2b9698d609 [ELF] Bypass section type check
Differential revision: https://reviews.llvm.org/D28761


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@293276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-27 11:01:43 +00:00
Rafael Espindola eea64b3d65 Implement -Map.
The format is not exactly the same as the one in bfd since bfd always
follows a linker script and prints it along.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@291958 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13 21:05:46 +00:00
Rafael Espindola ddc3065304 Allow mixing nobits and progbits.
The effect is that the nobits section gets space allocated on disk.

Both bfd and gold allow this with linker scripts. To try to keep
things simple in lld, always allow it for now.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@291795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12 19:16:15 +00:00
Rafael Espindola 21b2453572 Move code to the .cpp file. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@291113 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 14:52:46 +00:00
Rafael Espindola e5b8f92b1e Detemplate SectionKey. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@291110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 14:35:41 +00:00
Rafael Espindola d357714dfc Change which input sections we concatenate
After Mark's patch I was wondering what was the rationale for the ELF
spec requiring us to merge only sections with matching flags and
types. I tried emailing
https://groups.google.com/forum/#!forum/generic-abi, but looks like my
emails are not being posted (the list is probably moderated). I
emailed Cary Coutant instead.

Cary pointed out that the section was a late addition and didn't got
the scrutiny it deserved. Given that and the problems found by
implementing the letter of the standard, I propose changing lld to
merge all sections with the same name and issue errors if the types or
some critical flags are different.

This should allow an unmodified firefox linked with lld to run.

This also merges some code with the linkerscript path.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@291107 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 14:20:35 +00:00
Rui Ueyama 7f64678432 Simplify type of Config->SymbolOrderingFile.
That variable was of type DenseMap<StringRef, unsigned>, but the
unsigned numbers needed to be monotonicly increasing numbers because
the implementation that used the variable depended on that fact.
That was an implementation detail and shouldn't have leaked into Config.

This patch simplifies its type to std::vector<StringRef>.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@290151 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-20 01:51:08 +00:00
Rui Ueyama 54b01a52e8 Remove lld/Support/Memory.h.
I thought for a while about how to remove it, but it looks like we
can just copy the file for now. Of course I'm not happy about that,
but it's just less than 50 lines of code, and we already have
duplicate code in Error.h and some other places. I want to solve
them all at once later.

Differential Revision: https://reviews.llvm.org/D27819

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@290062 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-18 14:06:06 +00:00
Rui Ueyama ca7af8d122 Move Memory.{h,cpp} to lld/Support so that we can use them from COFF.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@289084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 18:31:13 +00:00
Rui Ueyama 818ed598b4 Factor out common code to a header.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 21:24:51 +00:00
Eugene Leviant 29a478d337 [ELF] Refactor target error messages
Differential revision: https://reviews.llvm.org/D27097


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@288114 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29 08:05:44 +00:00
Rui Ueyama 12ac8bcec8 Split MergeOutputSection::finalize.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287977 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-26 15:09:58 +00:00
Eugene Leviant 97afe704f0 [ELF] EhOutputSection improvements
Differential revision: https://reviews.llvm.org/D27098


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287914 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25 08:27:15 +00:00
Peter Smith 5313f87928 [ELF] Add terminating sentinel .ARM.exidx table entry
The .ARM.exidx table has an entry for each function with the first entry
giving the start address of the function, the table is sorted in ascending
order of function address. Given a PC value, the unwinder will search the
table for the entry that contains the PC value.
    
If the table entry happens to be the last, the range of the addresses that
the final unwinding table describes will extend to the end of the address
space. To prevent an incorrect address outside the address range of the
program matching the last entry we follow ld.bfd's example and add a
sentinel EXIDX_CANTUNWIND entry at the end of the table. This gives the
final real table entry an upper bound.
    
In addition the llvm libunwind unwinder currently depends on the presence
of a sentinel entry (PR31091).

Differential revision: https://reviews.llvm.org/D26977



git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287869 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24 11:43:55 +00:00
Eugene Leviant cc0968b937 [ELF] Print error location in .eh_frame parser
Differential revision: https://reviews.llvm.org/D26914


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287750 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 09:45:17 +00:00
Rui Ueyama d40c108aeb Move a function definition to SyntheticSections.cpp.
This should have been moved along with r287554.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 19:46:04 +00:00
Eugene Leviant 1ffdd61f32 [ELF] Convert Version*** sections to input sections
Differential revision: https://reviews.llvm.org/D26918


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287554 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 16:59:33 +00:00
Eugene Leviant 951d903ea2 [ELF] Convert EhFrameHeader to input section
Differential revision: https://reviews.llvm.org/D26906


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 15:52:10 +00:00
Eugene Leviant 0764264f85 [ELF] Convert GdbIndexSection to input section
Differential revision: https://reviews.llvm.org/D26854


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21 09:24:43 +00:00
Rui Ueyama 35d55ac2d3 Remove unused #include.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287467 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-19 23:18:43 +00:00
Rui Ueyama de8af2583b Change filler type from ArrayRef<uint8_t> to uint32_t.
Filler expressions in linker script "=fillexp" are always handled
as 32-bit integers. Thus the new type is more natural.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-19 18:05:56 +00:00
Rui Ueyama 675086e868 Simplify. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287372 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 19:45:04 +00:00
Rafael Espindola 4a77b8291a Simplify handling of SHF_LINK_ORDER.
It seems a lot simpler to just sort the sections and let the
relocations do the rest.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287365 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 19:02:15 +00:00
Eugene Leviant 7a8db8faeb [ELF] Convert PltSection to input section
Differential revision: https://reviews.llvm.org/D26842


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@287346 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 14:35:03 +00:00