Commit Graph

417 Commits

Author SHA1 Message Date
Michael J. Spencer f35c3e434a [ELF] Use TargetRelocationHandler to apply relocations.
llvm-svn: 173911
2013-01-30 07:46:31 +00:00
Michael J. Spencer 409a737f36 [ELF] Add {Hexagon,PPC,X86}TargetHandler.
llvm-svn: 173909
2013-01-30 07:36:45 +00:00
Shankar Easwaran 072031a265 change the function names in RelocationHelper to adhere to convention
llvm-svn: 173908
2013-01-30 07:36:09 +00:00
Shankar Easwaran 396e4c0b13 change DefaultLayout to TargetLayout inside member variables
llvm-svn: 173906
2013-01-30 07:19:57 +00:00
Shankar Easwaran a6f00fe083 add targethandler hooks from Writer and cleanup
llvm-svn: 173904
2013-01-30 07:11:43 +00:00
Michael J. Spencer 457a77739b [ELF][x86-64] Add X86_64TargetRelocationHandler and friends.
llvm-svn: 173897
2013-01-30 05:26:03 +00:00
Michael J. Spencer 4e9d9cd23b [ELF] Add ELFTargetRelocationHandler.
llvm-svn: 173896
2013-01-30 05:25:44 +00:00
Shankar Easwaran a51870b143 add Relocation helper functions
llvm-svn: 173895
2013-01-30 04:49:54 +00:00
Michael J. Spencer 4260657fab [ELF] Make AtomLayout more accessible.
This is needed to allow constant time access to the final layout of atoms.

llvm-svn: 173874
2013-01-30 01:25:06 +00:00
Michael J. Spencer e68f90355c [ELF] Chop the ELF prefix off of most things.
llvm-svn: 173838
2013-01-29 22:03:39 +00:00
Shankar Easwaran 185e8a076d remove targetInfo and layout from ELFTargetLayout
llvm-svn: 173824
2013-01-29 20:13:16 +00:00
Michael J. Spencer 43ecac5a2c [ELF] Fix header sort order.
llvm-svn: 173822
2013-01-29 19:53:41 +00:00
Michael J. Spencer 289dcedea5 [ELF] Add support for IFUNC.
This sadly doesn't have a test for the final
output because llvm-objdump can't dump relocations
that don't belong to a section :(

llvm-svn: 173808
2013-01-29 16:38:03 +00:00
Michael J. Spencer bf77be3ba5 [ELF] Give Chunk a ELFTargetInfo.
llvm-svn: 173743
2013-01-29 01:07:47 +00:00
Michael J. Spencer adfb7eb211 [ELF] Remove OwningPtr from the Chunk::write interface.
llvm-svn: 173741
2013-01-29 01:00:21 +00:00
Michael J. Spencer bdf8bc8315 [ELF] Clean up doxygen comments.
llvm-svn: 173740
2013-01-29 01:00:04 +00:00
Shankar Easwaran 072fb1a403 add register section, remove contentType from sectionKey
llvm-svn: 173709
2013-01-28 19:21:04 +00:00
Michael J. Spencer d269a3e281 [ELF] Use correct regex in test.
llvm-svn: 173665
2013-01-28 06:11:39 +00:00
Michael J. Spencer 990ec2b223 [ELF] Use entry point from LinkerOptions.
Patch by Ahmed Bougacha!

llvm-svn: 173655
2013-01-28 04:15:44 +00:00
Benjamin Kramer ac49d37a63 lldX86_64ELFTarget depends on lldCore.
llvm-svn: 173573
2013-01-26 13:49:19 +00:00
Michael J. Spencer 20231f1275 Use proper delete.
llvm-svn: 173570
2013-01-26 12:26:56 +00:00
Michael J. Spencer 5ba1a96a10 [ELF][x86-64] Add relocation string<->kind.
llvm-svn: 173533
2013-01-25 23:48:58 +00:00
Michael J. Spencer 866e0f8a8c [ELF][X86-64] Use the correct base address.
llvm-svn: 173527
2013-01-25 23:23:24 +00:00
Michael J. Spencer 385f312686 [CMake] Setup include dirs properly.
llvm-svn: 173488
2013-01-25 20:50:01 +00:00
Shankar Easwaran 4277c2d6bf change all occurences of File to FileELF
llvm-svn: 173449
2013-01-25 15:19:02 +00:00
Shankar Easwaran 3256d4ff62 add elf targethandler
llvm-svn: 173430
2013-01-25 07:39:18 +00:00
Michael J. Spencer 88f4d24e4a [Driver] Run the pass manager.
llvm-svn: 173381
2013-01-24 22:52:42 +00:00
Michael J. Spencer 19c4756ff2 Move SimpleAtoms.h to ReaderWriter.
llvm-svn: 173380
2013-01-24 22:52:25 +00:00
Nick Kledzik 36293f6512 Add SectionPosition and OrderPass
llvm-svn: 173300
2013-01-23 22:32:56 +00:00
Michael J. Spencer 563d33a6f1 [ELF] Read IFUNC symbols correctly as typeResolver.
llvm-svn: 173299
2013-01-23 22:08:46 +00:00
Michael J. Spencer c0d3c4efe6 Add PassManager.
It owns and manages passes.

