Commit Graph

723 Commits

Author SHA1 Message Date
Shankar Easwaran df4f12bb65 [lld][test] organize test directory. No change in functionality
* Renames few tests which had extension objtxt to test
* created core directory that contains all the core tests

llvm-svn: 189720
2013-08-31 05:59:52 +00:00
Shankar Easwaran 2e4424b431 [lld][ELF] Add Init/Fini support
This creates .init_array/.fini_array section for X86_64 ELF
targets and executes init/fini functions specified by the
-init/-fini options respectively.

llvm-svn: 189719
2013-08-31 05:27:44 +00:00
Shankar Easwaran d26c8e3463 [lld][LinkingContext] Atoms created from command line options should be available in YAML
This adds an API to the LinkingContext for flavors to add Internal files
containing atoms that need to appear in the YAML output as well, when -emit-yaml
switch is used.

Flavors can add more internal files for other options that are needed.

llvm-svn: 189718
2013-08-31 05:27:38 +00:00
Rui Ueyama 981892ab71 Fix build breakage
llvm-svn: 189714
2013-08-31 01:36:36 +00:00
Rui Ueyama e45f37d238 Remove #include, for we don't need the definitions of these classes.
llvm-svn: 189713
2013-08-31 01:28:45 +00:00
Rui Ueyama 51991fed70 Remove dead code.
llvm-svn: 189708
2013-08-30 23:53:06 +00:00
Rui Ueyama 5b41201066 [PECOFF] Add /force:unresolved command line option as a synonym of /force.
llvm-svn: 189614
2013-08-29 21:46:47 +00:00
Rui Ueyama d4b9d068f0 [PECOFF] Fix bug that section grouping may lay out atoms in a wrong order.
We added layout edges to the head atoms in grouped sections. That was wrong,
because the head atom needs to be followed by the other atoms in the *same*
section, not by the other section contents. With this patch, layout edges are
added from tail atom, which is the last atom in a section, to head atom.

llvm-svn: 189573
2013-08-29 07:46:23 +00:00
Rui Ueyama 79e8215f96 [PECOFF] Fix bug that atom size was sometimes wrong.
Because of a bug, the last atom of each section contained a garbage at the
end of its data. In most cases the garbage is harmless but it could have cause
SEGV.

llvm-svn: 189572
2013-08-29 07:34:58 +00:00
Rui Ueyama 5a383d10ac [PECOFF] Add helper functions for debugging
llvm-svn: 189570
2013-08-29 07:17:47 +00:00
Rui Ueyama 67283bc22f [PECOFF] Do not create undefined atom for common symbol.
We were creating undefined atoms for common symbols by mistake. That did not
lead to a link failure, for undefined atoms would be resolved by common symbols
in the same file, but that's a waste of resource.

llvm-svn: 189534
2013-08-28 23:16:04 +00:00
Rui Ueyama 184a4b83d8 [PECOFF] Do not scan the symbol table twice but instead cache aux symbols.
We scanned the symbol table twice; first to gather all regular symbols, and
second to process aux symbols. That's a bit inefficient and complicated. We
can instead cache aux symbols in the first pass, to eliminate the need of the
second pass.

llvm-svn: 189525
2013-08-28 22:27:05 +00:00
Rui Ueyama 9d52a94cd1 [PECOFF] Make command line options case insensitive to match link.exe's behavior.
llvm-svn: 189505
2013-08-28 20:27:41 +00:00
Rui Ueyama c4d793f2ad Remove an option starting an uppercase character so that the test does not depends on sort order.
llvm-svn: 189423
2013-08-28 00:01:57 +00:00
Rui Ueyama b5292e6295 Modify test to adopt r189416.
r189416 changed the order of command line options shown in help message,
so the test needs adjusting.

llvm-svn: 189417
2013-08-27 23:48:49 +00:00
Rui Ueyama a372a9b503 Use do-while instead of a magic number. No functionality change.
llvm-svn: 189413
2013-08-27 23:10:26 +00:00
Rui Ueyama 488d41e6ef [PECOFF] Add the entry symbol and /include symbols to dead strip root set.
Differential Revision: http://llvm-reviews.chandlerc.com/D1527

