Commit Graph

3033 Commits

Author SHA1 Message Date
Pavel Labath fe9922f8af Fix build broken by llvm r327486
llvm::DWARFFormParams moved to llvm::dwarf::FormParams.

llvm-svn: 327489
2018-03-14 09:57:52 +00:00
Fangrui Song ffac3ed341 [ELF] Fix IsPreemptible comment and typo. NFC
llvm-svn: 325963
2018-02-23 21:57:49 +00:00
Francis Visoiu Mistrih 5486d2472c [YAML] Fix mustQuote return type changed in r320996
llvm-svn: 320997
2017-12-18 17:49:27 +00:00
David Blaikie fd872e9637 MachONormalizedFile.h: Remove unimplemented function
dump had no definition, so op<< was never usable anyway - remove the
definition of the latter and the declaration of the former.

llvm-svn: 318880
2017-11-22 21:10:19 +00:00
David Blaikie c3d72c3cc5 Make some headers modular by adding missing includes/forward decls.
llvm-svn: 318718
2017-11-21 01:09:10 +00:00
Rafael Espindola 5f903f3848 Update for llvm change.
llvm-svn: 317657
2017-11-08 01:50:34 +00:00
Rafael Espindola f7a57294d7 Update for llvm change.
llvm-svn: 317650
2017-11-08 01:05:52 +00:00
NAKAMURA Takumi b6d3452243 lld: Prune unused libdeps.
llvm-svn: 315537
2017-10-12 00:04:24 +00:00
NAKAMURA Takumi d791eaa559 lld: Reorder libdeps.
Differential Revision: https://reviews.llvm.org/D38828

llvm-svn: 315529
2017-10-11 23:18:43 +00:00
Hans Wennborg f69216a575 Build fix: don't try to link in lldConfig
Config was removed in r314719.

llvm-svn: 314736
2017-10-02 23:09:37 +00:00
Rui Ueyama 3f851704c1 Move new lld's code to Common subdirectory.
New lld's files are spread under lib subdirectory, and it isn't easy
to find which files are actually maintained. This patch moves maintained
files to Common subdirectory.

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

llvm-svn: 314719
2017-10-02 21:00:41 +00:00
Rui Ueyama ea65b5aa49 [MACH-O] Fix the ASM code generated for __stub_helpers section
Patch by Patricio Villalobos.

I discovered that lld for darwin is generating the wrong code for lazy
bindings in the __stub_helper section (at least for osx 10.12). This is
the way i can reproduce this problem, using this program:

  #include <stdio.h>

  int main(int argc, char **argv) {
      printf("C: printf!\n");
      puts("C: puts!\n");
      return 0;
  }

Then I link it using i have tested it in 3.9, 4.0 and 4.1 versions:

  $ clang -c hello.c
  $ lld -flavor darwin hello.o -o h1  -lc

When i execute the binary h1 the system gives me the following error:

  C: printf!
  dyld: lazy symbol binding failed:
  BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
  has segment 4 which is too large (0..3)
  dyld: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 4 which is too
  large (0..3)
  Trace/BPT trap: 5

Investigating the code, it seems that the problem is that the asm code
generated in the file StubPass.cpp, specifically in the line 323,when it
adds, what it seems an arbitrary number (12) to the offset into the lazy
bind opcodes section, but it should be calculated depending on the
MachONormalizedFileBinaryWrite::lazyBindingInfo result.

I confirmed this bug by patching the code manually in the binary and
writing the right offset in the asm code (__stub_helper).

This patch fixes the content of the atom that contains the assembly code
when the offset is known.

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

llvm-svn: 311734
2017-08-24 23:51:40 +00:00
Martell Malone 8cd2f13938 NFC: LLD fix OptTable Variable Name Style
llvm-svn: 311518
2017-08-23 02:33:42 +00:00
Rafael Espindola eaf1d566ff Update for llvm change.
llvm-svn: 309913
2017-08-03 02:16:33 +00:00
Tom Stellard 1d70d75f46 Fix ObjCPass on big-endian host
Summary:
This fixes test/mach-o/objc-image-info-pass-output.yaml on
big-endian hosts.

Reviewers: lhames, kledzik, ruiu

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 308935
2017-07-24 23:13:31 +00:00
Kevin Enderby b4c351dfd1 lld matching change for llvm change r308690 to add error handling to
the dyld compact export entries in libObject.

llvm-svn: 308691
2017-07-20 23:09:19 +00:00
Rui Ueyama 12234f8093 Use StringRef::contains().
llvm-svn: 308526
2017-07-19 21:40:26 +00:00
Tom Stellard a6b7efc7e3 [MachO] Add missing byte-swaps when reading dyld_info
Summary:
This fixes the following tests on big-endian hosts:

lld :: mach-o/dylib-install-names.yaml
lld :: mach-o/force_load-dylib.yaml
lld :: mach-o/lib-search-paths.yaml
lld :: mach-o/upward-dylib-load-command.yaml

Reviewers: lhames, kledzik, ruiu

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 307405
2017-07-07 15:20:17 +00:00
Richard Smith 4451cb63fb Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
This is a short-term fix for PR33650 aimed to get the modules build bots green again.

Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
macros to try to locally specialize a global template for a global type. That's
not how C++ works.

Instead, we now centrally define how to format vectors of fundamental types and
of string (std::string and StringRef). We use flow formatting for the former
cases, since that's the obvious right thing to do; in the latter case, it's
less clear what the right choice is, but flow formatting is really bad for some
cases (due to very long strings), so we pick block formatting. (Many of the
cases that were using flow formatting for strings are improved by this change.)

Other than the flow -> block formatting change for some vectors of strings,
this should result in no functionality change.

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

Corresponding LLVM change is r306878.

llvm-svn: 306880
2017-06-30 20:57:21 +00:00
Paul Robinson a22c98c030 Tweak to match change in LLVM API, in r306315.
llvm-svn: 306316
2017-06-26 18:43:26 +00:00
Yuka Takahashi ba5d4af490 [GSoC] Flag value completion for clang
This is patch for GSoC project, bash-completion for clang.

To use this on bash, please run `source clang/utils/bash-autocomplete.sh`.
bash-autocomplete.sh is code for bash-completion.

In this patch, Options.td was mainly changed in order to add value class
in Options.inc.

llvm-svn: 305805
2017-06-20 16:31:31 +00:00
Galina Kistanova 0c10465a57 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 305145
2017-06-10 08:06:17 +00:00
Sam Clegg c1e7a0dde5 Add BinaryFormat to lld libraries
Without this, when building with shared BUILD_SHARED_LIBS=ON
I get errors such as:

lib/Core/Reader.cpp:40: error: undefined reference to
'llvm::identify_magic(llvm::StringRef)'

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

llvm-svn: 304932
2017-06-07 18:06:11 +00:00
Galina Kistanova 1cbc801dd6 Removed the redundant comment. NFC.
llvm-svn: 304874
2017-06-07 06:52:58 +00:00
Galina Kistanova 91d62c9a56 Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
llvm-svn: 304873
2017-06-07 06:46:38 +00:00
Zachary Turner 264b5d9e88 Move Object format code to lib/BinaryFormat.
This creates a new library called BinaryFormat that has all of
the headers from llvm/Support containing structure and layout
definitions for various types of binary formats like dwarf, coff,
elf, etc as well as the code for identifying a file from its
magic.

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

llvm-svn: 304864
2017-06-07 03:48:56 +00:00
Zachary Turner 3a57fbd6db [Support] Move Parallel algorithms from LLD to LLVM.
Differential Revision: https://reviews.llvm.org/D33024

llvm-svn: 302748
2017-05-11 00:03:52 +00:00
Zachary Turner 0a340ce3bc Rename variables to conform to LLVM naming conventions.
llvm-svn: 302697
2017-05-10 17:39:18 +00:00
Zachary Turner 092c767745 [Core] Make parallel algorithms match C++ Parallelism TS.
Differential Revision: https://reviews.llvm.org/D33016

llvm-svn: 302613
2017-05-10 01:16:22 +00:00
Eric Fiselier eda29e474e Fix undefined pthread references when building against libc++
llvm-svn: 302363
2017-05-06 22:10:14 +00:00
Rui Ueyama 552c290746 Fix build breakage on Linux.
llvm-svn: 302295
2017-05-05 21:27:30 +00:00
Zachary Turner 6083b2be22 Fix #include case sensitivity problem.
llvm-svn: 302291
2017-05-05 21:14:55 +00:00
Zachary Turner f7ca8fcd6a Split up Parallel and LLVM'ize naming conventions.
This is one step in preparation of raising this up to
LLVM.  This hides all of the Executor stuff in a private
implementation file, leaving only the core algorithms and
the TaskGroup class exposed.  In doing so, fix up all the
variable names to conform to LLVM style.

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

llvm-svn: 302288
2017-05-05 21:09:26 +00:00
Davide Italiano 0eb8030369 [MachO/X86_64] Simplify isDataInCodeTransition().
llvm-svn: 300385
2017-04-15 01:50:51 +00:00
Davide Italiano 2a34b6395f [MachO/AArch64] Merge multiple switch cases into one. NFCI.
llvm-svn: 300384
2017-04-15 01:42:55 +00:00
Martell Malone 6b43b7ad49 [ELF] - Allow the Code Model flag when using LTO
Differential Revision: https://reviews.llvm.org/D29445