llvm-svn: 173287
2013-01-23 20:03:10 +00:00
Shankar Easwaran c142874c9c change from using 2 bits to 4 bits, as 2 bits arent enough to hold the enumeration OutputKind
llvm-svn: 173266
2013-01-23 15:11:22 +00:00
Michael J. Spencer 64afcb4c6b Move everything over to TargetInfo.
I really would have liked to split this patch up, but it would greatly
complicate the lld-core and lld drivers having to deal with both
{Reader,Writer}Option and TargetInfo.

llvm-svn: 173217
2013-01-23 01:18:43 +00:00
Michael J. Spencer 4586fbcbad [Core] Move Resolver and SymbolTable over to TargetInfo.
No functionality change.

llvm-svn: 173192
2013-01-22 20:49:42 +00:00
Shankar Easwaran 58ad41b563 change enum class to enum, as g++ doesnot support bitfields with enumerated classes with c++11 flag set
llvm-svn: 173166
2013-01-22 14:58:51 +00:00
Shankar Easwaran c7176430dc it looks like g++ 4.7.2 doesnot like bit fields when the type is a enumeration (Throws an error as bit-field with non integral type)
llvm-svn: 173125
2013-01-22 04:12:03 +00:00
Michael J. Spencer d68d6196af Add {,ELF,MachO}TargetInfo.
llvm-svn: 173117
2013-01-22 02:15:30 +00:00
Shankar Easwaran 6d9921fc53 no functionality changes(split WriterELF into multiple files)
llvm-svn: 173082
2013-01-21 20:09:55 +00:00
Michael J. Spencer 8af48f3864 [Core] Use LLVM's ErrorOr<T>.
llvm-svn: 172993
2013-01-20 21:27:05 +00:00
Michael J. Spencer 359e09d4f5 [docs] Document lld's usage of C++11 features.
llvm-svn: 172972
2013-01-20 10:39:17 +00:00
Chandler Carruth b5f3bd956c Replace the 'final' keyword with 'LLVM_FINAL' as GCC 4.6 doesn't support
the keyword.

If anyone cares deeply about the final optimizations with GCC, we might
want to add a version test to the LLVM definition, but I'm perfectly
happy with this just only firing under Clang and modern MSVC builds.

llvm-svn: 172898
2013-01-19 09:57:51 +00:00
Chandler Carruth 8b95c03fca Allow the LLD CMake build to work with -std=gnu++0x and -std=gnu++11 as
well as c++0x and c++11. This can be especially useful when building
with GCC in C++11 mode.

llvm-svn: 172897
2013-01-19 09:41:42 +00:00
Chandler Carruth 058761266d Fix the build with libstdc++ v4.6 on Linux by supplying an explicit move
assignment operator. There is an issue where classes with deleted copy
constructors and user defined move constructors end up with an
implicitly deleted copy constructor that is selected instead of the
implicit move constructor. This is a bit of a hack, but it allows me to
build LLD in a bootstrap with libstdc++ which is my primary goal.

llvm-svn: 172896
2013-01-19 09:38:14 +00:00
Michael J. Spencer a17b72e7cf [Core] Fix passing an rvalue reference of ErrorOr.
llvm-svn: 172850
2013-01-18 21:42:01 +00:00
Michael J. Spencer 71c00f42bd [ELF] Use operator new(std::size_t, BumpPtrAllocator).
llvm-svn: 172675
2013-01-16 23:34:45 +00:00
Michael J. Spencer 84d3b01fb5 [ELF] clang-format ReaderELF.cpp
llvm-svn: 172674
2013-01-16 23:34:32 +00:00
Michael J. Spencer fe71a50494 Trailing whitespace.
llvm-svn: 172554
2013-01-15 21:13:14 +00:00
Michael J. Spencer 8b3898af26 [ELF] Never allocate content to weak symbols as they may be merged away.
This is done by creating a new non-weak anonymous symbol and creating
an atom with content for that symbol. This is added after the weak symbol
so that they have the same address.