llvm-svn: 189318
2013-08-27 05:15:20 +00:00
Rui Ueyama 8a5cbadff9 Fix use of temporary strings.
llvm-svn: 189310
2013-08-27 04:27:18 +00:00
Rui Ueyama bc839fcd3e [PECOFF] Enable dead-stripping by default to match link.exe behavior.
llvm-svn: 189308
2013-08-27 03:38:18 +00:00
Rui Ueyama 4c3184f3c0 Treat entry point symbol as an undefined atom.
With this patch the entry symbol is treated as an undefined symbol, to force
the resolver to resolve the entry symbol.

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

llvm-svn: 189307
2013-08-27 03:18:11 +00:00
Rui Ueyama 352e7308c0 Rename ti -> ctx.
This should have been done in r187823 when I renamed LinkingContext
from TargetInfo. I missed a few files.

llvm-svn: 189298
2013-08-27 00:04:42 +00:00
Rui Ueyama c7ef7a8dd7 [PECOFF] Add Support for entry point symbol name
Patch by Jesús Serrano García.

llvm-svn: 189267
2013-08-26 19:55:09 +00:00
Shankar Easwaran f1947537a0 [lld][ELF] Cleanup ELF writing, No change in functionality
The cleanup includes :-

* Rename ambiguous Header class to ELFHeader
* Convert Chunk contentype and kind to be a enumerated class
* Remove functions that are not being used, avoids future confusion

llvm-svn: 189209
2013-08-26 03:16:13 +00:00
Shankar Easwaran da7ceb9b58 [lld][ELF] Indent the td file to < 80 columns
llvm-svn: 189207
2013-08-26 01:56:27 +00:00
Shankar Easwaran 0f2a45cac5 [lld][ELF][Cleanup] Create multiclass for variations in options usage
llvm-svn: 189197
2013-08-25 18:05:15 +00:00
Shankar Easwaran be81dd757e [lld][ELF] process fini_array sections
This change processes fini_array section in addition to processing
init_array sections. This also makes functions registered at compile
time for initialization and finalization to be run during execution

llvm-svn: 189196
2013-08-25 18:05:12 +00:00
Saleem Abdulrasool 1089265a1d [PECOFF] support additional subsystem identifiers
This completes the subsystem name parsing to support the identifiers that the
Microsoft link.exe linker supports.  "windows" and "console" are left as the
first items as they are the expected common paths.

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
llvm-svn: 189181
2013-08-24 20:14:54 +00:00
Rui Ueyama 72165ec8c3 Separates /fixed (no .reloc section) and /dynamicbase (enable ASLR)
in order to match link.exe's behaviour.

Patch by Ron Ofir.

llvm-svn: 189159
2013-08-24 00:39:10 +00:00
Hans Wennborg 2391fddfc7 CMake: Support the LLVM_INSTALL_TOOLCHAIN_ONLY flag
llvm-svn: 189157
2013-08-24 00:24:15 +00:00
Rui Ueyama d07c6f06eb Fixes an additional temporary string use.
Patch by Ron Ofir.

llvm-svn: 189151
2013-08-23 22:06:29 +00:00
Tim Northover 274a023d70 Check for "asserts" rather than "debug" on test
The debug flag being checked for seems to be controlled by whether the
build is asserts/non-asserts rather than debug/non-debug. Mostly these
correlate, but not necessarily.

As far as I can tell with various combinations of debug/assetions this
change makes no difference on autotools builds, but fixes a check-all
failure with CMake.

llvm-svn: 189147
2013-08-23 21:10:37 +00:00
Shankar Easwaran f9fe6250ff [lld][ELF] Dont ignore zero sized sections.
There may be relocations that may be pointing to the section
even if the section sizes are 0. We shouldnot ignore them
for that regard.

llvm-svn: 189139
2013-08-23 20:03:35 +00:00
Shankar Easwaran 78457803bc [lld][ELF][Cleanup] Section associated with the relocation traversed
There is no change in functionality, this uses the defined way to access
the relocation section that belongs to a particular section.

