Commit Graph

906 Commits

Author SHA1 Message Date
Nick Kledzik 2453a3d956 Bug 17569: add namespaces to work with gcc-4.7
llvm-svn: 192627
2013-10-14 21:24:48 +00:00
Shankar Easwaran 2595e71849 [cleanup] Remove single-statement if blocks
llvm-svn: 192614
2013-10-14 19:58:12 +00:00
Rui Ueyama a1490d616f Prune unused local variable.
llvm-svn: 192509
2013-10-11 22:02:58 +00:00
Shankar Easwaran 11202deb4a [ELF] Add alias options for start-group/end-group options.
There are aliases for --start-group/--end-group options represented
by -( and -) respectively in the command line.

This change adds and improves the test for the alias options to be
tested.

Looks like users use this option widely than explicitly using
--start-group/--end-group.

llvm-svn: 192470
2013-10-11 17:59:47 +00:00
Rui Ueyama 8e5c2788f6 Simplify unique_ptr instantiation. No functionality change.
llvm-svn: 192427
2013-10-11 07:42:08 +00:00
Rui Ueyama 2ad117db97 Propagate Resolver::resolveUndefines()'s failure to caller.
llvm-svn: 192424
2013-10-11 06:26:16 +00:00
Rui Ueyama f1e266846d Remove excessive allowRemainingUndefines() check.
allowRemainingUndefines() is already checked in Resolver::resolve(), so we
don't need to check it again after returning from it. It's actually not only
superfluous but buggy because a failure of resolve() does not always mean that
there is a remaining undefines.

llvm-svn: 192423
2013-10-11 06:16:35 +00:00
Rui Ueyama ee366042e9 Return true from Resolver::resolve() on success.
llvm-svn: 192422
2013-10-11 06:16:33 +00:00
Rui Ueyama ced511b7c1 Replace a recursive tail call with an infinite loop.
This eliminates _elements's size check from the loop.

llvm-svn: 192418
2013-10-11 04:20:29 +00:00
Rui Ueyama a4770543f1 Remove an unused variable added in r192415.
llvm-svn: 192416
2013-10-11 03:51:19 +00:00
Rui Ueyama d542b9e53a Use switch instead of if, and handle all enum values.
This patch also handles errors other than no_more_files error. They were silently
ignored.

llvm-svn: 192415
2013-10-11 03:48:06 +00:00
Shankar Easwaran 80c33aa3d7 Fix return after llvm_unreachable
llvm-svn: 192414
2013-10-11 03:41:24 +00:00
Shankar Easwaran bcf36560fd [ELF] Fix Atoms in the same file had overlapping ordinals.
This also reverts the LayoutPass to use std::sort as all files
have an ordinal now.

llvm-svn: 192409
2013-10-11 01:50:04 +00:00
Rui Ueyama b916e84672 Fix typo
llvm-svn: 192401
2013-10-10 22:29:48 +00:00
Shankar Easwaran 26594caec4 [ELF] Initial design to handle Linker scripts for ELF.
llvm-svn: 192369
2013-10-10 17:27:49 +00:00
Shankar Easwaran 5d859e05f2 [test] Ignore failure for now for Darwin.
This is only a step to clean the buildbot.

llvm-svn: 192368
2013-10-10 17:12:50 +00:00
Shankar Easwaran c5ed819b02 [ELF] Return error from invalid linker script parse.
llvm-svn: 192360
2013-10-10 16:59:53 +00:00
Rui Ueyama 9f3a77a9f4 [PECOFF] Add files appear in .drectve to input graph
-- so that command line options to specify new input files, such as
/defaultlib:foo, is handled properly. Such options were ignored before
this patch.

llvm-svn: 192342
2013-10-10 05:39:43 +00:00
Rui Ueyama 85cc66d85e Do not process .objtxt file twice.
A file with .objtxt extension is parsed in readFile(), but because we did not
propagate that information to the calling side, calling side would try to parse
it again. This patch will fix the issue by adding an extra parameter to
readFile().

llvm-svn: 192311
2013-10-09 18:14:23 +00:00
Shankar Easwaran 95d4e61411 [ELF] Change MaxAlignment to 2.
llvm-svn: 192310
2013-10-09 18:12:31 +00:00
Shankar Easwaran 49408ece47 [Layout] Dont set ordinals to Files by default.
This change removes code in various places which was setting the File Ordinals.
This is because the file ordinals are assigned by the way files are resolved.

There was no other way than making the getNextFileAndOrdinal be set const and
change the _nextOrdinal to mutable.

There are so many places in code, that you would need to cleanup to make
LinkingContext non-const!

llvm-svn: 192280
2013-10-09 07:32:47 +00:00
Shankar Easwaran 30c4d11395 [cleanup] remove unused private variable
llvm-svn: 192278
2013-10-09 05:37:01 +00:00
Shankar Easwaran 1d3c48f1fc [Layout] Assign ordinals in Resolution order.
llvm-svn: 192277
2013-10-09 05:23:23 +00:00
Shankar Easwaran 091a18070b [test] Just use the exit code from the test for now.
Will fix this in later commits. Not sure why the regex is not passing.

