Commit Graph

1441 Commits

Author SHA1 Message Date
Rui Ueyama 182437e63f [PECOFF] Sort x64 exception handler table.
Just like x86 exception handler table, the table for x64 needs to be sorted
so that runtime can binary search on it. Unlike x86, the table entry for x64
has multiple fields, and they need to be sorted according to its BeginAddress
field. This patch also fixes a bug in relocations.

llvm-svn: 202874
2014-03-04 18:39:12 +00:00
Ahmed Charles d779459f21 [C++11] Add #include's for OwningPtr.
Allows removing #include's in LLVM while switching to std::unique_ptr.

llvm-svn: 202679
2014-03-03 07:20:05 +00:00
Benjamin Kramer 3445d9edad [C++11] Work around an incompatibility between llvm::tie and std::tie.
llvm-svn: 202645
2014-03-02 13:45:18 +00:00
Chandler Carruth d40922989a Fix a typo spotted by Anton.
llvm-svn: 202638
2014-03-02 13:00:23 +00:00
Chandler Carruth 5de228b287 [C++11] Replace LLVM_OVERRIDE with just "override" now that we're all
using MSVC 2012 or newer.

llvm-svn: 202627
2014-03-02 09:39:44 +00:00
Chandler Carruth 6eface7c9d [C++11] Switch from LLVM_FINAL to just "final" now that all of LLVM is
requiring MSVC 2012 or newer.

llvm-svn: 202626
2014-03-02 09:35:33 +00:00
Chandler Carruth 03b4e3a8cb [C++11] Update LLD documentation to just refer to the LLVM documentation
for C++11 issues.

llvm-svn: 202623
2014-03-02 09:17:09 +00:00
Chandler Carruth 620b89017e [C++1y] Don't error if the user is enabling C++1y, which is *newer* than
C++11. I'm not sure that this is a good idea, but I know some crazy
folks on the core working group who like to live dangerously, and they
should still be able to build LLD. =D

llvm-svn: 202568
2014-03-01 03:18:56 +00:00
Rui Ueyama 5522e81f12 [PECOFF] Sort SEH table entries according to its value.
It looks like the contents of the table need to be sorted according to its
value, so that the runtime can find the entry by binary search. I'm not 100%
sure if we really have to do that, but at least I can say it's safe to do
because the contents of .sxdata is just a list of exception handlers' RVAs.

llvm-svn: 202550
2014-02-28 22:17:53 +00:00
Rui Ueyama b85f31c7a2 [PECOFF] Set "Exception Table" field in PE32+ header.
llvm-svn: 202527
2014-02-28 18:25:09 +00:00
Shankar Easwaran 8353f965c4 [Hexagon] Rename the header file.
This is to accomodate future changes for newer revisions of the DSP.

No change in functionality.

llvm-svn: 202350
2014-02-27 06:28:49 +00:00
Rui Ueyama 1710fe7de9 [PECOFF] Add a test for /SAFESEH:NO for non-x86 machine type.
llvm-svn: 202322
2014-02-27 00:05:43 +00:00
Rui Ueyama cfa657795d [PECOFF] Add a test for /SAFESEH:NO.
llvm-svn: 202314
2014-02-26 23:15:41 +00:00
Simon Atanasyan 930ea1892f [Mips] Remove non-ASCII symbol from the comment.
llvm-svn: 202290
2014-02-26 19:23:52 +00:00
Simon Atanasyan 46ff3ce2bd [Mips] Split reloc26 function into two parts - for processing local and
external relocations.

llvm-svn: 202289
2014-02-26 19:17:20 +00:00
Simon Atanasyan 2043ee167c [Mips] Use a correct number of bits when apply result of calculated relocation.
llvm-svn: 202288
2014-02-26 19:17:14 +00:00
Simon Atanasyan a444eae5ce [Mips] Exit from the class method as soon as possible.
llvm-svn: 202287
2014-02-26 19:17:07 +00:00
Rui Ueyama 2e09d93f74 [PECOFF] Emit Load Configuration and SEH Table for x86.
If all input files are compatible with Structured Exception Handling, linker
is supposed to create an exectuable with a table for SEH handlers. The table
consists of exception handlers entry point addresses.