llvm-svn: 189138
2013-08-23 20:03:31 +00:00
Shankar Easwaran d9e0a49357 [lld][ELF] Rename typeTLV content type for ELF
typeTLV content type is used by Darwin to represent thread local
storage. A new contentType has to be made to represent ELF
thread local storage data. These have been set to

- typeThreadZeroFill (represents TBSS storage)
- typeThreadData     (represents TDATA storage)

llvm-svn: 189137
2013-08-23 20:03:28 +00:00
Shankar Easwaran d17ba4bd4d [lld] handle typeZeroFill atoms in ELF/Native/YAML
BSS atoms dont take any file space in the Input file. They are associated
with a contentType(typeZeroFill). Similiar zero fill types also exist which
have the same meaning in terms of occupying file space in the Input.

These atoms have to be handled seperately when writing to the
lld's intermediate file or the lld test infrastructure.

Also adds a test.

llvm-svn: 189136
2013-08-23 20:03:21 +00:00
Hans Wennborg 306db8f3fa CMake: Don't look for llvm-tblgen when building outside LLVM tree
Previously, the CMake build would look for llvm-tblgen to determine
if a directory is an LLVM build or install directory. Since we don't
want to include llvm-tblgen in the install, look for llvm-config instead,
and use that to find llvm-tblgen.

(This is the lld equivalent of Clang r189127.)

llvm-svn: 189128
2013-08-23 18:18:13 +00:00
Shankar Easwaran 89732e1362 [lld][PECOFF] Fix one more reference to a temporary string
llvm-svn: 189035
2013-08-22 17:59:03 +00:00
Shankar Easwaran c48b9594b6 [lld][PECOFF] Fix use of temporary strings
llvm-svn: 189025
2013-08-22 15:37:09 +00:00
Shankar Easwaran ea68a5d636 [lld][unittests] Change assert to llvm_unreachable
llvm-svn: 189023
2013-08-22 15:23:54 +00:00
Shankar Easwaran 1d76b115a3 [lld][test] fix -Wreturn-type error
llvm-svn: 188988
2013-08-22 05:44:08 +00:00
Shankar Easwaran 5677e433d6 fix build failures on platforms that use -Wunused-private-variable for builds
llvm-svn: 188983
2013-08-22 04:24:57 +00:00
Shankar Easwaran b8b42658ea [lld][Driver] Fix the unit test for lld gnu flavor
llvm-svn: 188982
2013-08-22 03:18:01 +00:00
Shankar Easwaran c1ea4572ba [lld][Hexagon] Enable Hexagon sdata sorting test
llvm-svn: 188981
2013-08-22 03:02:17 +00:00
Shankar Easwaran 88d0d44635 [lld] Fix unused private fields for fixing build failure on darwin
llvm-svn: 188978
2013-08-22 01:49:16 +00:00
Shankar Easwaran b4fae7c3d0 remove trailing whitespace
llvm-svn: 188965
2013-08-22 00:08:25 +00:00
Shankar Easwaran 2032609327 [lld][Darwin] fixing an accidentally removed change
llvm-svn: 188963
2013-08-21 23:31:58 +00:00
Shankar Easwaran c4dba32d19 [lld] Fix win7 failure on adding InputGraph functionality
llvm-svn: 188961
2013-08-21 23:13:22 +00:00
Shankar Easwaran e44104b001 add InputGraph functionality
llvm-svn: 188958
2013-08-21 22:57:10 +00:00
Hans Wennborg 04632f1f16 [PECOFF] Handle "--" option explicitly
This used to be handled automagically by the option parsing library,
but after LLVM r188314, we should handle it ourselves.

No functionality change, but adds a test.

llvm-svn: 188318
2013-08-13 21:44:44 +00:00
Rui Ueyama 8432d32c67 [PECOFF] Treat the common symbol as mergeable symbol.
This is a temporary measure because the semantics of the common symbol is
actually more compilcated than the simple mergeable symbol.

llvm-svn: 188235
2013-08-13 00:03:21 +00:00