llvm-svn: 192273
2013-10-09 04:30:17 +00:00
Shankar Easwaran 127d04a440 [test] Fix regex for failing test on bot
llvm-svn: 192270
2013-10-09 03:53:32 +00:00
Shankar Easwaran 03f7763d21 [inputGraph] Associate Resolve state with appropriate nodes
This associates resolveState to FileNodes. The control node derive
their resolution state from the inputElements that are contained in
it.

This makes --start-group/--end-group to work with ELF linking.

llvm-svn: 192269
2013-10-09 03:40:29 +00:00
Rui Ueyama c6015f6476 Update error classes from all lowercase to camel case.
llvm-svn: 192261
2013-10-09 00:57:22 +00:00
Rui Ueyama 1c1b443997 Move a local variable into while-loop scope.
llvm-svn: 192260
2013-10-09 00:42:57 +00:00
Rui Ueyama 74cc8e1e80 Fix flaky elf/X86_64/dynlib-search.test.
Output to llvm::err() is not guaranteed to be thread-safe, so it needs
to be guarded with a lock.

Differential Revision: http://llvm-reviews.chandlerc.com/D1862

llvm-svn: 192250
2013-10-08 23:01:52 +00:00
Rui Ueyama f96416d750 Use size_t for array index.
llvm-svn: 192249
2013-10-08 23:01:49 +00:00
Rui Ueyama f890d3bf26 Fix #endif comment.
llvm-svn: 192230
2013-10-08 20:24:25 +00:00
Rui Ueyama 88b24ffe73 Use size_t instead of int64_t for the vector size.
llvm-svn: 192229
2013-10-08 20:24:23 +00:00
Shankar Easwaran 7f1146c494 [LinkingContext] make LinkingContext non-const
llvm-svn: 192183
2013-10-08 15:43:48 +00:00
Shankar Easwaran f876ecf5ed [Cleanup] Remove file thats not being used
llvm-svn: 192172
2013-10-08 06:05:38 +00:00
Rui Ueyama 9a13ac9a40 Move duplicate code in InputGraphs to the parent class.
llvm-svn: 192170
2013-10-08 05:52:01 +00:00
Rui Ueyama 492048bf60 Rename GnuLd's path() too.
llvm-svn: 192169
2013-10-08 05:23:03 +00:00
Rui Ueyama 53f31af7ea Rename path() -> getPath().
Differential Revision: http://llvm-reviews.chandlerc.com/D1853

llvm-svn: 192167
2013-10-08 04:57:08 +00:00
Rui Ueyama 7deb970d66 Use size_t instead of uint64_t to represent the vector length.
llvm-svn: 192165
2013-10-08 03:59:50 +00:00
Rui Ueyama a1d4c10c61 Remove an unnecessary local variable.
llvm-svn: 192164
2013-10-08 03:59:48 +00:00
Rui Ueyama 8b8e5216af Make bitmask an unsigned type.
llvm-svn: 192163
2013-10-08 03:59:45 +00:00
Rui Ueyama 7a633b4de5 Expand auto for readability.
llvm-svn: 192162
2013-10-08 03:59:42 +00:00
Nick Kledzik 369ffd1c55 fix typos
llvm-svn: 192154
2013-10-08 02:07:19 +00:00
Nick Kledzik 58070025ca fix all EXPECT_EQ(.address) tests
llvm-svn: 192153
2013-10-08 01:27:03 +00:00
Nick Kledzik 7e28e75570 fix test case failing on bot
llvm-svn: 192152
2013-10-08 01:12:35 +00:00
Rui Ueyama 094546836b Add comments. Early return.
llvm-svn: 192149
2013-10-08 00:43:53 +00:00
Rui Ueyama f8c54842d6 Convert error code structs to scoped enums.
Summary:
The original code with enum "_" is intended to emulate scoped enums.
Now we have real scoped enums, so use it.

Reviewers: Bigcheese

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1852

llvm-svn: 192148
2013-10-08 00:43:50 +00:00
Nick Kledzik 30332b19d3 Supoort mach-o encoded in yaml.
This is the first step in how I plan to get mach-o object files support into 
lld. We need to be able to test the mach-o Reader and Write on systems without 
a mach-o tools. Therefore, we want to support a textual way (YAML) to represent 
mach-o files.

MachONormalizedFile.h defines an in-memory abstraction of the content of mach-o  
files. The in-memory data structures are always native endianess and always
use 64-bit sizes. That internal data structure can then be converted to or
from three different formats: 1) yaml (text) encoded mach-o, 2) binary mach-o
files, 3) lld Atoms.

This patch defines the internal model and uses YAML I/O to implement the 
conversion to and from the model to yaml. The next patch will implement
the conversion from normalized to binary mach-o.

This patch includes unit tests to validate the yaml conversion APIs.

llvm-svn: 192147
2013-10-08 00:43:34 +00:00
Rui Ueyama 4c4d572795 Rename lld:*_error::_ -> lld:*_error::ErrorCode.
Summary: Rename lld:*_error::_ -> lld:*_error::ErrorCode.

Reviewers: shankarke

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1851

llvm-svn: 192138
2013-10-07 21:58:51 +00:00
Shankar Easwaran bafdf7be83 [lld][Darwin] Fix unused field warning.
This field would eventually be used.

llvm-svn: 192084
2013-10-07 03:18:33 +00:00
Shankar Easwaran 18318e32a9 [lld][inputgraph] Fix build failure on Darwin/Windows
llvm-svn: 192083
2013-10-07 03:06:04 +00:00