The basic idea of SEH in x86 Microsoft ABI is to list all valid entry points
of exception handlers in an read-only memory, so that an attacker cannot
override the addresses in it. In x86 ABI, data for exception handling is mostly
on stack, so it's volnerable to stack overflow attack. In order to protect
against it, Windows runtime uses the table to check a return address, to
ensure that the address is really an valid entry point for an exception handler.

Compiler emits a list of exception handler functions to .sxdata section. It
also emits a marker symbol "@feat.00" to indicate that the object is compatible
with SEH. SEH is a relatively new feature for COFF, and mixing SEH-compatible
and SEH-incompatible objects will result in an invalid executable, so is the
marker.

If all input files are compatible with SEH, LLD emits a SEH table. SEH table
needs to be pointed by Load Configuration strucutre, so when emitting a SEH
table LLD emits it too. The address of a Load Configuration will be stored to
the file header.

llvm-svn: 202248
2014-02-26 08:27:59 +00:00
NAKAMURA Takumi 955d27a4ce [CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase opportunity for parallel build.
target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library,
although final targets have dependencies to whole dependent libraries.
It makes most libraries can be built in parallel.

target_link_libraries(PRIVATE) is used to shaared library.
Each dependent library is linked to the target.so, and its user will not see its grandchildren.
For example,

  - libclang.so has sufficient libclang*.a(s).
  - c-index-test requires just only libclang.so.

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.
llvm-svn: 202241
2014-02-26 06:53:16 +00:00
NAKAMURA Takumi 9cd9ad6b9d [CMake] Introduce cmake_policy(CMP0022) for target_link_libraries(INTERFACE|PRIVATE).
For now, use both keywords, INTERFACE and PRIVATE via the variable,
  - ${cmake_2_8_12_INTERFACE}
  - ${cmake_2_8_12_PRIVATE}

They could be cleaned up when we introduce 2.8.12.

llvm-svn: 202239
2014-02-26 06:45:11 +00:00
NAKAMURA Takumi 9f4ee24ac6 lldReaderWriter: move LLVM_LINK_COMPONENTS. It seems Subdirectories don't depend on LLVMObject.
Please give LLVMObject explicitly in each subdirectory if any of subdirectories required it.

llvm-svn: 202236
2014-02-26 06:28:09 +00:00
NAKAMURA Takumi 23850261c6 [CMake] Declare cmake_minimum_required() unconditionally.
llvm-svn: 202235
2014-02-26 06:27:59 +00:00
Rui Ueyama aaf2816d59 [PECOFF] Add a utility function to add DIR32 relocation.
llvm-svn: 202217
2014-02-26 02:38:40 +00:00
Rui Ueyama f9be75f538 [PECOFF] Fix DLLCharacteristics field.
IMAGE_DLL_CHARACTERISTICS_NO_SEH flag should be set only when SEH is disabled.

llvm-svn: 202215
2014-02-26 02:31:53 +00:00
Shankar Easwaran a328344367 [LinkerScript] parse OUTPUT_FORMAT : treat quotedStrings as identifier
llvm-svn: 202166
2014-02-25 17:02:54 +00:00
Rui Ueyama d08472f6c3 [COFF] Refactor .drectve section handling. No functionality change.
llvm-svn: 202113
2014-02-25 05:37:47 +00:00
Shankar Easwaran 2ea5148eff [LinkerScript] OUTPUT_FORMAT: Parse Quoted Strings
llvm-svn: 202111
2014-02-25 05:17:24 +00:00
Shankar Easwaran 7a0818dd4a [test] use llvm-config to drive testing in assert mode/debug mode
llvm-svn: 202101
2014-02-25 02:29:17 +00:00
Shankar Easwaran 822ea4f9a3 [LinkerScript] parse OUTPUT_ARCH.
llvm-svn: 202100
2014-02-25 01:55:13 +00:00
Nico Rieck b9d84f4d14 [lld] Include reference kind in cycle detector debug output
This restores the debug output to how it was before r197727 broke it. This
went undetected because the corresponding test was never run due to broken
feature detection.

llvm-svn: 202079
2014-02-24 21:14:37 +00:00
Nico Rieck 78f2b48e7d Fix feature detection in lld's lit.cfg
llvm-svn: 202078
2014-02-24 21:13:53 +00:00
Rafael Espindola f27f9fa136 Update for LLVM api change.
llvm-svn: 202054
2014-02-24 18:20:36 +00:00
Rafael Espindola 27810169cb Don't assume that F_None is the default. It is about to change.
llvm-svn: 202039
2014-02-24 15:06:34 +00:00
Nico Rieck aa675e9379 [PECOFF] Fix uninitialized variable
llvm-svn: 201970
2014-02-23 10:40:15 +00:00
NAKAMURA Takumi b31e03007a [CMake] add_lld_library: link_system_libs is not needed any more. LLVMSupport may provide dependencies to system libs.
llvm-svn: 201967
2014-02-23 04:43:45 +00:00
Rui Ueyama a5dc335574 [PECOFF] Implement /SAFESEH option.
LLD now prints an error message if /SAFESEH option is specified and one or
more input files are not compatible with SEH.

llvm-svn: 201900
2014-02-21 22:50:27 +00:00
Rui Ueyama d9e7c22ee4 [PECOFF] Driver support for /SAFESEH option.
Syntactically /SAFESEH is a boolean flag -- you can pass /SAFESEH or /SAFESEH:no.

The meaning of /SAFESEH is as follows.

 - If /SAFESEH is specified, the linker will produce an executable with SEH table.
   If any input files are not compatible with SEH, it's an error.
 - If /SAFESEH:no is specified, the linker will not emit SEH table even if all
   input files are compatible with SEH.
 - If no option is specified, the linker emits SEH table if all input files are
   compatible with SEH.

llvm-svn: 201895
2014-02-21 22:30:43 +00:00
Shankar Easwaran 9578442fe9 [ELF] Dont generate PHDR when creating dynamic libraries.
llvm-svn: 201741
2014-02-19 23:46:13 +00:00
Shankar Easwaran babba413f5 [ELF] Fix alignment for dynamic relocation sections.
The sections .rela/.rel.(*) have a alignment of 2 in the final image created by
the linker. This needs to be properly set to the right alignment depending on
the architecture(32/64bits).

llvm-svn: 201740
2014-02-19 23:46:08 +00:00
Simon Atanasyan b72ea717d0 [Mips] Use the 'CHECK-NEXT' where we need to check a test output exactly
line by line.

llvm-svn: 201133
2014-02-11 07:17:09 +00:00
Simon Atanasyan 06f8ea4c07 [Mips] Simplify the code. Replace redundant 'switch' operator by the single 'if' one.
llvm-svn: 201131
2014-02-11 06:36:16 +00:00
Simon Atanasyan bf987c2dae [Mips] Handle R_MIPS_COPY relocation.
llvm-svn: 201129
2014-02-11 05:34:02 +00:00
Simon Atanasyan ceb0b86822 [Mips] Add "data" symbols to the test input file. No functional changes.
llvm-svn: 201128
2014-02-11 05:33:53 +00:00
Rafael Espindola 20d93679c7 Update for llvm api change.
llvm-svn: 201109
2014-02-10 20:24:27 +00:00
Nick Kledzik cdf2c8be58 [mach-o] use new way to copy StringRefs
llvm-svn: 200956
2014-02-06 23:48:52 +00:00
Simon Atanasyan 0743a72caa Accept and handle absolute symbols with empty name.
llvm-svn: 200911
2014-02-06 07:35:16 +00:00
Simon Atanasyan b828ebb5dd [Mips] In case of executable file linking MIPS ABI requires to add even
undefined symbols to '.dynsym' if these symbols have corresponding entries
in a global part of GOT.

llvm-svn: 200716
2014-02-03 20:10:40 +00:00
Simon Atanasyan 0912fe06dc [Mips] Unify #include guard names.
llvm-svn: 200715
2014-02-03 20:10:30 +00:00
Rui Ueyama 153ee54008 Untabify.
llvm-svn: 200712
2014-02-03 19:07:38 +00:00
Shankar Easwaran 6e0e1bc859 [ELF] change LayoutBefore Reference to InGroup Reference
This makes it a lot easier for Section Group design.

llvm-svn: 200675
2014-02-03 04:01:14 +00:00