llvm-svn: 172553
2013-01-15 21:13:02 +00:00
Michael J. Spencer 842885e06e [ELF] Refactoring and style cleanup. No functionality change.
llvm-svn: 172552
2013-01-15 21:12:45 +00:00
Michael J. Spencer b03f6c489a [ELF] Update for LLVM Object/ELF changes.
llvm-svn: 172516
2013-01-15 07:53:22 +00:00
Michael J. Spencer bb78a04088 [ELF] Replace [...] x_{begin,end}() with range<[...]> x().
llvm-svn: 172513
2013-01-15 06:55:37 +00:00
Michael J. Spencer aa3aa570dc [Core] Add iterator ranges.
This is based on code by Jeffrey Yasskin. It has been modified to compile
with MSVC and reformated to LLVM style.

llvm-svn: 172512
2013-01-15 06:55:25 +00:00
Michael J. Spencer 7fe77f8c61 [ELF] Fix use of LLVM RTTI.
llvm-svn: 172511
2013-01-15 06:55:11 +00:00
Shankar Easwaran f6dc082f91 remove const from FindByName
llvm-svn: 172507
2013-01-15 03:02:33 +00:00
Michael J. Spencer ed1950719b [docs] Add driver documentation.
This gives an overview of the driver and explains how to add options and driver flavors.

llvm-svn: 172502
2013-01-15 02:00:59 +00:00
Michael J. Spencer 31dffbb659 [docs] Update status.
llvm-svn: 172501
2013-01-15 02:00:48 +00:00
Nick Kledzik 233f537799 Add new merge-by-content Merge attribute for use by anonymous
constants and string literals which the linker should coalesce.

llvm-svn: 172495
2013-01-15 00:17:57 +00:00
Nick Kledzik 343ecbd6ba Fix shadowed variable warning
llvm-svn: 172482
2013-01-14 22:10:22 +00:00
Michael J. Spencer ca20ffbab2 [test] Fix tests on Windows.
llvm-svn: 172339
2013-01-13 01:09:51 +00:00
Michael J. Spencer 74ba722be1 [YAML] Fix undefined behavior.
llvm-svn: 172338
2013-01-13 01:09:39 +00:00
Michael J. Spencer 57752dc56e Factor File::addAtom out to MutableFile::addAtom.
This removes a bunch of llvm_unreachables and makes a File's mutability part of the type system.

llvm-svn: 172297
2013-01-12 02:45:54 +00:00
Michael J. Spencer 3756852d62 [ELF] Fix comment.
llvm-svn: 172266
2013-01-11 22:39:56 +00:00
Michael J. Spencer 4ffbd608cd [ELF] Add AtomLayout instead of using pair<Atom, pair<uint64_t, uint64_t>>.
llvm-svn: 172265
2013-01-11 22:39:44 +00:00
Michael J. Spencer 2a5763cd86 [ELF] Use the correct cast.
llvm-svn: 172264
2013-01-11 22:39:31 +00:00
Michael J. Spencer bbe4b9812b [ELF] Simplify assert.
llvm-svn: 172255
2013-01-11 21:38:36 +00:00
Shankar Easwaran b1d09c07f1 better implementation for findOutputSection
llvm-svn: 172236
2013-01-11 18:56:11 +00:00
Shankar Easwaran 7381db059a add noinhibit exec option
llvm-svn: 172204
2013-01-11 15:11:47 +00:00
Shankar Easwaran d127d8169a add hexagon target to lld
llvm-svn: 172202
2013-01-11 15:01:04 +00:00
Michael J. Spencer ecd5f4062f [ELF] Add support for __init_array_{start,end}.
With this change c++ global constructors and destructors work.

llvm-svn: 172133
2013-01-10 22:41:42 +00:00
Michael J. Spencer 36b9b8f945 [ELF] Fix leading 0 count. Matches change in llvm.
llvm-svn: 172132
2013-01-10 22:41:19 +00:00
Michael J. Spencer aa8a5a2ab2 [ELF] Fixed -Wunused in -asserts mode.
llvm-svn: 172131
2013-01-10 22:41:05 +00:00
Shankar Easwaran 37c528259a style changes
llvm-svn: 172080
2013-01-10 18:16:10 +00:00
Shankar Easwaran 2ca8e7d733 support for adding linker defined symbols
llvm-svn: 172040
2013-01-10 03:16:27 +00:00
Michael J. Spencer ad5f00ea2d [Archive] Use a hash map to lookup symbols in archives. Increases performance of linking lua by ~6x.
llvm-svn: 172028
2013-01-10 01:27:45 +00:00
Michael J. Spencer 41d9dc56d3 Style fixes.
llvm-svn: 171997
2013-01-09 20:39:07 +00:00
Michael J. Spencer cf2306fe2b Fix the elf/rodata.objtext test to work when first run.
llvm-svn: 171992
2013-01-09 20:10:30 +00:00
Nick Kledzik cc3d2dca60 Better tie together ContentType and Permissions.
Since most content types (e.g. typeCode) have a 
preferred Permission, add a function to do that mapping.
Then hook up to YAML Reader and Writer such that
the 'permissions:' key does not need to be specified unless
overriding what the content type prefers.