llvm-svn: 296542
2017-02-28 23:43:26 +00:00
Eric Fiselier 87c87f4c30 [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
Ismail Donmez 82c489f2a6 Fix shared build after r293965 (Core) and r293967 (COFF)
llvm-svn: 293996
2017-02-03 10:13:39 +00:00
Bob Haarman 37c22a3ecb added missing dependency on intrinsics_gen to lib/Core
llvm-svn: 293986
2017-02-03 00:53:57 +00:00
Bob Haarman fbc229dc8f added missing files for r293965
llvm-svn: 293966
2017-02-02 23:53:10 +00:00
Bob Haarman 35989d6be5 add the ability to call InitTargetOptionsFromCodeGenFlags from multiple objects
Summary: llvm/CodeGen/CommandFlags.h a utility function InitTargetOptionsFromCodeGenFlags which is used to set target options from flags based on the command line. The command line flags are stored in globals defined in the same file, and including the file in multiple places causes the globals to be defined multiple times, leading to linker errors. This change adds a single place in lld where these globals are defined and exports only the utility function. This makes it possible to call InitTargetOptionsFromCodeGenFlags from multiple places in lld, which a follow-up change will do.

Reviewers: davide, ruiu

Reviewed By: davide, ruiu

Subscribers: mgorny

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

llvm-svn: 293965
2017-02-02 23:49:16 +00:00
Pavel Labath c9fa114b28 [lld][cmake] Fix LLVM_LINK_LLVM_DYLIB build
Summary:
Lld's build had a couple of issues which prevented a successfull
LLVM_LINK_LLVM_DYLIB compilation.

- add_llvm_library vs llvm_add_library: One adds a library to libLLVM.so, other
  one doesn't. Lld was using the wrong one, causing symbols to be mupltiply
  defined in things linking to libLLVM.
- confusion when to use LINK_LIBS vs LINK_COMPONENTS in llvm_add_library
- not using LLVM_LINK_COMPONENTS for add_lld_tool

With these fixes lld compiles and it's test suite passes both in
LLVM_LINK_LLVM_DYLIB mode and without it.

Reviewers: ruiu, beanz

Subscribers: llvm-commits, mgorny

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

llvm-svn: 291432
2017-01-09 09:57:08 +00:00
Rui Ueyama 3e6490399e Define sys::path::convert_to_slash
This patch moves convertToUnixPathSeparator from LLD to LLVM.

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

llvm-svn: 291414
2017-01-09 01:47:15 +00:00
Rafael Espindola 1d1f692158 Revert r291221.
Should bring back the windows bots.

llvm-svn: 291263
2017-01-06 19:01:49 +00:00
Rui Ueyama b4c63caf76 Rename lld::stringize -> lld::toString.
llvm-svn: 291223
2017-01-06 10:04:35 +00:00
Rui Ueyama dac6169214 Remove lld::convertToUnixPathSeparator.
Now TarWriter takes care of path separator conversion, so we don't
need to handle that in LLD.

llvm-svn: 291221
2017-01-06 09:38:43 +00:00
Rui Ueyama 7f1f912794 Use TarWriter to create tar archives instead of cpio.
This is how we use TarWriter in LLD. Now LLD does not append
a file extension, so you need to pass `--reproduce foo.tar`
instead of `--reproduce foo`.

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

llvm-svn: 291210
2017-01-06 02:33:53 +00:00
Rui Ueyama 9381eb1045 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

llvm-svn: 290062
2016-12-18 14:06:06 +00:00
Michal Gorny 906534fe4e Remove unnecessary llvm/Config/config.h includes
Remove the includes of <llvm/Config/config.h> private LLVM header.
The relevant files seem not to use any definitions from that file,
and it is not available when building against installed LLVM.

The use in lib/ReaderWriter/MachO/MachOLinkingContext.cpp originates
from rL218718, and the use in ELF/Strings.cpp from rL274804 (where it
was moved from Symbols.cpp). In both cases, they were added as a part of
demangling support, and they provided HAVE_CXXABI_H.

Since we are now using the LLVM demangler library instead, the code was
removed and the includes and no longer necessary.

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

llvm-svn: 289707
2016-12-14 20:53:57 +00:00
Rui Ueyama 520d9169e6 Move Memory.{h,cpp} to lld/Support so that we can use them from COFF.
llvm-svn: 289084
2016-12-08 18:31:13 +00:00