Age | Commit message (Collapse) | Author |
|
yaml2obj doesn't create .symtab by default anymore.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375360 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Also changes the wasm YAML format to reflect the possibility of having
multiple return types and to put the returns after the params for
consistency with the binary encoding.
Reviewers: aheejin, sbc100
Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, arphaman, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69156
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375283 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This fixes the second part of PR42407.
For files with dwarf debug info, it manually loads and iterates
.debug_info to find the declared location of variables, to allow
reporting them. (This matches the corresponding code in the ELF
linker.)
For functions, it uses the existing getFileLineDwarf which uses
LLVMSymbolizer for translating addresses to file lines.
In object files with codeview debug info, only the source location
of duplicate functions is printed. (And even there, only for the
first input file. The getFileLineCodeView function requires the
object file to be fully loaded and initialized to properly resolve
source locations, but duplicate symbols are reported at a stage when
the second object file isn't fully loaded yet.)
Differential Revision: https://reviews.llvm.org/D68975
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375218 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This updates some more places using `%T` to use `%/T` for path normalization.
If this does not work, this and r375126 should be reverted together.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375131 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
Glob support was improved to accept `\` as an escape character in r375051, but reverted as r375052 due to a failure in this test on Windows.
The reason this failure seems Windows specific is because the path separator `\` is currently being relied on to be interpreted literally instead of as an escape character. Per documentation on linker input section wildcard patterns, this seems to be a bug in lld accepting `\` as a literal instead of an escape character.
For example:
```
SECTIONS{ .foo :{ /path/to/foo.o(.foo) }} # OK: standard UNIX path
SECTIONS{ .foo :{ C:/path/to/foo.o(.foo) }} # OK: windows accepts slashes in either direction
SECTIONS{ .foo :{ C:\\path\\to\\foo.o(.foo) }} # OK: escape character used to match a literal \
SECTIONS{ .foo :{ C:\path\to\foo.o(.foo) }} # BAD: this actually matches the path C:pathtofoo.o(.foo)
```
This avoids the problem in the test by using `%/T` in place of `%T` to normalize the path separator to `/`, which windows should also accept.
This patch just fixes the test, and glob support will be be relanded separately.
For a sample buildbot error, see: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11578/steps/stage%201%20check/logs/stdio
Reviewers: evgeny777, ruiu, MaskRay, espindola
Reviewed By: ruiu, MaskRay
Subscribers: emaste, arichardson, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69074
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375126 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
The change was:
SHT_GNU_verdef { -> VersionDefinitions [
SHT_GNU_verneed { -> VersionRequirements [
Version symbols [ -> VersionSymbols [
EH_FRAME Header [ -> EHFrameHeader {
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375096 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Undefined symbols in WebAssembly can come with custom `import-module`
and `import-field` attributes. However when reading symbols from
bitcode object files during LTO those curtom attributes are not
available.
Once we compile the LTO object and read in the symbol table from the
object file we have access to these custom attributes. In this case,
when undefined symbols are added and a symbol already exists in the
SymbolTable we can't simple return it, we may need to update the
symbol's attributes.
Fixes: PR43211
Differential Revision: https://reviews.llvm.org/D68959
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375081 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Fix a bug where were not handling relocations against weakly undefined
data symbol. Add a test for this case. Also ensure that the weak
references to data symbols are not pulled in from archive files by
default (but are if `-u <name>` is added to the command line).
Fixes: PR43696
Differential Revision: https://reviews.llvm.org/D69073
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@375077 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
WebAssembly memories are zero-initialized, so when module does not
import its memory initializing .bss sections is guaranteed to be a
no-op. To reduce binary size and initialization time, .bss sections
are simply not emitted into the final binary unless the memory is
imported.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68965
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374940 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Reviewers: ruiu, sbc100
Reviewed By: sbc100
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68991
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374913 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Differential Revision: https://reviews.llvm.org/D68875
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374891 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
- Expand the "Name" column past 13 characters when any of the section names are longer. Current behavior is a staggard output instead of a nice table if a single name is longer.
- Only print the required number of hex chars for addresses (i.e. 8 characters for 32-bit, 16 characters for 64-bit)
- Fix trailing spaces
Reviewers: grimar, jhenderson, espindola
Reviewed By: grimar
Subscribers: emaste, sbc100, arichardson, aheejin, seiya, llvm-commits, MaskRay
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68730
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374795 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
https://reviews.llvm.org/D68704 changed the output format.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374542 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
that the test runs on Windows
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374473 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
A common pattern in Windows is to have all your precompiled headers
use an object named stdafx.obj. If you've got a project with many
different static libs, you might use a separate PCH for each one of
these.
During the final link step, a file from A might reference the PCH
object from A, but it will have the same name (stdafx.obj) as any
other PCH from another project. The only difference will be the
path. For example, A might be A/stdafx.obj while B is B/stdafx.obj.
The existing algorithm checks only the filename that was passed on
the command line (or stored in archive), but this is insufficient in
the case where relative paths are used, because depending on the
command line object file / library order, it might find the wrong
PCH object first resulting in a signature mismatch.
The fix here is to simply check whether the absolute path of the
PCH object (which is stored in the input obj file for the file that
references the PCH) *ends with* the full relative path of whatever
is specified on the command line (or is in the archive).
Differential Revision: https://reviews.llvm.org/D66431
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374442 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Differential Revision: https://reviews.llvm.org/D68768
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374297 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
GNU ld looks for a number of other patterns than just lib<name>.dll.a
and lib<name>.a.
GNU ld does support linking directly against a DLL without using an
import library. If that's the only match for a -l argument, point out
that the user needs to use an import library, instead of leaving the
user with a puzzling message about the -l argument not being found
at all.
Also convert an existing case of fatal() into error().
Differential Revision: https://reviews.llvm.org/D68689
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374292 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Differential Revision: https://reviews.llvm.org/D68688
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374291 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This patch adds a section name to error messages.
Differential Revision: https://reviews.llvm.org/D68758
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374290 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Suggested by Martin Storsjö.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374142 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Fixes assert in addLinkerModuleCoffGroup() when using by-ordinal imports
only.
Patch by Stefan Schmidt.
Differential revision: https://reviews.llvm.org/D68352
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374140 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
These are sometimes generated by tail call optimizations.
Differential Revision: https://reviews.llvm.org/D66542
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374052 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374023 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
The combination of the two flags doesn't make sense. And other linkers
seem to just ignore --export-dynamic if --relocatable is given, but
we probably should report it as an error to let users know that is
an invalid combination.
Fixes https://bugs.llvm.org/show_bug.cgi?id=43552
Differential Revision: https://reviews.llvm.org/D68441
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@374022 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Differential Revision: https://reviews.llvm.org/D68017
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373781 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This commit should be reverted along with r371729.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373713 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Differential Revision: https://reviews.llvm.org/D68382
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373705 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This patch adds /reproduce:<path> option to lld/COFF. This is an
lld-specific option, so we can name it freely. I chose /reproduce
over other names (e.g. /lldlinkrepro) for consistency with other lld
ports.
Differential Revision: https://reviews.llvm.org/D68381
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373704 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This reverts commit r371729 because /linkrepro option also exists
in Microsoft link.exe and their linker takes not a filename but a
directory name as an argument for /linkrepro.
Differential Revision: https://reviews.llvm.org/D68378
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373703 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
rL371826 rearranged some output from llvm-objdump for GNU objdump compatability, but there still seem to be some more.
I think this rearrangement is a little closer. Overview of the ordering which matches GNU objdump:
* Archive headers
* File headers
* Section headers
* Symbol table
* Dwarf debugging
* Relocations (if `--disassemble` is not used)
* Section contents
* Disassembly
Reviewers: jhenderson, justice_adams, grimar, ychen, espindola
Reviewed By: jhenderson
Subscribers: aprantl, emaste, arichardson, jrtc27, atanasyan, seiya, llvm-commits, MaskRay
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68066
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373671 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373589 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373357 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Our .interp section is not a SyntheticSection. As a result, it terminates the
loop in removeUnusedSyntheticSections(). This has at least two consequences:
- The synthetic .bss and .bss.rel.ro sections are always present in
dynamically linked executables, even when they are not needed.
- The synthetic .ARM.exidx (and possibly other) sections are always present
in partitions other than the last one, even when not needed.
.ARM.exidx in particular is problematic because it assumes that its
list of code sections is non-empty in getLinkOrderDep(), which can
lead to a crash if the partition does not have any code sections.
Fix these problems by moving the creation of the .interp sections to the
top of createSyntheticSections(). While here, make the code a little less
error-prone by changing the add() lambdas to take a SyntheticSection instead
of an InputSectionBase.
Differential Revision: https://reviews.llvm.org/D68256
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373347 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
relocatable links.
Merging SHF_LINK_ORDER sections can affect semantics if the sh_link
fields point to different sections.
Specifically, for SHF_LINK_ORDER sections, the sh_link field acts as a reverse
dependency from the linked section, causing the SHF_LINK_ORDER section to
be included if the linked section is included. Merging sections with different
sh_link fields will cause the entire contents of the SHF_LINK_ORDER section
to be associated with a single (arbitrarily chosen) output section, whereas the
correct semantics are for the individual pieces of the SHF_LINK_ORDER section
to be associated with their linked output sections. As a result we can end up
incorrectly dropping SHF_LINK_ORDER section contents or including the wrong
section contents, depending on which linked sections were chosen.
Differential Revision: https://reviews.llvm.org/D68094
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373255 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This reverts r373168. It caused PR43511.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373242 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
r373125
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373178 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
For the following two cases, we currently suppress the symbols. This
patch emits them (compatible with GNU as).
* `test2_a = undef`: if `undef` is otherwise unused.
* `.hidden hidden`: if `hidden` is unused. This is the main point of the
patch, because omitting the symbol would cause a linker semantic
difference.
It causes a behavior change that is not compatible with GNU as:
.weakref foo1, bar1
When neither foo1 nor bar1 is used, we now emit bar1, which is arguably
more consistent.
Another change is that we will emit .TOC. for .TOC.@tocbase . For this
directive, suppressing .TOC. can be seen as a size optimization, but we
choose to drop it for simplicity and consistency.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373168 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This was requested in https://reviews.llvm.org/D68014, but I forgot
to add it before pushing the commit.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373145 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
function. NFC.
This avoids a few lines of boilerplate of dealing with C string
allocations.
Add a testcase for a case where demangling shouldn't happen.
Differential Revision: https://reviews.llvm.org/D68014
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373076 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Add test cases for some cases where we don't want demangling to happen.
Differential Revision: https://reviews.llvm.org/D67301
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@373075 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Fixes PR43461 (regression caused by D67504)
The partition field of a SECTIONS-specified section is not set after
D67504. The 0 value affects findSection() which checks if the partition
field is 1.
So `Out::initArray = findSection(".init_array")` is null, and
DT_INIT_ARRAYSZ is not set.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D68087
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372996 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
The following patch avoids segfaulting if the section list is empty when writing a mach-o MH_OBJECT. I ran into this case from a more complicated example trying to dead_strip while using '-r' in lld.
I'm not sure if having empty sections is a legal mach-o, but it does seem that other llvm-binutils tools can ingest such a boring object with out issue. Would it be better to emit an error, emit a warning, or do nothing? It seems that adding a warning diagnostic might be helpful to users, as I did not expect to have a section-less object when the linker was done.
Reviewers: kledzik, ruiu
Subscribers: llvm-commits, jrm
Tags: #lld, #llvm
Differential Revision: https://reviews.llvm.org/D67735
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372995 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
The R_MIPS_JALR relocation denotes jalr/jr instructions in position
independent code. Both these instructions take a target's address from
the $25 register. If offset to the target symbol fits into the 18-bits,
it's more efficient to replace jalr/jr by bal/b instructions.
Differential Revision: https://reviews.llvm.org/D68057
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372951 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This should fix buildbot errors like this one:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/10997
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372852 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
This fixes PR42407.
Differential Revision: https://reviews.llvm.org/D67053
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372843 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
noseparate-code
D64906 allows PT_LOAD to have overlapping p_offset ranges. In the
default R RX RW RW layout + -z noseparate-code case, we do not tail pad
segments when transiting to another segment. This can save at most
3*maxPageSize bytes.
a) Before D64906, we tail pad R, RX and the first RW.
b) With -z separate-code, we tail pad R and RX, but not the first RW (RELRO).
In some cases, b) saves one file page. In some cases, b) wastes one
virtual memory page. The waste is a concern on Fuchsia. Because it uses
compressed binaries, it doesn't benefit from the saved file page.
This patch adds -z separate-loadable-segments to restore the behavior before
D64906. It can affect section addresses and can thus be used as a
debugging mechanism (see PR43214 and ld.so partition bug in
crbug.com/998712).
Reviewed By: jakehehrlich, ruiu
Differential Revision: https://reviews.llvm.org/D67481
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372807 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Summary:
When support for ThinLTO was first added to lld, the options that
control it were prefixed with --plugin-opt= for compatibility with
an existing implementation as a linker plugin. This change enables
shorter versions of the options to be used, as follows:
New Existing
-thinlto-emit-imports-files --plugin-opt=thinlto-emit-imports-files
-thinlto-index-only --plugin-opt=thinlto-index-only
-thinlto-index-only= --plugin-opt=thinlto-index-only=
-thinlto-object-suffix-replace= --plugin-opt=thinlto-object-suffix-replace=
-thinlto-prefix-replace= --plugin-opt=thinlto-prefix-replace=
-lto-obj-path= --plugin-opt=obj-path=
The options with the --plugin-opt= prefix have been retained as aliases
for the shorter variants so that they continue to be accepted.
Reviewers: tejohnson, ruiu, espindola
Reviewed By: ruiu
Subscribers: emaste, arichardson, MaskRay, steven_wu, dexonsmith, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67782
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372798 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
When /DISCARD/ is used on an input section, that input section may have
a .ARM.exidx metadata section that depends on it. As the discard handling
comes after the .ARM.exidx synthetic section is created we need to make
sure that we account for the case where the .ARM.exidx output section
should be removed because there are no more live input sections.
Differential Revision: https://reviews.llvm.org/D67848
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372781 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
functions
Differential Revision: https://reviews.llvm.org/D66784
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372779 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
Fixes PR38748
mergeSections() calls getOutputSectionName() to get output section
names. Two MergeInputSections may be merged even if they are made
different by SECTIONS commands.
This patch moves mergeSections() after processSectionCommands() and
addOrphanSections() to fix the issue. The new pass is renamed to
OutputSection::finalizeInputSections().
processSectionCommands() and addorphanSections() are changed to add
sections to InputSectionDescription::sectionBases.
finalizeInputSections() merges MergeInputSections and migrates
`sectionBases` to `sections`.
For the -r case, we drop an optimization that tries keeping sh_entsize
non-zero. This is for the simplicity of addOrphanSections(). The
updated merge-entsize2.s reflects the change.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D67504
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@372734 91177308-0d34-0410-b5e6-96231b3b80d8
|