llvm-svn: 171929
2013-01-09 01:17:12 +00:00
Nick Kledzik bd49198409 add extra namespace for gcc-4.7 compatibility
llvm-svn: 171918
2013-01-08 23:51:03 +00:00
Nick Kledzik 80fe907903 fix typo
llvm-svn: 171916
2013-01-08 23:43:11 +00:00
Michael J. Spencer 6047163a24 [lld] Add support for -mllvm.
There is no way to test this at the moment because the options are not
processed until the link starts, and we can't pass an empty file.

llvm-svn: 171910
2013-01-08 22:59:27 +00:00
Michael J. Spencer 79fafccb5e [Driver] Fix indentation.
llvm-svn: 171909
2013-01-08 22:59:01 +00:00
Nick Kledzik 8a3052eab0 Rename YAML key 'fixups:' to 'references:'
llvm-svn: 171898
2013-01-08 21:12:13 +00:00
Nick Kledzik 809b9955e8 Fix to work with style of new YAML writer
llvm-svn: 171897
2013-01-08 21:05:47 +00:00
Michael J. Spencer d2a4ccf8f9 [ELF] Add R_X86_64_64 relocation.
llvm-svn: 171836
2013-01-08 02:12:15 +00:00
Michael J. Spencer 8f80cd92d9 [lld] Add and ignore some flags for ld compat.
llvm-svn: 171835
2013-01-08 02:12:01 +00:00
Michael J. Spencer 8de8364753 [ELF] Properly handle constant data.
With this hello world works with dietlibc on x86-64 Linux.

llvm-svn: 171711
2013-01-07 08:00:42 +00:00
Michael J. Spencer 956b03618c [lld] Add -emit-yaml option. This outputs yaml instead of a binary.
llvm-svn: 171710
2013-01-07 08:00:25 +00:00
Michael J. Spencer 1ac382f0c5 [ELF] Emit the file header and program headers at the beginning of the first segment.
This is required for the loader to correctly set AT_PHDR.

With this lld can correctly link against dietlibc and get to main.

llvm-svn: 171709
2013-01-07 08:00:04 +00:00
Michael J. Spencer 00b702c95c [ELF] Change Segment to hold Chunks instead of Sections. No functionality change.
llvm-svn: 171708
2013-01-07 07:59:46 +00:00
Michael J. Spencer c8a12cce98 [ELF] Remove dead variable.
llvm-svn: 171707
2013-01-07 07:59:34 +00:00
Michael J. Spencer 28c6594c71 [ELF] Emit zeroFill as STT_OBJECT in the final executable. ld does this.
llvm-svn: 171704
2013-01-07 07:05:52 +00:00
Michael J. Spencer cdb892488e [ELF] Add common x86_64 relocation types.
llvm-svn: 171703
2013-01-07 06:58:53 +00:00
Michael J. Spencer 0c3f25ead9 [Driver] x86-64 should use ELF 64.
llvm-svn: 171693
2013-01-07 04:51:32 +00:00
Michael J. Spencer c41d48fdee [ELF] Give a slightly better message for unknown relocation types.
llvm-svn: 171692
2013-01-07 04:51:17 +00:00
Michael J. Spencer fd3981d6db [ELF] Update to llvm change.
llvm-svn: 171652
2013-01-06 05:40:27 +00:00
Michael J. Spencer 00744bf495 [YAML] Fix -Wcovered-switch-default
llvm-svn: 171645
2013-01-06 00:45:22 +00:00
Michael J. Spencer c4048062e5 [CMake] Don't add flags this late and don't force libc++. Error if we know the compiler doesn't support c++11.
llvm-svn: 171596
2013-01-05 04:16:52 +00:00
Nick Kledzik 6b079f5e2f Removes files for separate ReaderYAML.cpp and WriterYAML.cpp
and adds a new file ReaderWriterYAML.cpp that uses YAML I/O.

Lots of tweaks to test suite for slightly different YAML encoding.

llvm-svn: 171592
2013-01-05 02:22:35 +00:00
Reid Kleckner e974bd1be9 Avoid MSVCRT assertion on comparing phdr iterators
llvm-svn: 171591
2013-01-05 02:21:42 +00:00
Michael J. Spencer 3a772ebbe4 [CMake] Add lld to the list of test dependencies.
llvm-svn: 171580
2013-01-05 00:51:04 +00:00
Michael J. Spencer 70d0e10c5f Target test fix.
llvm-svn: 171579
2013-01-05 00:47:15 +00:00
Michael J. Spencer 3124422a8b [ELF] Add skeleton for X86-64 relocations.
llvm-svn: 171578
2013-01-05 00:47:04 +00:00
Michael J. Spencer 18225e7be1 [Driver] Add -flavor core support. This will be tested by other tests using -flavor core.
llvm-svn: 171577
2013-01-05 00:46:45 +00:00
Michael J. Spencer 5adebbd6a6 [ELF][Writer] Don't infinite loop.
This will be tested by a following committ that runs the linker
with no inputs.

