| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
This would have fund a bug in a patch I am working on.
llvm-svn: 330925
|
|
|
|
| |
llvm-svn: 330892
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
When a symbol refers to a special section or a section that doesn't
exist, lld would fatal with "broken object file". This change gives a
different message for each scenario, and includes the name of the
file, name of the symbol, and the section being referred to.
Reviewers: pcc, ruiu
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46090
llvm-svn: 330883
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D46087
llvm-svn: 330879
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this patch:
Symbol 56
Defined 80
Undefined 56
SharedSymbol 88
LazyArchive 72
LazyObject 56
With this patch
Symbol 48
Defined 72
Undefined 48
SharedSymbol 80
LazyArchive 64
LazyObject 48
The result is that peak allocation when linking chromium (according to
heaptrack) goes from 578 to 568 MB.
llvm-svn: 330874
|
|
|
|
|
|
|
| |
This is not a big simplification right now, but the special cases for
lazy symbols have been a common source of bugs in the past.
llvm-svn: 330869
|
|
|
|
|
|
|
|
| |
It doesn't apply to DLLs, and link.exe doesn't set it.
Differential Revision: https://reviews.llvm.org/D46077
llvm-svn: 330868
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, LLD supports ASSERT as a separate command.
We support two forms now.
Assign expression-form: . = ASSERT(0x100)
(old GNU ld required it and some scripts in the wild are still using
something like . = ASSERT((_end - _text <= (512 * 1024 * 1024)), "kernel image bigger than KERNEL_IMAGE_SIZE");
Nowadays above is not a mandatory form and command-like form is commonly used:
ASSERT(<expr>, "text);
The return value of the ASSERT is Dot. That was implemented in D30171.
It looks like (2) is just a short version of (1) then.
GNU ld does *not* list ASSERT as a SECTIONS command:
https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS
Given above we probably can change ASSERT to be an assignment to Dot.
That makes the rest of the code much simpler. Patch do that.
Differential revision: https://reviews.llvm.org/D45434
llvm-svn: 330814
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fix is to copy Used when replacing the symbol.
Original message:
Do not keep shared symbols created from garbage-collected eliminated DSOs.
If all references to a DSO happen to be weak, and if the DSO is
specified with --as-needed, the DSO is not added to DT_NEEDED.
If that happens, we also need to eliminate shared symbols created
from the DSO. Otherwise, they become dangling references that point
to non-exsitent DSO.
Fixes https://bugs.llvm.org/show_bug.cgi?id=36991
Differential Revision: https://reviews.llvm.org/D45536
llvm-svn: 330788
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In a number of places in the COFF linker, we were calling
MemoryBuffer::getFile() with default parameters. This causes LLVM to
NUL-terminate the buffers, which can prevent them from being memory
mapped. Since we operate on binary and do not use NUL as an indicator
of the end of the file content, this change causes us to not require
the NUL terminator anymore.
Reviewers: ruiu, pcc
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45909
llvm-svn: 330786
|
|
|
|
| |
llvm-svn: 330785
|
|
|
|
|
|
| |
This would have found the issue in r329960.
llvm-svn: 330784
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D45795
llvm-svn: 330750
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out we should not use the std::sort anymore.
r327219 added a new wrapper llvm::sort (D39245).
When EXPENSIVE_CHECKS is defined, it shuffles the
input container and that helps to find non-deterministic
ordering.
Patch changes code to use llvm::sort and std::stable_sort
instead of std::sort
Differential revision: https://reviews.llvm.org/D45969
llvm-svn: 330702
|
|
|
|
|
|
|
|
|
|
|
| |
Our code for LazyObject and LazyArchive duplicates.
This patch extracts the common part to remove
the duplication.
Differential revision: https://reviews.llvm.org/D45516
llvm-svn: 330701
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With MSVC linker, /DEBUG is an alias of /DEBUG:FASTLINK, and if
you don't want /DEBUG:FASTLINK you have to explicitly specify
/DEBUG:FULL.
LLD doesn't support /DEBUG:FASTLINK, and so our standard /DEBUG
option is what MSVC calls /DEBUG:FULL. To provide command line
compatibility with MSVC, we should also support /DEBUG:FULL, and
since it's the same as what LLD already does for /DEBUG, just
alias it.
llvm-svn: 330647
|
|
|
|
|
|
|
| |
This patch also simplifies the code a bit which wasn't committed in
https://reviews.llvm.org/r330600.
llvm-svn: 330644
|
|
|
|
|
|
|
|
|
|
| |
The PPC64 V2 ABI restores the toc base by loading from an offset of 24 from r1.
This patch fixes the offset and updates the testcases from V1 to V2. It also
issues an error when a nop is missing after a call to an external function.
Differential Revision: https://reviews.llvm.org/D45892
llvm-svn: 330600
|
|
|
|
| |
llvm-svn: 330597
|
|
|
|
|
|
|
|
|
|
|
|
| |
incoming one
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D45905
llvm-svn: 330491
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
ubsan found that we sometimes pass nullptr to memcpy in
SectionChunk::writeTo(). This change adds a check that avoids that.
Reviewers: ruiu
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45789
llvm-svn: 330490
|
|
|
|
| |
llvm-svn: 330488
|
|
|
|
| |
llvm-svn: 330485
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D45804
llvm-svn: 330484
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D45803
llvm-svn: 330483
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D45902
llvm-svn: 330482
|
|
|
|
|
|
|
|
| |
It turns out that we were dropping this before.
Differential Revision: https://reviews.llvm.org/D45802
llvm-svn: 330481
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sections into output sections.
This is what link.exe does and lets us avoid needing to worry about
merging output characteristics while adding input sections to output
sections.
With this change we can't process /merge in the same way as before
because sections with different output characteristics can still
be merged into one another. So this change moves the processing of
/merge to just before we assign addresses. In the case where there
are multiple output sections with the same name, link.exe only merges
the first section with the source name into the first section with
the target name, and we do the same.
At the same time I also implemented transitive merging (which means
that /merge:.c=.b /merge:.b=.a merges both .c and .b into .a).
This isn't quite enough though because link.exe has a special case for
.CRT in 32-bit mode: it processes sections whose output characteristics
are DATA | R | W as though the output characteristics were DATA | R
(so that they get merged into things like constructor lists in the
expected way). Chromium has a few such sections, and it turns out
that those sections were causing the problem that resulted in r318699
(merge .xdata into .rdata) being reverted: because of the previous
permission merging semantics, the .CRT sections were causing the entire
.rdata section to become writable, which caused the SEH runtime to
crash because it apparently requires .xdata to be read-only. This
change also implements the same special case.
This should unblock being able to merge .xdata into .rdata by default,
as well as .bss into .data, both of which will be done in followups.
Differential Revision: https://reviews.llvm.org/D45801
llvm-svn: 330479
|
|
|
|
|
|
| |
during a test. Set the output path to avoid that problem.
llvm-svn: 330464
|
|
|
|
|
|
|
|
| |
It's possible to have an empty object file, for example if you
just compile an empty .c file. This file won't have any sections
so asserting that a file has chunks is definitely wrong.
llvm-svn: 330461
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Part of the DBI stream is a list of variable length structures
describing each module that contributes to the final executable.
One member of this structure is a section contribution entry that
describes the first section contribution in the output file for
the given module.
We have been leaving this structure unpopulated until now, so with
this patch it is now filled out correctly.
Differential Revision: https://reviews.llvm.org/D45832
llvm-svn: 330457
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D44311
llvm-svn: 330456
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D44313
llvm-svn: 330454
|
|
|
|
|
|
|
|
|
|
| |
Enables cleaning up confusion between which name variables are mangled
and which are unmangled, and --print-gc-sections then excersises and
tests that.
Differential Revision: https://reviews.llvm.org/D44440
llvm-svn: 330449
|
|
|
|
|
|
|
|
|
|
|
|
| |
--{start,end}-lib
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D45849
llvm-svn: 330443
|
|
|
|
|
|
|
| |
The test was passing on a big endian host, but just because od with x4
was compensating for it.
llvm-svn: 330386
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D45846
llvm-svn: 330379
|
|
|
|
|
|
|
|
|
|
|
| |
Relocation addends can be negative so should be written as
signed LEBs. This bug meant that writing value between 64
and 128 would be incorrectly interpreted as negative by the
object file readers.
Differential Revision: https://reviews.llvm.org/D45825
llvm-svn: 330374
|
|
|
|
|
|
|
| |
We have relatively few tests on the contents of non alloc
sections. This one would have found a bug in a patch I am working on.
llvm-svn: 330369
|
|
|
|
|
|
|
|
| |
All callers can just access the header directly.
Differential Revision: https://reviews.llvm.org/D45800
llvm-svn: 330367
|
|
|
|
|
|
|
|
|
|
| |
In an upcoming change I will need to make a distinction between section
type (code, data, bss) and permissions. The term that I use for both
of these things is "output characteristics".
Differential Revision: https://reviews.llvm.org/D45799
llvm-svn: 330361
|
|
|
|
|
|
|
| |
This is much simpler than the other section types and there are many
places where the section type is statically know.
llvm-svn: 330350
|
|
|
|
|
|
|
|
|
|
| |
Now that we don't ICF synthetic sections, we can go back to the old
logic on whose responsibility it is to check Repl.
The idea is that Sec->something() will not check Repl. It is the
responsibility of the caller to find the correct Sec.
llvm-svn: 330346
|
|
|
|
|
|
|
|
|
|
| |
We had a single symbol using -1 with a synthetic section. It is
simpler to just update its value.
This is not a big will by itself, but will allow having a simple
getOffset for InputSeciton.
llvm-svn: 330340
|
|
|
|
|
|
|
| |
Unlike the getOffset in the base class, this one computes the offset
in the parent synthetic section, not the final output section.
llvm-svn: 330339
|
|
|
|
|
|
|
|
| |
Using getOffset is here was a bit of an overkill. This is being
written and has relocations. This implies it is a .eh_frame or regular
section.
llvm-svn: 330307
|
|
|
|
|
|
| |
Just a bit faster.
llvm-svn: 330306
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
DLLs and executables with no exception handlers need to be marked with
IMAGE_DLL_CHARACTERISTICS_NO_SEH, even if they have a load config.
Discovered here when building Chromium with LLD on Windows:
https://crbug.com/833951
Reviewers: ruiu, mstorsjo
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45778
llvm-svn: 330300
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This change does three things:
- Try to find the file and line number of an undefined symbol
reference by reading codeview debug info.
- Try to find the name of the function or global variable with the
undefined symbol reference by searching the object file's symbol
table.
- Prints the information in the same style as the ELF linker.
Differential Revision: https://reviews.llvm.org/D45467
llvm-svn: 330235
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds profile guided layout using the Call-Chain Clustering (C³) heuristic
from https://research.fb.com/wp-content/uploads/2017/01/cgo2017-hfsort-final1.pdf .
RFC: [llvm-dev] [RFC] Profile guided section layout
http://lists.llvm.org/pipermail/llvm-dev/2017-June/114178.html
Pass `--call-graph-ordering-file <file>` to read a call graph profile where each
line has the format:
<from symbol> <to symbol> <call count>
Differential Revision: https://reviews.llvm.org/D36351
llvm-svn: 330234
|