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
Joey Gouly
cf466800b7
[MachO] Add undefined atoms.
...
llvm-svn: 200649
2014-02-02 19:34:55 +00:00
Simon Atanasyan
e6f6f06c91
[ELF] Customize dynamic table tag used for .got.plt section referencing.
...
The patch reviewed by Shankar Easwaran and Rui Ueyama.
llvm-svn: 200630
2014-02-02 12:19:29 +00:00
Simon Atanasyan
8379ad056d
[Mips] Cleanup assembler code in the test.
...
llvm-svn: 200629
2014-02-02 12:19:20 +00:00
Rui Ueyama
c5326ca9bb
[PECOFF] Add a TODO.
...
llvm-svn: 200599
2014-02-01 00:26:33 +00:00
Rui Ueyama
9661bcf2e1
[PECOFF] Handle /machine option before handling all the other options.
...
The target machine type affects the meaning of other options, in particular
how to mangle symbols. So we want to handle the option first and then parse
all the other options.
llvm-svn: 200589
2014-01-31 22:58:19 +00:00
Rafael Espindola
8c13e51764
Update for llvm api change.
...
llvm-svn: 200575
2014-01-31 21:13:59 +00:00
Rui Ueyama
d0d01c66ba
MSVC2012 does not choose to use uint64_t as underlying type without this.
...
MSVC2012 seems to choose int as the underlying type for an enum even if one of
its member is unsigned long long.
llvm-svn: 200519
2014-01-31 06:28:32 +00:00
Rui Ueyama
14876abb3d
[PECOFF] Set the correct PE header field value.
...
The charcateristics field should not have IMAGE_FILE_32BIT_MACHINE bit but have
IMAGE_FILE_LARGE_ADDRESS_AWARE bit for PE32+.
llvm-svn: 200518
2014-01-31 05:43:12 +00:00
Rui Ueyama
ebc13c47f2
[PECOFF] Do not emit a section if it's empty.
...
The PE32+ loader does not seem to like an executable with an empty section, so
we should not emit a section if it's empty.
llvm-svn: 200514
2014-01-31 05:15:42 +00:00
Rui Ueyama
8851d45cbf
Replace magic numbers with enums.
...
llvm-svn: 200512
2014-01-31 04:57:03 +00:00
Rui Ueyama
ea7e9306c1
[PECOFF] Default image base address for PE32+ is 0x140000000, not 0x400000.
...
llvm-svn: 200511
2014-01-31 04:49:13 +00:00
Simon Atanasyan
bc286a4dbc
[ELF] Make private all DynamicTable class fields which are not used in
...
the descendant classes.
llvm-svn: 200467
2014-01-30 14:20:22 +00:00
Rafael Espindola
8fe1f37c55
Update for llvm api change.
...
llvm-svn: 200443
2014-01-30 02:49:58 +00:00
Shankar Easwaran
b6a6bdab20
[ELF][Hexagon] typeZeroFillQuick is not associated with bss section.
...
We need to increase the memory and the filesize when we add a typeZeroFillQuick
atom.
llvm-svn: 200369
2014-01-29 04:04:27 +00:00
Simon Atanasyan
7aa9061ead
[Mips] Declare MipsDynamicTable class in a separate header file.
...
llvm-svn: 200328
2014-01-28 18:52:41 +00:00
NAKAMURA Takumi
4162034bb5
[CMake] Apply llvm_update_compile_flags() in add_lld_library().
...
Sorry for the breakage.
llvm-svn: 200306
2014-01-28 10:45:37 +00:00
Rui Ueyama
4aaba3e220
[PECOFF] Replace magic numbers with sizeof.
...
llvm-svn: 200278
2014-01-28 01:55:37 +00:00
Rui Ueyama
bdc2fc3635
[PECOFF] Convert more binary files to YAML.
...
Because the object files are now readable to humans, I don't think we need the
source assembly file any more, so I removed them too in this commit.
llvm-svn: 200276
2014-01-28 01:41:39 +00:00
Rui Ueyama
6d3fee23e3
[PECOFF] Remove a redundant test.
...
peplus.test and pe32plus.test basically covered the same thing, so
remove pe32plus.test and then rename peplus.test -> pe32plus.test.
llvm-svn: 200275
2014-01-28 01:36:13 +00:00
Rui Ueyama
dc2f00eead
[PECOFF] Convert a object file to YAML to remove a binary file from SVN.
...
llvm-svn: 200274
2014-01-28 01:32:33 +00:00
Rui Ueyama
a709af2861
s/0/nullptr/
...
llvm-svn: 200272
2014-01-28 01:22:23 +00:00
Rui Ueyama
22291d2cbf
[PECOFF] Implement some relocations for x86-64.
...
llvm-svn: 200240
2014-01-27 19:23:12 +00:00
Rui Ueyama
b73d28525a
[PECOFF] Implement relocations for x86-64.
...
llvm-svn: 200185
2014-01-27 03:53:30 +00:00
Rui Ueyama
7d1bf45047
[PECOFF] Fix PE/COFF optional header size for PE32+.
...
The optional header for PE32+ is a bit larger than PE32 because some of
its fields are extended to 8 bytes.
llvm-svn: 200184
2014-01-27 03:53:26 +00:00
Rui Ueyama
f1a2d55e2b
[PECOFF] Set a proper architecture type to references.
...
Relocations for x64 object files should have reference type of
KindArch::x86_64.
llvm-svn: 200183
2014-01-27 03:53:23 +00:00
Shankar Easwaran
3d8de47f76
Fix trailing whitespace.
...
llvm-svn: 200182
2014-01-27 03:09:26 +00:00
Shankar Easwaran
a64ba010f0
[ELF] Fix comments.
...
The comments in the files that described the file name as part of each file
header ran over 80 columns, which clang-format split over multiple lines.
This commit fixes to make them appear properly.
llvm-svn: 200181
2014-01-27 02:55:08 +00:00
Shankar Easwaran
b11964707c
[ELF] Make changes to all the targets supported currently
...
X86_64,X86,PPC,Hexagon,Mips
No change in functionality.
llvm-svn: 200177
2014-01-27 01:21:02 +00:00
Shankar Easwaran
af7fbd8cf4
[ELF] Create Target specific Writers.
...
llvm-svn: 200176
2014-01-27 01:20:53 +00:00
Shankar Easwaran
e7b831ad35
[ELF] Add Target specific Readers.
...
No change in functionality.
llvm-svn: 200175
2014-01-27 01:02:03 +00:00
Shankar Easwaran
d7de108cde
[ELF] Separate ELFReader classes for subclassing
...
llvm-svn: 200173
2014-01-27 00:45:57 +00:00
Shankar Easwaran
f755ca1685
[ELF] Unify interfaces between DynamicFile/ELFFile.
...
llvm-svn: 200172
2014-01-27 00:40:49 +00:00
Shankar Easwaran
f3db51d06f
[ELF] Separate implementation from the class declaration.
...
ELFFile would be a class that rest of the targets would derive from.
To keep the implementation clean, separate the implementation from
rest of the Header file.
llvm-svn: 200168
2014-01-26 23:57:20 +00:00
Shankar Easwaran
9691b01905
[ELF] Rename File.h to ELFFile.h to avoid confusion.
...
No change in functionality.
llvm-svn: 200166
2014-01-26 23:49:07 +00:00
Shankar Easwaran
b888433e9c
[ELF] Dont include all targets
...
llvm-svn: 200165
2014-01-26 23:47:18 +00:00
Rui Ueyama
56c4611340
[PECOFF] Emit PE32+ file header.
...
llvm-svn: 200128
2014-01-26 05:34:12 +00:00
Rui Ueyama
c6ddf5654c
[PECOFF] Use a shorter name for the parameter.
...
llvm-svn: 200107
2014-01-26 00:37:30 +00:00
Rui Ueyama
76c1b4d0fb
[PECOFF] Set PE32+ magic value if 64 bit.
...
llvm-svn: 200106
2014-01-26 00:35:23 +00:00
Rui Ueyama
7dc69287c1
[PECOFF] Use a shorter name for the PECOFF writer member.
...
llvm-svn: 200052
2014-01-25 00:27:44 +00:00
Rui Ueyama
49bfd5032d
[PECOFF] Accept /machine:x64 option.
...
This is the first patch to support PE32+ format, which is the image format
to use 64 bit address space on Windows/x86-64.
llvm-svn: 200029
2014-01-24 19:17:05 +00:00
Rui Ueyama
87e15c7585
[PECOFF] Use constant instead of magic number.
...
llvm-svn: 200019
2014-01-24 18:03:14 +00:00
Simon Atanasyan
d8cadd6f17
[ELF] Customize a relocation table output format (rel / rela).
...
Add new virtual virtual function `isRelaOutputFormat` to the
`ELFLinkingContext` class. Call this function everywhere we need to
select a relocation table format.
Patch reviewed by Shankar Easwaran and Rui Ueyama.
llvm-svn: 199973
2014-01-24 05:21:21 +00:00
Rafael Espindola
6ba68f10c4
Update for llvm api change.
...
llvm-svn: 199777
2014-01-22 00:14:56 +00:00
Rafael Espindola
79e2d936fd
Update for llvm api change.
...
llvm-svn: 199752
2014-01-21 16:09:55 +00:00
Simon Atanasyan
eafb76ee9b
[Mips] Specify the type of a symbol table entries in the test assembler
...
file.
llvm-svn: 199561
2014-01-18 21:13:05 +00:00
Simon Atanasyan
9dec22dbe2
[Mips] Use explicit assembler instructions in the tests.
...
llvm-svn: 199556
2014-01-18 16:59:19 +00:00
Simon Atanasyan
2f1d6366e7
[Mips] Emit ELF header for MIPS target. ELF flags set is mostly hardcoded.
...
Later we need to improve that solution and build a correct set of flags
by merging ELF flags from all input objects.
llvm-svn: 199555
2014-01-18 16:59:11 +00:00
Simon Atanasyan
0e57a77072
[Mips] Simplify calculations of relocations - replace scatterBits calls
...
by bitwise AND operator and remove redundant local variables.
llvm-svn: 199554
2014-01-18 16:59:00 +00:00
Rui Ueyama
8d7a6f2898
Fix odd titlecasing and spacing in an error message.
...
llvm-svn: 199530
2014-01-18 00:57:40 +00:00
Rui Ueyama
251e68b6ae
Use auto for readability. No functionality change.
...
llvm-svn: 199527
2014-01-18 00:38:44 +00:00
Rui Ueyama
d9696cbda8
Using "final" as a variable name is a bit confusing in C++11, so rename it.
...
llvm-svn: 199526
2014-01-18 00:27:03 +00:00
Simon Atanasyan
9ab3b8db84
[Mips] Allocate local GOT entry for a global symbol defined in an
...
executable file.
llvm-svn: 199517
2014-01-17 21:18:45 +00:00
Simon Atanasyan
362bdc125e
[Mips] Implement .plt and .got.plt section creation.
...
llvm-svn: 199516
2014-01-17 21:18:37 +00:00
Simon Atanasyan
66338224be
[Mips] Handle R_MIPS_26 relocation. Maintaining of .plt and .got.plt
...
sections will be implemented later.
llvm-svn: 199515
2014-01-17 21:18:26 +00:00
Simon Atanasyan
80b86a43d5
[Mips] Provide default name of MIPS-specific interpreter.
...
llvm-svn: 199514
2014-01-17 21:18:14 +00:00
Rui Ueyama
acc795383b
[PECOFF] Tests for DLL name in the export table.
...
llvm-svn: 199428
2014-01-16 21:31:27 +00:00
Rui Ueyama
1792ebc1ab
Relax the expected output so that the tests become robust against llvm-objdump format change.
...
llvm-svn: 199421
2014-01-16 20:41:16 +00:00
Rui Ueyama
2b75630b3b
[PECOFF] Make export table tests readable.
...
llvm-svn: 199409
2014-01-16 18:57:22 +00:00
Rafael Espindola
0de92d53a1
Update for llvm api change.
...
llvm-svn: 199327
2014-01-15 19:38:01 +00:00
Rui Ueyama
4dcc4637b5
[CMake] Add llvm-mc to the list of test dependencies.
...
llvm-svn: 199274
2014-01-14 23:33:04 +00:00
Joey Gouly
010b37691d
[MachO] Begin support for reading fat binaries.
...
llvm-svn: 199259
2014-01-14 22:32:38 +00:00
Simon Atanasyan
13c5ce53dc
[Mips] Do not forget to initialize a class field.
...
llvm-svn: 199241
2014-01-14 18:20:07 +00:00
Simon Atanasyan
e46e2dfe01
[Mips] Calculate gp value only once.
...
llvm-svn: 199240
2014-01-14 18:20:00 +00:00
Simon Atanasyan
db2e1f35d8
[Mips] Create and initialize _gp symbol.
...
llvm-svn: 199239
2014-01-14 18:19:52 +00:00
Simon Atanasyan
3b1a761374
[Mips] Check initialization of _gp_disp and _GLOBAL_OFFSET_TABLE_
...
symbols in case of executable file linking.
llvm-svn: 199238
2014-01-14 18:19:42 +00:00
Simon Atanasyan
6cac582de5
[Mips] Do not store a pointer to the AtomLayout related to the
...
_GLOBAL_OFFSET_TABLE_ symbol. We do not use this ponter anywhere after
assigning of virtual address.
llvm-svn: 199237
2014-01-14 18:19:35 +00:00
Simon Atanasyan
0b4dd91582
[Mips] Factor out constant represents gp value offset to the
...
MipsTargetLayout class method.
llvm-svn: 199236
2014-01-14 18:19:26 +00:00
Simon Atanasyan
acb301fab1
[Mips] Set default executable entry symbol name for MIPS targets. On
...
MIPS the entry symbol name is '__start' instead of '_start'.
llvm-svn: 199235
2014-01-14 18:19:19 +00:00
Simon Atanasyan
663aa62863
[Mips] Set default base address for MIPS executables to 0x400000. Assign
...
the lowest segment address to the MIPS_BASE_ADDRESS dynamic tag.
llvm-svn: 199234
2014-01-14 18:19:12 +00:00
Simon Atanasyan
a565c778b3
[ELF] Fix type of the DefaultLayout::segments() return value. This
...
method returns the DefaultLayout::_segments field. The type of this field is
a vector of Segment<ELFT>* pointers. This type cannot be implicitly casted to
the range<ChunkIter>.
llvm-svn: 199233
2014-01-14 18:19:02 +00:00
Simon Atanasyan
a0f5caac26
[Mips] Add test case to check R_MIPS_HI16 / R_MIPS_LO16 relocations
...
agains _gp_disp symbol.
llvm-svn: 199232
2014-01-14 18:18:56 +00:00
Simon Atanasyan
2a1ae098b3
[Mips] Move got16.test assembler source code to the test file and use
...
llvm-mc for an object file generation.
llvm-svn: 199231
2014-01-14 18:18:49 +00:00
Rui Ueyama
ab9deb5466
[PECOFF] Support STACKSIZE module-definition file directive.
...
llvm-svn: 199170
2014-01-14 00:48:25 +00:00
Rui Ueyama
ca9e99fe50
Add a function to verify an ExportDesc.
...
llvm-svn: 199167
2014-01-14 00:29:26 +00:00
Rui Ueyama
37f5273773
Do not use "auto" where actual type is obvious and short.
...
llvm-svn: 199166
2014-01-14 00:06:50 +00:00
Rui Ueyama
1c1487494d
Reduce even more boilerplate.
...
llvm-svn: 199165
2014-01-13 23:54:49 +00:00
Rui Ueyama
7c13c4459b
Whitespace.
...
llvm-svn: 199164
2014-01-13 23:21:33 +00:00
Rui Ueyama
1090434d39
Reduce the boilerplate in the test cases for the module-definition file.
...
llvm-svn: 199163
2014-01-13 23:13:21 +00:00
Rui Ueyama
cbc6eb3e99
Use bettter names for the tests.
...
llvm-svn: 199161
2014-01-13 23:02:03 +00:00
Rui Ueyama
69c26e903b
[PECOFF] Add another test for the module-definition file parser.
...
llvm-svn: 199159
2014-01-13 22:55:09 +00:00
Rui Ueyama
0c306ba08c
Add comment to bit manipulation functions.
...
llvm-svn: 199156
2014-01-13 22:29:16 +00:00
Joey Gouly
d2215375a8
[MachO] Add basic support for local symbols.
...
llvm-svn: 199155
2014-01-13 22:28:02 +00:00
Nick Kledzik
0052bd4a34
Fix spacing
...
llvm-svn: 199074
2014-01-13 04:08:15 +00:00
Joey Gouly
9c826c100a
Factor the symbol handling in normalizedToAtoms into a separate function.
...
No functionality change.
llvm-svn: 199066
2014-01-12 22:55:49 +00:00
Rui Ueyama
415625028c
[PECOFF] Support VERSION directive.
...
llvm-svn: 199022
2014-01-11 22:45:00 +00:00
Rui Ueyama
605f7791a3
Make anonymous namespace as small as possible.
...
llvm-svn: 199021
2014-01-11 22:15:54 +00:00
Rui Ueyama
b214e1aba2
[PECOFF] Support NAME directive.
...
llvm-svn: 199020
2014-01-11 21:53:46 +00:00
Rui Ueyama
66a4445658
[PECOFF] Add a helper function to read an integer from .def file.
...
llvm-svn: 199019
2014-01-11 21:37:25 +00:00
Rui Ueyama
6cc96bf2d2
[PECOFF] Print a better error message for unknown module-definition file directive.
...
llvm-svn: 199018
2014-01-11 21:24:43 +00:00
Rui Ueyama
6a5f7c22ad
[PECOFF] Support HEAPSIZE directive.
...
llvm-svn: 198994
2014-01-11 01:58:21 +00:00
Rui Ueyama
f98a18acb7
[PECOFF] Refactor module-defintion file parser.
...
Refactor the parser so that the parser can return arbitrary type of parse
result other than a vector of ExportDesc. Parsers for non-EXPORTS directives
will be implemented in different patches. No functionality change.
llvm-svn: 198993
2014-01-11 01:33:42 +00:00
Nick Kledzik
8293c711e7
[yaml] use BumpPtrAllocator for string copies
...
llvm-svn: 198987
2014-01-11 01:11:49 +00:00
Nick Kledzik
6edd722a2c
[mach-o] enable mach-o and native yaml to be intermixed
...
The main goal of this patch is to allow "mach-o encoded as yaml" and "native
encoded as yaml" documents to be intermixed. They are distinguished via
yaml tags at the start of the document. This will enable all mach-o test cases
to be written using yaml instead of checking in object files.
The Registry was extend to allow yaml tag handlers to be registered. The
mach-o Reader adds a yaml tag handler for the tag "!mach-o".
Additionally, this patch fixes some buffer ownership issues. When parsing
mach-o binaries, the mach-o atoms can have pointers back into the memory
mapped .o file. But with yaml encoded mach-o, name and content are ephemeral,
so a copyRefs parameter was added to cause the mach-o atoms to make their
own copy.
llvm-svn: 198986
2014-01-11 01:07:43 +00:00
Rui Ueyama
b8912b4f28
[PECOFF] Add a unit test for r198925.
...
llvm-svn: 198974
2014-01-10 23:29:12 +00:00
Rui Ueyama
8b14d14209
[PECOFF] Support module-definition file.
...
Module-definition (.def) files are the file containing linker directives,
such as export symbols. Because link.exe supports the same features as command
line options, just as some Linker Script commands overlaps with command line
options, use of module-definition file is not really necessary. It provides
an alternative way to specify some linker options.
This patch implements EXPORTS directive. Other directives will be implemented
in the future.
llvm-svn: 198925
2014-01-10 10:19:47 +00:00
Simon Atanasyan
c955a0cfd3
[Mips] Reduce the number of type-casting calls.
...
llvm-svn: 198855
2014-01-09 07:52:31 +00:00
Rui Ueyama
752abd556e
Add a blank line to FileCheck input.
...
FileCheck does not like the empty input file, so adding a blank line to workaround.
llvm-svn: 198839
2014-01-09 02:47:52 +00:00
Rui Ueyama
51a6b87ca3
Write temporary files to Output directory.
...
llvm-svn: 198829
2014-01-09 01:11:51 +00:00
Rui Ueyama
76d2fa70be
[PECOFF] Add a test for r197803.
...
llvm-svn: 198828
2014-01-09 01:11:48 +00:00
Rui Ueyama
c15e1b087b
Add missing triples so that these tests pass on 32 bit arch.
...
llvm-svn: 198812
2014-01-09 00:07:20 +00:00
Simon Atanasyan
7f82bc590d
[Mips] Remove unnecessary #include pragma.
...
llvm-svn: 198798
2014-01-08 22:00:35 +00:00
Rafael Espindola
d28918b289
Use getError instead of the error_code operator.
...
llvm-svn: 198797
2014-01-08 22:00:09 +00:00
Simon Atanasyan
073c2d2974
[Mips] GOT16 relocation against non-local symbol does not require a
...
paired LO16 relocation.
llvm-svn: 198790
2014-01-08 20:43:03 +00:00
Simon Atanasyan
05c88f9b61
[Mips] Add assert to check that we handle all paired relocations.
...
llvm-svn: 198789
2014-01-08 20:42:52 +00:00
Simon Atanasyan
2ab9f28977
[Mips] Factor out the code determines type of GOT entry (local/global)
...
into the separate function.
llvm-svn: 198788
2014-01-08 20:42:45 +00:00
Simon Atanasyan
50cf77bc2f
[Mips] Do not use standard relocation identifier R_MIPS_NONE for
...
internal purpose. Use special LLD_R_MIPS_GLOBAL_GOT constant for that.
llvm-svn: 198787
2014-01-08 20:42:38 +00:00
Simon Atanasyan
fc2e4e6a76
[Mips] Rename function to better reflect its purpose.
...
llvm-svn: 198786
2014-01-08 20:42:30 +00:00
Simon Atanasyan
eef5351416
[Mips] Do not save GOT headers atoms into the RelocationPass class
...
fields.
llvm-svn: 198785
2014-01-08 20:42:23 +00:00
Simon Atanasyan
30464f0293
[Mips] Rename some classes to skip redundant mentioning of 'mips'.
...
llvm-svn: 198784
2014-01-08 20:42:17 +00:00
Simon Atanasyan
6e0232ce59
[Mips] Move MipsGOTPass implementation to the separate file.
...
llvm-svn: 198783
2014-01-08 20:42:11 +00:00
Nick Kledzik
36baa33fc1
[mach-o] properly extract atom content from subrange of section content
...
llvm-svn: 198728
2014-01-08 02:52:58 +00:00
Nick Kledzik
360a1434f0
Use the mach-o MH_* name for file types in yaml
...
llvm-svn: 198725
2014-01-08 01:38:07 +00:00
Rui Ueyama
903b14432d
Remove leading underscore from parameters.
...
llvm-svn: 198642
2014-01-06 22:43:31 +00:00
Rui Ueyama
b5531d7edb
Rename parameters to fix shadow warnings.
...
llvm-svn: 198641
2014-01-06 22:31:01 +00:00
Rui Ueyama
54174c6f16
[PECOFF] Simplify: Replace two-value enum with bool.
...
llvm-svn: 198634
2014-01-06 19:55:58 +00:00
Rui Ueyama
14133d5551
Replace nested switch statements.
...
Differential Revision: http://llvm-reviews.chandlerc.com/D2501
llvm-svn: 198535
2014-01-05 02:41:07 +00:00
Joey Gouly
41cb030b53
[MachO] Add some missing NListTypes.
...
llvm-svn: 198468
2014-01-04 01:22:05 +00:00
Joey Gouly
ceb16dedef
[MachO] Begin to add some MachO specific File/Atoms, and add the start of
...
normalizedToAtoms.
llvm-svn: 198459
2014-01-03 23:12:02 +00:00
Joerg Sonnenberger
03ed4cf0a4
Typo
...
llvm-svn: 198434
2014-01-03 18:43:32 +00:00
Rui Ueyama
76bc5157c2
Use scoped enum.
...
llvm-svn: 198396
2014-01-03 03:29:15 +00:00
Joerg Sonnenberger
1e259e79b9
No else after return.
...
llvm-svn: 198339
2014-01-02 19:30:56 +00:00
Joerg Sonnenberger
4dcee6960f
Add default search path if -nostdlib is not provided.
...
Add basic emulation mapping for NetBSD/amd64, so that clang -m32 works
as expected.
llvm-svn: 198337
2014-01-02 19:18:36 +00:00
Joey Gouly
600bfa42ec
Remove extra semicolon.
...
llvm-svn: 198275
2014-01-01 10:07:45 +00:00
NAKAMURA Takumi
d40d387fb1
Update the copyright credits -- Happy new year 2014!
...
FIXME: Dragonegg may be updated at non-trivial changes.
llvm-svn: 198274
2014-01-01 08:27:31 +00:00
Joey Gouly
0518453e2e
The return value of createInternalFiles is unused, so remove it.
...
llvm-svn: 198266
2013-12-31 19:15:42 +00:00
Rui Ueyama
93f760468e
Simplify if ... return repetition.
...
llvm-svn: 198108
2013-12-28 10:09:21 +00:00
Rui Ueyama
ffd810525d
[PECOFF] Warn only when /export options are not compatible.
...
Currently LLD always print a warning message if the same symbol is specified
more than once for /export option. It's a bit annoying because specifying the
same symbol with compatible options is actually safe and considered as a
normal use case. This patch makes LLD to warn only when incompatible export
options are given.
llvm-svn: 198104
2013-12-28 08:40:37 +00:00
Rui Ueyama
02dfdbcbd6
temporary commit
...
llvm-svn: 198103
2013-12-28 08:40:23 +00:00
Rui Ueyama
ad79838aa8
[PECOFF] Use std::set to store export symbol descriptors.
...
Each export symbol descriptor has unique name attribute, so std::set is
better container than std::vector for it. No functionality change.
llvm-svn: 198102
2013-12-28 08:11:21 +00:00
Joey Gouly
53c99b78a8
Fix a gcc-4.8 warning, about extraneous semicolons.
...
llvm-svn: 198091
2013-12-28 00:46:57 +00:00
Rui Ueyama
ce9b9abb15
[PECOFF] Add file extensions to temporary files.
...
No functionality change.
llvm-svn: 198075
2013-12-27 08:37:40 +00:00
Rui Ueyama
c96b41c375
[PECOFF] Add a test for /noentry.
...
llvm-svn: 198074
2013-12-27 08:19:21 +00:00
Rui Ueyama
e6ed0f255f
[PECOFF] Change the DLL entry symbol.
...
I'm not 100% sure but it looks like DLL entry symbol (DLL initializer function
name) should be _DllMainCRTStartup@12. The reason why I'm not very sure is
because I have no idea what "@12" suffix is, but without it the symbol won't
be resolved...
llvm-svn: 198072
2013-12-27 07:14:34 +00:00
Rui Ueyama
d0cce867ae
[PECOFF] Parse .drectve section before reading other file contents.
...
Currently .drectve section contents are parsed after other sections are parsed.
That order may result in wrong results if other sections depend on command line
options in the directive section.
For example, if a weak symbol is defined using /alternatename option in the
directive section, we have to read it first and then read the text section
contents. Otherwise the weak symbol won't be defined.
This patch changes the order to fix the issue.
llvm-svn: 198071
2013-12-27 07:05:04 +00:00
Rui Ueyama
ae50a9e676
[PECOFF] Skip empty .drectve sections.
...
There are many object files in the standard library who have empty .drective
sections. Parsing the empty string is not wrong but a waste.
llvm-svn: 198067
2013-12-27 03:34:34 +00:00
Rui Ueyama
9e26f5f397
Fix comment.
...
llvm-svn: 198066
2013-12-27 02:51:53 +00:00
Rui Ueyama
fc5f18ba0d
Fix a bug that undefined symbols are not reported if dead-stripping is enabled.
...
There was a bug that the linker does not report an error if symbols specified
by -u (or /include on Windows) are not resolved. This patch fixes it by adding
such symbols to the dead strip root.
llvm-svn: 198041
2013-12-26 08:37:16 +00:00
Rui Ueyama
841016aeba
Remove unnecessary call of DenseMap::clear.
...
It should be always true that _liveAtoms is empty, so we don't have to clear it.
Add an assert() instead.
llvm-svn: 198040
2013-12-26 08:11:06 +00:00
Rui Ueyama
e5531fae6c
Micro-optimize Resolver::markLive().
...
This patch eliminates one std::set lookup per a function call.
llvm-svn: 198037
2013-12-26 07:13:28 +00:00
Rui Ueyama
c481b5b66d
Simplify. No functionality change.
...
llvm-svn: 198036
2013-12-26 07:02:33 +00:00
Rui Ueyama
0cbd7e0d03
Do not make an unnecessary copy of DenseMap.
...
llvm-svn: 198035
2013-12-26 06:57:37 +00:00
Rui Ueyama
61b851ab06
Remove duplicate methods.
...
llvm-svn: 198034
2013-12-26 06:35:35 +00:00
Rui Ueyama
b561f9eb0d
[PECOFF] Fix wrong message.
...
llvm-svn: 198033
2013-12-26 06:26:47 +00:00
Rui Ueyama
610d90b283
[PECOFF] Do not accept "/include <string>" option.
...
Command line argument separator on Windows is colon. We used to accept space
as a separator, but we removed most of the code for that. This patch is to
delete the remaining code.
llvm-svn: 198032
2013-12-26 06:00:26 +00:00
Joey Gouly
9d263e0afe
Fix some indentation issues, I saw while reading this file.
...
llvm-svn: 198024
2013-12-25 19:39:08 +00:00
Rui Ueyama
208915b5ea
Add a newline to an error message.
...
llvm-svn: 198016
2013-12-25 13:48:26 +00:00
Rui Ueyama
cc66ff6776
[PECOFF] Set default subsystem to the DLL header.
...
Subsystem field in the PE/COFF file header has no meanining for the DLL.
It looks like MSVC link.exe sets the default subsystem (Windows GUI) to
the field if no /subsystem option is specified.
llvm-svn: 198015
2013-12-25 13:34:31 +00:00
Rui Ueyama
3c849f6a06
Unbreak buildbot.
...
llvm-svn: 198002
2013-12-25 07:28:34 +00:00
Rui Ueyama
a15ba5b71b
Use EXPECT_EQ in unit tests.
...
llvm-svn: 197999
2013-12-25 06:47:40 +00:00
Rui Ueyama
cf4616110c
[PECOFF] Use the first definition of an export if specified multiple times.
...
If the same symbol is specified multiple times as arguments of /export, the
first definition should be used.
llvm-svn: 197998
2013-12-25 06:46:45 +00:00
Joey Gouly
2008d31d06
Fix copy/paste error.
...
llvm-svn: 197990
2013-12-24 20:43:54 +00:00
Rui Ueyama
090a7cd76d
[PECOFF] Fix /export option in the .drectve section.
...
/EXPORT option has slightly different semantics if it appears in the .drectve
section. This patch implements it.
llvm-svn: 197970
2013-12-24 09:15:57 +00:00
Joey Gouly
b275d7f8f3
Fix indentation in the MachO writer.
...
llvm-svn: 197925
2013-12-23 23:29:50 +00:00
Nick Kledzik
6960b07b92
[mach-o] add MachOLinkingContext::configure(type, arch, os)
...
It will configure resonable defaults for other settings in the
MachOLinkingContext object based on the parameters.
Patch by Joe Ranieri
llvm-svn: 197851
2013-12-21 01:47:17 +00:00
Joey Gouly
72c5d3d7c1
REQUIRES: debug doesn't actually do anything!
...
Makes the tests pass (rather, not run) on release builds.
llvm-svn: 197838
2013-12-20 22:01:26 +00:00
Nick Kledzik
f30e848432
Restore vertical alignment lost by clang-format
...
llvm-svn: 197834
2013-12-20 20:34:19 +00:00
Rui Ueyama
d4f66c7d5f
[PECOFF] Create noname or data symbols as such.
...
If a symbol in an import library is marked as "data", the linker will not
create a jump table entry for the symbol, since jump table makes sense only
for a symbol pointing to a function.
I don't think NONAME attribute has a meaning when creating an import library.
The attribute is emitted for debugging purpose.
llvm-svn: 197803
2013-12-20 11:50:19 +00:00
Rui Ueyama
d07c1be171
[PECOFF] Create the import library file.
...
If the linker is instructed to create a DLL, it will also create an import
library (.lib file) to describe the symbols exported by the DLL. This patch is
to create the import library file.
There is a convenient command "lib.exe" which can create an import library
from a module definition file (.def file). The command is used in this patch.
llvm-svn: 197801
2013-12-20 11:35:40 +00:00
Rui Ueyama
4af032dce7
[PECOFF] Assign default export ordinals in LinkingContext::verify().
...
Default ordinals were assigned in EdataPass, and the assigned values were
then discarded in the pass. No code other than EdataPass would not be able
to get all of the information about ordinals. That's not ideal since I'm
writing code to emit an Import Library file, which also needs ordinals.
This is a patch to move the code to assign default ordinals from EdataPass
to LinkingContext::verify(), so that assigned ordinals will be available
anywhere.
No functionality change.
llvm-svn: 197797
2013-12-20 10:02:59 +00:00