llvm-svn: 171576
2013-01-05 00:46:23 +00:00
Michael J. Spencer b14ac9b1fe Style
llvm-svn: 171575
2013-01-05 00:46:10 +00:00
Michael J. Spencer bc7f2a7359 [Driver] Add x86-64 target.
llvm-svn: 171557
2013-01-04 23:34:29 +00:00
Michael J. Spencer 65f6113d21 [ELF] STT_GNU_IFUNC is a known symbol type, so accept it. We do not yet implement its semantics.
llvm-svn: 171533
2013-01-04 21:25:25 +00:00
Michael J. Spencer 552074f18e Style fixes.
llvm-svn: 171531
2013-01-04 21:18:34 +00:00
Michael J. Spencer b8c853e5eb [Passes][GOT] Fix style.
llvm-svn: 171530
2013-01-04 21:18:13 +00:00
Michael J. Spencer 85d998a109 [Driver] Error on undefined.
llvm-svn: 171529
2013-01-04 21:18:02 +00:00
Michael J. Spencer 7f693c50db Slightly better diagnostics on duplicate symbols.
llvm-svn: 171528
2013-01-04 21:17:51 +00:00
Michael J. Spencer a2c9727810 [ELF] Handle misaligned ELF files properly.
llvm-svn: 171526
2013-01-04 21:09:21 +00:00
Alex Rosenberg 59095f1cf9 Add .arcconfig for Phabricator command-line support
llvm-svn: 171451
2013-01-03 02:15:37 +00:00
NAKAMURA Takumi 43632a26a5 Update the copyright coredits -- Happy new year 2013!
llvm-svn: 171342
2013-01-01 10:00:19 +00:00
Shankar Easwaran 495d38bf46 add Changes to ELF Writer to layout sections/segments in the output executable
llvm-svn: 171135
2012-12-27 02:26:30 +00:00
Shankar Easwaran bbf9ddda04 changes for the ELF Reader : split up into AtomsELF.h/Adding new permissions permRWX
llvm-svn: 171127
2012-12-27 01:40:08 +00:00
Shankar Easwaran b3cb257b8b changes to fix Hexagon Relocation so that it accounts for the bitmask properly as documented in the ABI
llvm-svn: 171125
2012-12-27 01:04:00 +00:00
Andy Gibbs d02bf1d232 Fix build issue when building lld against libstdc++ 4.7
llvm-svn: 170983
2012-12-22 09:46:10 +00:00
Michael J. Spencer 8ac9150556 [ELF][Reader] Ignore SHF_GROUP when switching on flags.
llvm-svn: 170624
2012-12-20 00:37:24 +00:00
Michael J. Spencer 6344b322e2 Style fixes.
llvm-svn: 170623
2012-12-20 00:37:10 +00:00
Michael J. Spencer 800de03813 [Core][ErrorOr] Add support for user error data.
llvm-svn: 170483
2012-12-19 00:51:07 +00:00
Michael J. Spencer db1450800a [CMake] Fix external llvm build. It needs to know where llvm-tblgen is.
llvm-svn: 169794
2012-12-10 23:52:34 +00:00
Michael J. Spencer 74f29afd58 [Driver] Add test.
llvm-svn: 169721
2012-12-10 02:53:10 +00:00
Michael J. Spencer 99b99d26bb [Driver] Properly handle -entry for X86 Linux.
llvm-svn: 169718
2012-12-09 23:56:37 +00:00
Michael J. Spencer 3825760550 [Driver] Add -### support for printing out the core command line.
llvm-svn: 169717
2012-12-09 23:56:26 +00:00
Michael J. Spencer 48ed572710 Remove left over debugging output.
llvm-svn: 169716
2012-12-09 23:56:03 +00:00
Michael J. Spencer c8b60a70be [Driver] Make the X86Linux target use X86 (not x64) and properly initalize WriterOptions.
llvm-svn: 169715
2012-12-09 23:55:52 +00:00
Michael J. Spencer 9ff4be240a Add the core architecture for the lld driver.
This includes selecting which driver to emulate, option parsing, invocation
building, and running the link. This currently only supports a very basic
subset of ld for x86_64-linux.

lld -flavor ld obj.o -o obj

or symlink lld as (ld , link, ld64, core) to get the desired behavior without
-flavor.

