Commit Graph

2980 Commits

Author SHA1 Message Date
Davide Italiano c223d1bc6b [ELF] Don't replace path separators on *NIX.
Apparently this is wrong because it's legal to have a filename
on UNIX which contains a backslash.

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

llvm-svn: 287143
2016-11-16 19:35:36 +00:00
George Rimar 117c933304 [ELF] - Fixed comment. NFC.
llvm-svn: 286712
2016-11-12 06:27:42 +00:00
Mehdi Amini 16e25c8d4c Fix wrong formatting in lld introduced in r286561 (NFC)
Pointed out by Davide.

llvm-svn: 286649
2016-11-11 22:28:19 +00:00
Greg Clayton a6ccd19035 Fix code to deal with recent LLVM changes.
https://reviews.llvm.org/D26526

llvm-svn: 286598
2016-11-11 16:23:47 +00:00
George Rimar e893689331 [ELF] - Use backward slashes inside response files
Patch replaces forward slashes with backward inside response.txt

This is https://llvm.org/bugs/show_bug.cgi?id=30951.

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

llvm-svn: 286589
2016-11-11 13:23:13 +00:00
Mehdi Amini c1edf566b9 Prevent at compile time converting from Error::success() to Expected<T>
This would trigger an assertion at runtime otherwise.

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

llvm-svn: 286562
2016-11-11 04:29:25 +00:00
Rui Ueyama 8c6a5aaf15 Create a vector containing all input sections.
Previously, we do this piece of code to iterate over all input sections.

  for (elf::ObjectFile<ELFT> *F : Symtab.getObjectFiles())
    for (InputSectionBase<ELFT> *S : F->getSections())

It turned out that this mechanisms doesn't work well with synthetic
input sections because synthetic input sections don't belong to any
input file.

This patch defines a vector that contains all input sections including
synthetic ones.

llvm-svn: 286051
2016-11-05 22:37:59 +00:00
Eugene Zelenko 22886a2853 Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D26320

llvm-svn: 286030
2016-11-05 01:00:56 +00:00
Eugene Zelenko e568b91510 Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D26293

llvm-svn: 286000
2016-11-04 17:39:46 +00:00
Greg Clayton 9a134fc917 Fix build breakage on buildbots that was due to 285309.
llvm-svn: 285321
2016-10-27 17:43:39 +00:00
Rui Ueyama 80695c1aef Truncate a SVN path part from --version output.
This is in sync with what clang does.

llvm-svn: 285163
2016-10-26 03:52:06 +00:00
Eugene Zelenko 8329bfc63a Fix Clang-tidy readability-redundant-member-init warnings; other minor fixes
Differential revision: https://reviews.llvm.org/D25931

llvm-svn: 285086
2016-10-25 16:57:35 +00:00
Pavel Labath 407fd070b7 Adjust for TimePoint interface change in llvm: D25730. NFC
llvm-svn: 284965
2016-10-24 10:59:14 +00:00
Benjamin Kramer 3ad3f5033d Retire llvm::alignOf in favor of C++11 alignof.
No functionality change intended.

llvm-svn: 284734
2016-10-20 15:30:02 +00:00
Reid Kleckner 89f3090d35 Use noexcept directly now that all compilers support it
llvm-svn: 284671
2016-10-19 23:50:50 +00:00
Rui Ueyama 4ff3b5adc3 Move getVersionString to Core and simplify Version.cpp.
llvm-svn: 284641
2016-10-19 20:53:07 +00:00
Davide Italiano f6c1d2c158 [MachO] Factor out a fair amount of duplicated code. NFCI.
llvm-svn: 281260
2016-09-12 21:07:26 +00:00
Davide Italiano 35065193f1 [MachO] Remove code accidentally cut'n'pasted 3 times.
It wasn't harmful, just goofy. It's weird to see how this has
fallen through the crack without anybody noticing for so long.

llvm-svn: 281148
2016-09-10 20:41:26 +00:00
Rafael Espindola 5b0fb8f4d5 Fix shared library build.
llvm-svn: 280753
2016-09-06 21:06:55 +00:00
Rafael Espindola d1942133e8 Use the demangler in llvm.
llvm-svn: 280733
2016-09-06 19:17:14 +00:00
Duncan P. N. Exon Smith 9f71057d69 ReaderWriter: Use ilist_noalloc_traits for TrieEdge, NFC
Adopt r280128 in lld, specializing ilist_alloc_traits rather than
reinventing the wheel.

