| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
llvm-svn: 292644
|
|
|
|
|
|
|
|
|
|
| |
Found that during attempts of linking linux kernel,
previously we partially duplicated code from getOutputSection(),
and it missed commons symbol case.
Differential revision: https://reviews.llvm.org/D28903
llvm-svn: 292594
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I found this when tried to link linux kernel with LLD:
https://github.com/torvalds/linux/blob/master/arch/x86/entry/vdso/vdso-layout.lds.S#L86
Output section command can have optional comma at the end:
.text : { *(.text*) } :text =0x90909090,
It was documented about 3 years ago for binutils:
https://sourceware.org/ml/binutils/2014-04/msg00045.html
Differential revision: https://reviews.llvm.org/D28803
llvm-svn: 292225
|
|
|
|
|
|
| |
Removed mentioning of checks. Sorry for noise.
llvm-svn: 292221
|
|
|
|
|
|
|
|
|
|
|
|
| |
Inputs shown in that testcase previously created
a huge temporarily file under 32 bits.
It was fixed by D28107. During review was suggested to
add a testcase even without CHECKs for documentation purposes.
Patch do that.
llvm-svn: 292220
|
|
|
|
|
|
|
|
|
|
|
| |
These were 3 last synthetics that were added in addPredefinedSections() instead
of createSyntheticSections(). Now it is possible to move addition to correct common place.
Also patch fixes testcase which discards .shstrtab, by restricting doing that.
Differential revision: https://reviews.llvm.org/D28561
llvm-svn: 291908
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is in preparation for my next change, which will introduce a relro
nobits section. That requires that relro sections appear at the end of the
progbits part of the r/w segment so that the relro nobits section can appear
contiguously.
Because of the amount of churn required in the test suite, I'm making this
change separately.
llvm-svn: 291523
|
|
|
|
|
|
|
|
| |
This patch allows for linker scripts to assign a new value
to a symbol that is already defined (either in an object file
or the linker script itself).
llvm-svn: 291459
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
llvm-svn: 291107
|
|
|
|
|
|
| |
Differential revision: https://reviews.llvm.org/D27194
llvm-svn: 290339
|
|
|
|
|
|
|
|
|
|
|
|
| |
From https://sourceware.org/binutils/docs/ld/File-Commands.html:
The file will be searched for in the current directory, and in any
directory specified with the -L option.
Patch done by Alexander Richardson.
Differential revision: https://reviews.llvm.org/D27831
llvm-svn: 290247
|
|
|
|
|
|
|
|
|
|
| |
Fixes http://llvm.org/PR31129
Patch by Alexander Richardson!
Differential Revision: https://reviews.llvm.org/D27848
llvm-svn: 289968
|
|
|
|
|
|
|
| |
--sort-section=xxx is the same as --sort-section xxx,
was found in one of FreeBSD ports.
llvm-svn: 289938
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PR31335 shows that we do that in next case:
SECTIONS { .text 0x2000 : {. = 0x100 ; *(.text) } }
though documentations says that "If . is used inside a section
description however, it refers to the byte offset from the start
of that section, not an absolute address. " looks does not work
as documented in bfd (as mentioned in comments for PR31335).
Until we find out the expected behavior was suggested at least not
to 'crash', what we do after trying to generate huge file.
Differential revision: https://reviews.llvm.org/D27712
llvm-svn: 289782
|
|
|
|
|
|
|
| |
It was pointed out in a post-commit review that the tests
were structured oddly. Fixed thusly.
llvm-svn: 289278
|
|
|
|
|
|
|
| |
These tests are disabled on Windows, but they seem to work just fine now,
so I'll enable them.
llvm-svn: 289251
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current implementation of the output section data store commands
can only handle integer literals, but it should really handle arbitrary
expressions [1]. This commit fixes that.
[1] https://sourceware.org/binutils/docs-2.27/ld/Output-Section-Data.html#Output-Section-Data
Differential Revision: https://reviews.llvm.org/D27561
llvm-svn: 289152
|
|
|
|
|
|
|
|
|
|
| |
linkerscript.s is the first test file for linker script, and at the moment
it contains all tests for linker scripts. Now that test file doesn't make
sense.
linkerscript2.s was just badly named. Renamed searchdir.s.
llvm-svn: 289148
|
|
|
|
| |
llvm-svn: 289146
|
|
|
|
|
|
| |
Found by inspection.
llvm-svn: 288970
|
|
|
|
|
|
|
|
|
|
|
| |
Minor patch to fix PR31288
OpenBSD commit:
https://github.com/openbsd/src/commit/d39116912b9536bd77326260dc5c6e593fd4ee24
Differential revision: https://reviews.llvm.org/D27458
llvm-svn: 288832
|
|
|
|
|
|
| |
Differential revision: https://reviews.llvm.org/D27335
llvm-svn: 288678
|
|
|
|
|
|
|
|
|
|
|
| |
sections from linkerscript.
This change continues what was started by D27040
Now all allocatable synthetics should be available from script side.
Differential revision: https://reviews.llvm.org/D27131
llvm-svn: 288150
|
|
|
|
|
|
| |
Differential revision: https://reviews.llvm.org/D27108
llvm-svn: 288019
|
|
|
|
|
|
|
|
|
| |
Unfortunatelly PT_ARM_EXIDX is special. There is no way to create it
from linker scripts, so we have to create it even if PHDRS is used.
This matches bfd and is required for the lld output to survive bfd's strip.
llvm-svn: 288012
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unfortunatelly some scripts look like
kernphys = ...
. = ....
and the expectation in that every orphan section is after the
assignment.
llvm-svn: 287996
|
|
|
|
|
|
|
|
| |
This is an horrible special case, but seems to match bfd's behaviour
and is important for avoiding placing an orphan section before the
expected start of the file.
llvm-svn: 287994
|
|
|
|
|
|
|
| |
This matches the behaviour of bfd ld. Using 0 was causing problems
with strip, which would remove these sections.
llvm-svn: 287969
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is important for cases like:
.sdata : {
*(.got.plt .got)
...
}
That was not supported before as there was no way to get access to
synthetic sections from script.
More details on review page.
Differential revision: https://reviews.llvm.org/D27040
llvm-svn: 287913
|
|
|
|
|
|
|
|
|
| |
Align to the large page size (known as a superpage or huge page).
FreeBSD automatically promotes large, superpage-aligned allocations.
Differential Revision: https://reviews.llvm.org/D27042
llvm-svn: 287782
|
|
|
|
|
|
|
|
| |
GNU LD allows `ASSERT` commands to be in output section descriptions.
Note that LD also mandates that `ASSERT` commands in this context must
end with a semicolon.
llvm-svn: 287677
|
|
|
|
| |
llvm-svn: 287595
|
|
|
|
|
|
|
| |
Config->MaxPageSize is what we use for the segment alignment, so that
is the one that we have to use for placing the header.
llvm-svn: 287569
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the linker script has SECTIONS, the address computation is now
always done in LinkerScript::assignAddresses, like for any other
section.
Before fixHeaders would do a tentative computation that
assignAddresses would sometimes override.
This patch also splits the cases where assignAddresses needs to add
the headers to the first PT_LOAD and the address computation. The net
effect is that we no longer create an empty page for no reason in the
included test case, which matches bfd behavior.
llvm-svn: 287565
|
|
|
|
|
|
| |
Differential revision: https://reviews.llvm.org/D26795
llvm-svn: 287547
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
LLD's error messages contain line numbers, function names or section names.
Currently they are formatter as follows.
foo.c (32): symbol 'foo' not found
foo.c (function bar): symbol 'foo' not found
foo.c (.text+0x1234): symbol 'foo' not found
This patch changes them so that they are consistent with Clang's output.
foo.c:32: symbol 'foo' not found
foo.c:(function bar): symbol 'foo' not found
foo.c:(.text+0x1234): symbol 'foo' not found
Differential Revision: https://reviews.llvm.org/D26901
llvm-svn: 287537
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I hit an internal linker script that was defining _DYNAMIC instead of
letting the linker do it. It turns out that both bfd and gold allow
that.
This is pretty easy to implement, just make the linker defined symbol
weak. This should have no impact in the case where there is no user
defined symbol: The visibility is hidden, which causes the output to
still be local.
llvm-svn: 287260
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Linker script doesn't create a section if it has no content. So the following
script doesn't create .norelocs section if it doesn't have any .rel* sections.
.norelocs : { *(.rel*) }
Later, if you assert that the size of .norelocs is 0, LLD printed out
an error message, because it didn't allow calling SIZEOF() on nonexistent
sections.
This patch allows SIZEOF() on nonexistent sections, so that you can do
something like this.
ASSERT(SIZEOF(.norelocs), "shouldn't contain .rel sections!")
Note that this behavior is compatible with GNU.
Differential Revision: https://reviews.llvm.org/D26810
llvm-svn: 287257
|
|
|
|
| |
llvm-svn: 287225
|
|
|
|
|
|
|
|
|
| |
This allows making symbols containing ADDR(section) synthetic,
and defining synthetic symbols outside SECTIONS block.
Differential revision: https://reviews.llvm.org/D25441
llvm-svn: 287090
|
|
|
|
| |
llvm-svn: 287009
|
|
|
|
|
|
|
|
|
|
| |
Propagate program headers by walking the commands, not the
sections. This allows us to propagate program headers even from
sections that don't end up in the output.
Fixes pr30997.
llvm-svn: 286837
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch adds a ".comment" section to an output. The comment
section contains the linker's version string. You can now
find out whether a binary is created by LLD or not using objdump
command like this.
$ objdump -s -j .comment foo
foo: file format elf64-x86-64
Contents of section .comment:
0000 00474343 3a202855 62756e74 7520342e .GCC: (Ubuntu 4.
0010 382e342d 32756275 6e747531 7e31342e 8.4-2ubuntu1~14.
...
00c0 766d2f74 72756e6b 20323835 38343629 vm/trunk 285846)
00d0 004c696e 6b65723a 204c4c44 20342e30 .Linker: LLD 4.0
00e0 2e302028 7472756e 6b203238 36343036 .0 (trunk 286406
00f0 2900 ).
Compilers emits .comment section as well, so the output contains
both compiler and linker information.
Alternative considered:
I first tried to add a SHT_NOTE section because GNU gold does that.
A NOTE section starts with a header which contains content type.
It turned out that ld.gold sets type NT_GNU_GOLD_VERSION to their
NOTE section. So the NOTE type is only for GNU gold (surprise!)
Next, I tried to create ".linker-version" section. However, it seems
that reusing the existing ".comment" section is better because 1)
other tools already know about .comment section and is able to strip
it and 2) the result contans not only linker info but also compiler
info.
Differential Revision: https://reviews.llvm.org/D26487
llvm-svn: 286496
|
|
|
|
| |
llvm-svn: 286226
|
|
|
|
|
|
| |
Differential revision: https://reviews.llvm.org/D25325
llvm-svn: 286225
|
|
|
|
|
|
|
|
|
|
|
|
| |
A CommonInputSection is a section containing all common symbols.
That was an input section but was abstracted in a different way
than the synthetic input sections because it was written before
the synthetic input section was invented.
This patch rewrites CommonInputSection as a synthetic input section
so that it behaves better with other sections.
llvm-svn: 286053
|
|
|
|
|
|
| |
<N> where "foo (<N>)" is the offset of string "foo" in the string table.
llvm-svn: 285751
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch we keep track of the fact that . is a position in the
file and therefore not absolute. This allow us to compute relative
relocations that involve symbol that are defined in linker scripts
with '.'.
This fixes https://llvm.org/bugs/show_bug.cgi?id=30406
There is still more work to track absoluteness over the various
expressions, but this should unblock linking the EFI bootloader.
llvm-svn: 285641
|
|
|
|
|
|
|
|
|
|
| |
We parse linker scripts very early, but whether an expression is
absolute or not can depend on a symbol defined in a .o. Given that, we
have to delay the computation of IsAbsolute. We can do that by storing
an AST when parsing or by also making IsAbsolute a function like we do
for the expression value. This patch implements the second option.
llvm-svn: 285628
|
|
|
|
| |
llvm-svn: 285621
|