llvm-svn: 169659
2012-12-08 00:47:36 +00:00
Benjamin Kramer f7798e34c9 Add library dependencies to the lld cmake build.
llvm-svn: 169306
2012-12-04 21:09:04 +00:00
Hemant Kulkarni 736f7fbee2 Populate entry point into ELF executable.
llvm-svn: 168461
2012-11-21 21:07:36 +00:00
Hemant Kulkarni 87dbac00a9 Add program header emission to ELF writer. This patch also rearranges sections for efficient memory utilization
llvm-svn: 167874
2012-11-13 21:34:45 +00:00
Shankar Easwaran 85bb045106 changes after mspencer reviews in phabricator
llvm-svn: 167871
2012-11-13 20:34:55 +00:00
Michael J. Spencer a5d22811af Fix style violations.
llvm-svn: 167869
2012-11-13 19:58:58 +00:00
Shankar Easwaran 70b4dcfbcd Adding support to resolve symbols with archive libraries in lld
llvm-svn: 167854
2012-11-13 18:39:10 +00:00
Hemant Kulkarni f828613945 Add absolute symbol scope recognition in lld/Core
llvm-svn: 167394
2012-11-05 19:13:54 +00:00
Nick Kledzik 8cf031e4cc rename dylibNamesToOrdinal now that it is an ivar
llvm-svn: 167254
2012-11-01 21:44:45 +00:00
Michael J. Spencer a1913fbda9 [ELF] Fix -Woverloaded-virtual
llvm-svn: 167246
2012-11-01 19:46:19 +00:00
Michael J. Spencer d91bc3c8bb [MachO] Fix use after free.
llvm-svn: 167245
2012-11-01 19:46:06 +00:00
Michael J. Spencer c1d704550a [MachO] Fix uninitialized variables.
llvm-svn: 167244
2012-11-01 19:45:53 +00:00
Michael J. Spencer e337e60552 Fix cl brokeness.
cl is not attempting to complete a templated class when used in this
context. The conversion forces this to happen.

Thanks to Richard Smith for figuring this out.

llvm-svn: 167166
2012-10-31 20:47:30 +00:00
Michael J. Spencer d2f7e50867 Add missing include.
llvm-svn: 167165
2012-10-31 20:47:11 +00:00
Sid Manning 823e8bb7be This patch changes the following:
* Use conventional naming for KindHandlers.
  * Add X86 relocation routines.
  * Use std::function instead of function pointers in _fixupHandler map.
  * Change _fixupHandler map from std::map to llvm::DenseMap.
  * Add simple testcase for x86 relocations.

llvm-svn: 166700
2012-10-25 17:53:04 +00:00
Sid Manning 2a59024ff8 This update does the following:
* Moves enum Scope from DefinedAtom.h to Atom.h
  * Adds scope method to AbsoluteAtom class
  * Updates YAML to print scope of AbsoluteAtoms
  * Update Native Reader/Writer to handle this new, "attribute"
  * Adds testcase 
Reviewed and approved by Nick Kledzik

llvm-svn: 166189
2012-10-18 17:16:19 +00:00
Sid Manning 42064e5b60 * Add relocation reference support for Hexagon and PowerPC.
- Hexagon has many relocation types, this patch covers just
      a subset, more will be added.
    - PowerPC support was added so that we can verify mixed endian
      environments.
  * Add some basic test cases
  * Update ldd-core to accept -endian flag

llvm-svn: 165477
2012-10-09 02:20:47 +00:00
Sid Manning e3612f0f21 Fix incorrect setting of EI_DATA
llvm-svn: 165310
2012-10-05 14:06:24 +00:00
Hemant Kulkarni 8bd276120f Added missing break in StockSectionChunk constructor.
Removed architecture dependent .sbss section creation.

Updated test case to show the change in section types and removal of a sbss section.

llvm-svn: 165181
2012-10-03 23:27:33 +00:00
Sid Manning 05c82a42dd * Return correct size and alignment for common symbols.
llvm-svn: 165170
2012-10-03 21:46:48 +00:00
Hemant Kulkarni cc613e1c25 Changed test output comparison to be consistent with the way llvm-objdump and llvm-readobj work.
llvm-svn: 165048
2012-10-02 21:12:21 +00:00
Hemant Kulkarni 08e410293f Emit symbol tables.
Reorganize to derive all sections from SectionChunk.
Construct section table header from SectionChunk.

llvm-svn: 164981
2012-10-01 23:53:20 +00:00
Sid Manning e861d43f65 This change:
* Updates ReaderELF.cpp contentType method to match ELF.h's logic and now handle
    typeData
  * Add -arch to ldd-core testdriver
  * Add testcase to check typeData
  * Update others to stay in sync with this change.