llvm-svn: 280566
2016-09-03 01:29:36 +00:00
Duncan P. N. Exon Smith c9e8bc191c ADT: Remove uses of ilist_*sentinel_traits, NFC
llvm-svn: 279458
2016-08-22 18:59:33 +00:00
Davide Italiano 8dd4e70222 [Driver] Remove break after return. NFCI.
llvm-svn: 278834
2016-08-16 18:23:44 +00:00
Duncan P. N. Exon Smith 623c4c1572 MachO: Use ilist_half_embedded_sentinel_traits, NFC
Use ilist_half_embedded_sentinel_traits for the list of
lld::mach_o::normalized::TrieEdge, rather than duplicating the code.

llvm-svn: 278523
2016-08-12 16:25:04 +00:00
Davide Italiano 54eb8ffd55 [Core] Retire yet another unused member function.
The code in lib/ could use a lot of love :(

llvm-svn: 278506
2016-08-12 12:37:23 +00:00
Davide Italiano 0f672ed87a [Core] Simplify a bit. NFCI.
llvm-svn: 278505
2016-08-12 12:34:39 +00:00
Pete Cooper ef5bea9dca Dead strip DESC bits should only be set on object files.
It only makes sense to set on N_NO_DEAD_STRIP on a relocatable object file.  Otherwise the bits aren't useful for anything.  Matches the ld64 behaviour.

llvm-svn: 278419
2016-08-11 21:27:18 +00:00
Pete Cooper 1ed8f1f6e5 Better compress lazy binding info to match ld64.
We should be using one of BIND_OPCODE_SET_DYLIB_SPECIAL_IMM, BIND_OPCODE_SET_DYLIB_ORDINAL_IMM,
and BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB depending on whether ordinals are <= 0, <= 15, > 15.

This matches the behaviour of ld64.

llvm-svn: 278407
2016-08-11 20:59:27 +00:00
Pete Cooper 21f475e1c4 Generate slightly more compressed binding opcodes when entries are the same as last time.
We already had logic for binding opcodes had the same addend as last time.  This adds
the cases where the ordinal, symbol name, type, and segment offsets are the same as
the last emitted ordinal.

This gets us one step closer to emitting rebase opcodes as compressed as ld64 can manage.

llvm-svn: 278405
2016-08-11 20:37:02 +00:00
Pete Cooper 732f1ef9de Arm64 stubs alignment is 2, not 4.
This matches the behaviour of ld64 when looking at the alignment of the stubs section in the final image.

llvm-svn: 278398
2016-08-11 20:18:05 +00:00
Pete Cooper 46cd113c87 Change when we choose to add an LC_LOAD_DYLIB to the final image.
Currently we do this when an atom is used, but we need to do it when a
dylib is referenced on the cmdline as this matches ld64.

This fixes much confusion over which maps are indexed with installName
vs path.  There is likely other confusion so i'll be seeing if i can remove
path() completely in a future commit as path() shouldn't really be needed by anyone.

llvm-svn: 278396
2016-08-11 20:10:14 +00:00
Pete Cooper 932bce6ade Fix off-by-one error in default currentVersion.
A version of 0x1000 is 0.16.0, not 1.0.0 as the comment said.  Fix the
value to match the comment, and also the one test case which had this
wrong.

llvm-svn: 278381
2016-08-11 18:41:14 +00:00
Davide Italiano 7ca0645c80 [Core] Retire addReplacement() member function.
llvm-svn: 278327
2016-08-11 10:50:01 +00:00
Lang Hames 8c2406b1fc [lld][MachO] Fix LC_SEGEMENT[_64] filesize computation in -r mode.
Using vmsize to populate this file works when outputing MachO images, but fails
when outputting relocatable objects. This patch fixes the computation to use
file offsets, which works for both output types.

Fixes <rdar://problem/27727666>

llvm-svn: 278297
2016-08-10 22:15:09 +00:00
Davide Italiano c682303d6f [Core] tentativeDefinition() is now unused.
llvm-svn: 278181
2016-08-10 00:01:13 +00:00
Pete Cooper 5559b24935 The first string table entry should be a null terminated space, not just null.
This matches the behaviour of ld64 which initializes the string table with
' ' then '\0'.  lld only had the '\0' and needed the ' '.

llvm-svn: 278071
2016-08-08 23:20:04 +00:00
Benjamin Kramer df8f196f9a Unpollute the global namespace. lld edition.
llvm-svn: 277926
2016-08-06 13:52:37 +00:00
Pete Cooper d0de3683ec ExportTrie nodes need to be visisted in order.
The export trie was being emitted in the order the nodes were
added to the vector, but instead needs to be visited in the order
that the nodes are traversed.  This matches the behaviour of ld64.

llvm-svn: 277869
2016-08-05 21:37:12 +00:00
Davide Italiano d62d116add [MachO] Factor out some common code in the Driver.
llvm-svn: 277761
2016-08-04 19:56:26 +00:00
Davide Italiano 6bb5d2ddd3 [MachO/Core] Remove (now) unused static member function. NFCI.
llvm-svn: 277760
2016-08-04 19:49:11 +00:00
Kevin Enderby 0fa9fd0f28 Needed change to lld for the changes to libObject/Archive interfaces now returning Expected<>
for the llvm trunk change in r277656

llvm-svn: 277657
2016-08-03 21:58:48 +00:00
Lang Hames 70c80b336b [lld][MachO] Replace some std::string with char* buffers to eliminate mem leaks.
The MachO debug support code (committed in r276935) occasionally needs to
allocate string copies, and was doing so by creating std::strings on a
BumpPtrAllocator. The strings were untracked, so the destructors weren't being
run and we were leaking the memory when the allocator was thrown away. Since
it's easier than tracking the strings, this patch switches the copies to char
buffers allocated directly in the bump-ptr allocator.

llvm-svn: 277208
2016-07-29 20:04:18 +00:00
Kevin Enderby 01e41f11a7 Matching change needed to lld for llvm trunk change r277177.
Where Archive::getMemoryBufferRef() was changed to return Expected<>

llvm-svn: 277183
2016-07-29 17:56:00 +00:00
Lang Hames 242fde1b36 [lld][MachO] Remove some debugging output code that was mistakenly left in in
r276935.

llvm-svn: 276944
2016-07-28 00:28:48 +00:00
Lang Hames 436f7d6606 [lld][MachO] Re-apply r276921 with fix - initialize strings for debug string
copies.

llvm-svn: 276935
2016-07-27 22:55:30 +00:00
Lang Hames f2260567ca [lld][MachO] Temporarily revert r276921 - it's causing bot-failures on Linux.
llvm-svn: 276928
2016-07-27 22:46:02 +00:00
Lang Hames 560333749f [lld][MachO] Add debug info support for MachO.
This patch causes LLD to build stabs debugging symbols for files containing
DWARF debug info, and to propagate existing stabs symbols for object files
built using '-r' mode. This enables debugging of binaries generated by LLD
from MachO objects.

llvm-svn: 276921
2016-07-27 21:31:25 +00:00
Lang Hames 75069a1668 [lld][MachO] Add support for S_ATTR_DEBUG to the MachO YAML reader/writer.
This enables proper recognition of debug sections by attribute, which will be
used in the near future by test-cases for MachO debugging support.

llvm-svn: 276770
2016-07-26 17:17:17 +00:00
Peter Collingbourne 76681d6ab5 Add qualification to fix MSVC build.
llvm-svn: 276720
2016-07-26 02:10:56 +00:00
Peter Collingbourne feee2103c6 COFF: Implement /linkrepro flag.
This flag is implemented similarly to --reproduce in the ELF linker.

This patch implements /linkrepro by moving the cpio writer and associated
utility functions to lldCore, and using that implementation in both linkers.

One COFF-specific detail is that we store the object file from which the
resource files were created in our reproducer, rather than the resource
files themselves. This allows the reproducer to be used on non-Windows
systems for example.

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

llvm-svn: 276719
2016-07-26 02:00:42 +00:00