llvm-svn: 164976
2012-10-01 23:23:05 +00:00
Michael J. Spencer e2fb6c73f3 Fix -Wcovered-switch-default warning.
llvm-svn: 164846
2012-09-28 21:07:58 +00:00
Sid Manning d3a7e7e164 Add case for typeConstant in SectionChunk
llvm-svn: 164732
2012-09-26 22:46:17 +00:00
Sid Manning dd11020739 This patch makes use of recently added relocation reference data. The bulk
of this is derived from the Mach-O writer.  Reviewed by: Nick Kledzik.
 * Adds loop to SectionChunk::write traverse references calling the
   writer's fixup handler, applyFixup.
 * Adds method, ELFWriter::buildAtomToAddressMap to that creates a
   mapping from an atom to its runtime address.
 * Adds method, ELFWriter::addressOfAtom to return the runtime address
   of the atom. 

llvm-svn: 164618
2012-09-25 18:22:09 +00:00
Sid Manning 8caf4de31f Add ELFReference class - parse relocations needed by that class and update DefinedAtom to use the class. Tweak coding style. Add testcase to check relocations. Change was signed-off-by: Michael Spencer
llvm-svn: 164027
2012-09-17 12:49:38 +00:00
Sid Manning 37e3120af8 Fix environment path problem
llvm-svn: 163929
2012-09-14 20:04:36 +00:00
Hemant Kulkarni 927bbc2871 ELF support for LLD writer. The writer at present emits ELF header and section
table header. Skeleton code for ReferenceKinds.
Credits:
Doxygen by  Michael Spencer.
Origianl implementation from Macho by Sidney Manning.
Templatization, implementation of section header chunks, string table, ELF header by Hemant Kulkarni.

llvm-svn: 163906
2012-09-14 16:11:34 +00:00
Hemant Kulkarni f6e2bc07eb Test commit
llvm-svn: 163861
2012-09-14 00:00:39 +00:00
Michael J. Spencer 69ed53ab5f Fix warnings.
llvm-svn: 163573
2012-09-10 23:46:58 +00:00
Michael J. Spencer 298f38ee68 Hook up lld-test to llvm check-all. Patch by Andy Gibbs!
llvm-svn: 161067
2012-07-31 18:44:52 +00:00
Nick Kledzik 7243b89459 PR13467: Fix mach-o writer to handle case of zero stubs. Renumber TestingHelpers kind values
llvm-svn: 160982
2012-07-30 20:10:46 +00:00
Sid Manning 429a4bc172 Fix warning from -Wshadow. Report errors back to caller rather than calling
llvm::report_fatal_error.

llvm-svn: 160864
2012-07-27 14:52:18 +00:00
Sid Manning ad58efd69a Add a default constructor/destructor for ReaderOptionsPECOFF
llvm-svn: 160740
2012-07-25 17:16:46 +00:00
Sid Manning 51b1cc1428 Add test cases for ReaderELF.
llvm-svn: 160737
2012-07-25 17:14:55 +00:00
Sid Manning 556d84fe03 Add a new option, -reader which will select formats other than YAML for
reading.  YAML is still the default.

llvm-svn: 160736
2012-07-25 17:13:13 +00:00
Sid Manning 1a60141f99 Implement the ELF reader. The original implementation was by Hemant Kulkarni
with subsequent changes to use lower level interfaces done by me.

llvm-svn: 160732
2012-07-25 16:27:21 +00:00
Sid Manning d5c8fe3eea Trivial reformatting
llvm-svn: 160730
2012-07-25 15:16:02 +00:00
Marshall Clow 341f496538 Added description of Atom types from Nick's email
llvm-svn: 160468
2012-07-18 23:20:40 +00:00
Marshall Clow f33f0bbdcf Minor edits to match style guidelines. No functionality change
llvm-svn: 160370
2012-07-17 16:18:04 +00:00
Nick Kledzik 686eec102c Add missing LLVMSupport
llvm-svn: 159702
2012-07-04 02:16:35 +00:00
Michael J. Spencer e1db0daf25 Fix CMake build to use target_link_libraries. Patch by Sidney Manning!
llvm-svn: 159165
2012-06-25 21:42:38 +00:00
Michael J. Spencer 26f5a62712 Fix link order. Patch by Sidney Manning.
llvm-svn: 158945
2012-06-21 22:42:00 +00:00
Michael J. Spencer efcf099db5 Unused var warning.
llvm-svn: 158944
2012-06-21 22:41:46 +00:00
Nick Kledzik 920ceddf80 Fix Sphinx warning. Patch by Sean Silva
llvm-svn: 158678
2012-06-18 20:24:47 +00:00
Michael J. Spencer aedfa6a36b Fix MSVC compat. MSVC doesn't have bzero.
Although the code is not valid to begin with. It is trying to do a raw memory
copy of a non standard-layout type. nameoffset is not guaranteed to directly
follow cmdsize.

This should be properly fixed.

llvm-svn: 158612
2012-06-17 01:18:44 +00:00
Nick Kledzik 28854f56db Wordsmithing from patch from Sean Silva
llvm-svn: 158584
2012-06-16 00:52:17 +00:00
Nick Kledzik 7145cf6846 Add 'invalid' as a Reference Kind so that unknown/invalid kind strings can return that fact to the caller for use in constructing an error message, rather that triggering an assertion.
llvm-svn: 158547
2012-06-15 21:26:18 +00:00
Nick Kledzik 21f5d4d629 remove return statements after llvm_unreachable() as the compiler no longer warns abot missing return values
llvm-svn: 158544
2012-06-15 21:04:32 +00:00
Nick Kledzik 751eb3d2b3 use llvm_unreachable() instead of assert(0) for invalid enum values in switch statements
llvm-svn: 158542
2012-06-15 20:37:24 +00:00
Nick Kledzik d6a27324f9 Use ADT/StringSwitch
llvm-svn: 158541
2012-06-15 20:29:27 +00:00
Nick Kledzik c890ae41e2 flesh out mach-o Reference Kinds
llvm-svn: 158375
2012-06-12 23:01:30 +00:00
Nick Kledzik b47d6ca3a5 Wrote initial doc on how to create a Reader
llvm-svn: 158374
2012-06-12 22:43:35 +00:00
Nick Kledzik 40b68559e8 Move implementation of WriterOptionsMachO to its own file. Reduced redundant
ivars in WriterOptionsMachO instead have its methods compute ivar interactions.
Refactor mach-o Reference Kinds and introduce abstract class KindHandler.
Split up StubAtoms.hpp by architecture.  Add support for 32-bit x86 stubs.

llvm-svn: 158336
2012-06-11 22:53:15 +00:00
Nick Kledzik 5fb2e4dabe put the public function createReaderPECOFF() in the lld namespace and everything else in is own namespace
llvm-svn: 158135
2012-06-07 02:23:48 +00:00
Nick Kledzik 98211f6d19 fix warnings found after cranking up warnings
llvm-svn: 158134
2012-06-07 01:53:39 +00:00
Nick Kledzik 40b8655082 abstract load commands to that WriterMachO can write 64-bit and 32-bit mach-o files
llvm-svn: 158133
2012-06-07 01:45:39 +00:00
Michael J. Spencer 56d756dc33 Add missing include.
llvm-svn: 157834
2012-06-01 20:22:59 +00:00
Nick Kledzik abb6981f68 Major refactoring: Remove Platform concept. In its place there are
now Reader and Writer subclasses for each file format.  Each Reader and
Writer subclass defines an "options" class which controls how that Reader
or Writer operates.

llvm-svn: 157774
2012-05-31 22:34:00 +00:00
Filipe Cabecinhas 6f970e8458 Remove some compilation warnings.
llvm-svn: 157253
2012-05-22 14:45:44 +00:00
Nick Kledzik a3c24f447f remove completed items
llvm-svn: 156143
2012-05-04 01:14:02 +00:00
Nick Kledzik 3011259a85 Rework how YAMLReader is layered on top of YAMLParser. Turn hand written
recursive descent functions into one table driven parser.  Add proper
error recovery and reporting.  Add lots of test cases with semantics errors
and verify error messages.

llvm-svn: 156136
2012-05-03 23:55:34 +00:00
Michael J. Spencer 440b26749c Address review comments from Roman Divacky.
llvm-svn: 156130
2012-05-03 23:36:39 +00:00
Michael J. Spencer 60d835fa59 Add COFF reader.
There are no tests for this yet because I still need to finish the
YAML -> COFF converter so we don't get binary files checked in.

llvm-svn: 156100
2012-05-03 20:52:22 +00:00
Michael J. Spencer 729e234828 Add some docs on the type of flags link.exe has that our driver will need to support.
llvm-svn: 155861
2012-04-30 23:45:49 +00:00
Michael J. Spencer d0d5ec4a38 Convert the YAMLReader to use LLVM/Support/YAMLParser.
llvm-svn: 155847
2012-04-30 21:20:13 +00:00
Michael J. Spencer 63d320064d Remove whitespace.
llvm-svn: 155846
2012-04-30 21:19:44 +00:00
Nick Kledzik f784817107 show how to specify alternate path to clang compiler
llvm-svn: 155678
2012-04-26 23:41:01 +00:00
Evandro Menezes f48d80161d Fix minor warnings and simplify code.
llvm-svn: 155652
2012-04-26 19:20:11 +00:00
Jay Foad 4d5e6cf906 Fix errors when building with GCC 4.6.1 -std=c++0x, which requires
"friend class Foo;" instead of just friend Foo;".

llvm-svn: 155625
2012-04-26 07:37:08 +00:00
Gabor Greif c52fc9e073 fix some typos and punctuation
llvm-svn: 155588
2012-04-25 21:09:37 +00:00
Michael J. Spencer aa53d680bb [docs] Minor spelling fix. Thanks Gabor!
llvm-svn: 155581
2012-04-25 19:59:06 +00:00