Commit Graph

2579 Commits

Author SHA1 Message Date
Jean-Daniel Dupas 5716bb9faa Remove file not used anywhere.
llvm-svn: 229109
2015-02-13 14:30:22 +00:00
Jean-Daniel Dupas 48bc169f04 Using 'isa' instead of 'dyn_cast'
llvm-svn: 229107
2015-02-13 14:28:18 +00:00
Will Newton 6b3f59b6a9 ELF/AArch64: Add support for checking for ABS32 overflow
Add support for checking overflow when applying a R_AARCH64_ABS32
relocation and add a test to ensure it behaves correctly.

llvm-svn: 229072
2015-02-13 06:22:31 +00:00
Rui Ueyama d9cb620330 Remove unused parameters.
llvm-svn: 229055
2015-02-13 04:02:55 +00:00
Rui Ueyama 8e19879f5a Remove KindArcH::PowerPC and sort enums alphabetically.
llvm-svn: 229051
2015-02-13 03:47:34 +00:00
Rui Ueyama dcd61c2d14 Remove class that really does nothing.
llvm-svn: 229030
2015-02-13 02:34:08 +00:00
Rui Ueyama acbe51a0e3 PECOFF: Fix dummy symbol table in executable.
If the name field of a symbol table entry is all zero, it's interpreted
as it's pointing to the beginning of the string table. The first four
bytes of the string table is the size field, so dumpbin dumps that number
as an ASCIZ string.

This patch fills a dummy value to name field.

llvm-svn: 228971
2015-02-12 22:46:16 +00:00
Shankar Easwaran 7d71622c8f [ELF] Insert wrap symbols into a set.
Symbols specified by --wrap was being inserted into a vector, change this to
insert into a set, so that we have unique entries.

llvm-svn: 228968
2015-02-12 22:37:27 +00:00
Rui Ueyama 3c3c7d8911 PECOFF: Don't parse files in .drectve asynchronously.
Looks like there's a race condition around here that caused LLD to crash
on Windows. Currently we are parsing libraries specified by .drectve section
asynchronously, and something is wrong in that process. Disable the feature
for now to make buildbots happy.

llvm-svn: 228955
2015-02-12 20:33:40 +00:00
Shankar Easwaran 5c094b8751 [ELF][Cleanup] Remove unused function
We can add this function when we really have a need.

llvm-svn: 228907
2015-02-12 05:29:50 +00:00
Shankar Easwaran 2df0c3efd6 [ELF] Support --wrap option
Use a wrapper function for symbol. Any undefined reference to symbol will be
resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be
resolved to symbol.

This can be used to provide a wrapper for a system function. The wrapper
function should be called "__wrap_symbol". If it wishes to call the system
function, it should call "__real_symbol".

Here is a trivial example:

void * __wrap_malloc (size_t c)
{
  printf ("malloc called with %zu\n", c);
  return __real_malloc (c);
}

If you link other code with this file using --wrap malloc, then all calls
to "malloc" will call the function "__wrap_malloc" instead. The call to
"__real_malloc" in "__wrap_malloc" will call the real "malloc" function.

llvm-svn: 228906
2015-02-12 05:02:46 +00:00
Shankar Easwaran f7a8da3384 [ELF] Add LinkingContext to the ELFReader.
This adds the LinkingContext parameter to the ELFReader. Previously the flags in
that were needed in the Context was passed to the ELFReader, this made it very
hard to access data structures in the LinkingContext when reading an ELF file.

This change makes the ELFReader more flexible so that required parameters can be
grabbed directly from the LinkingContext.

Future patches make use of the changes.

There is no change in functionality though.

llvm-svn: 228905
2015-02-12 05:02:41 +00:00
Rui Ueyama 1a40b2062c PECOFF: make dumpbin tool happy.
The dumpbin tool in the MSVC toolchain cannot handle an executable created
by LLD if the executable contains a long section name.

In PE/COFF, a section name is stored to a section table entry. Because the
section name field in the table is only 8 byte long, a name longer than
that is stored to the string table and the offset in the string table is
stored to the section table entry instead.

In order to look up a string from the string table, tools need to handle
the symbol table, because the string table is defined as it immediately
follows the symbol table.

And seems the dumpbin doesn't like zero-length symbol table.

This patch teaches LLD how to emit a dummy symbol table. The dummy table
has one dummy entry in it.

llvm-svn: 228900
2015-02-12 02:50:05 +00:00
Rui Ueyama 30c5387983 Remove unused parameter.
llvm-svn: 228887
2015-02-11 23:22:34 +00:00
Denis Protivensky d6fe5b3005 [ELF][ARM] Fix veneer symbol names in Release build
The fix is for r228680.
This makes tests also work.

llvm-svn: 228837
2015-02-11 15:02:43 +00:00
Rui Ueyama 123ad4cde7 GNU: Rename parseZOption because it actually parses only -z max-page-size.
llvm-svn: 228753
2015-02-10 21:40:51 +00:00
Rui Ueyama ea6c8e9c1f Unittest: Do s/_context/_ctx/g.
llvm-svn: 228750
2015-02-10 21:28:52 +00:00
Rui Ueyama 2050b61451 GNU: Add --no-export-dynamic command line option.
llvm-svn: 228749
2015-02-10 21:27:31 +00:00
Rui Ueyama c008539736 Driver: move non-positional parameters out of switch. NFC.
llvm-svn: 228743
2015-02-10 20:57:43 +00:00
Rui Ueyama 4c30cb3d2f Use override rather than virtual.
llvm-svn: 228723
2015-02-10 18:59:37 +00:00
Rui Ueyama 375c5e2353 GNU: Use StringRef::empty instead of a boolean flag.
This local variable name did not follow the style guide,
and it is not actually needed.

llvm-svn: 228722
2015-02-10 18:55:39 +00:00
Rui Ueyama d003ab3207 Driver: use hasArg instead of getLastArg if return value is not used.
llvm-svn: 228717
2015-02-10 18:34:46 +00:00
Denis Protivensky e35908b18f [ELF][ARM] Add veneer generation to branch instructions
When calling ARM code from Thumb and vice versa,
a veneer that switches instruction set should be generated.
Added veneer generation for ARM_JUMP24 ARM_THM_JUMP24 instructions.

Differential Revision: http://reviews.llvm.org/D7502

llvm-svn: 228680
2015-02-10 09:31:42 +00:00
Rui Ueyama 7960d04f13 Driver: Replace switch cases with ifs.
We used to do like this instead of putting all command line processing
code within one gigantic switch statement. It is converted to a switch
in r188958, which introduced InputGraph.

In this patch I roll that change back. Now all "break"s are removed,
and the nesting is one level shallow.

llvm-svn: 228646
2015-02-10 01:10:23 +00:00
Rui Ueyama 55240af6a3 Remove trailing space.
llvm-svn: 228643
2015-02-10 01:06:14 +00:00
Davide Italiano 1fd20ff599 [ELF] Implement --strip-all/-s
Differential Revision:	D7489
Reviewed by:	shankarke

llvm-svn: 228533
2015-02-08 19:42:15 +00:00
Rui Ueyama 669d9486f9 Remove unused parameter.
llvm-svn: 228476
2015-02-07 00:54:46 +00:00
Rui Ueyama f54e4fd3c6 PECOFF: Move error check for invalid command line combination to validateImpl.
llvm-svn: 228461
2015-02-06 23:09:13 +00:00
Rui Ueyama 92634be399 Use make_unique.
llvm-svn: 228453
2015-02-06 22:44:16 +00:00
Rui Ueyama a209f0d892 Remove unused #include.
llvm-svn: 228450
2015-02-06 22:34:29 +00:00
Rui Ueyama 3d68e41d2d ELF: Split OrderPass::compareInitFini for readability. NFC.
llvm-svn: 228449
2015-02-06 22:32:09 +00:00
Shankar Easwaran d050c50522 [Revert] [ELF] Determine default search directories from Context
It looks like the Driver manages search path for each Target lld would support
on the Gnu flavor.

llvm-svn: 228440
2015-02-06 21:23:50 +00:00
Shankar Easwaran 6aa03e230c Revert "[Core] Update ContentPermissions"
This reverts commit r228381.

The MachO writer uses the permissions as bit masks.

llvm-svn: 228401
2015-02-06 14:55:40 +00:00
Shankar Easwaran fa9eec2e6b [Core] Update ContentPermissions
The values are already arranged in ascending order, and all tests still pass.

Removing the values as its confusing when new enumerations need to be added.

llvm-svn: 228381
2015-02-06 05:29:49 +00:00
Shankar Easwaran c65bd69690 [ELF][TODO] Update TODO.
llvm-svn: 228380
2015-02-06 05:29:48 +00:00
Shankar Easwaran 2ba4f5d9e3 [Cleanup] Remove member functions added to support nostdlib
No change in functionality.

llvm-svn: 228379
2015-02-06 05:01:38 +00:00
Shankar Easwaran c8299e1f15 [ELF] Remove stray semicolon
llvm-svn: 228378
2015-02-06 04:50:22 +00:00
Shankar Easwaran 8825dbdd85 [ELF] Speedup creating program headers.
After the total number of program headers are determined, virtual addresses
and file offsets need not be reassigned for sections whose virtual addresses and
fileoffsets remained the same.

This doesnot change any functionality.

llvm-svn: 228377
2015-02-06 04:15:04 +00:00
Shankar Easwaran 8f1b2d0930 [Core] Remove roundTripPass() function.
Use the environment variable "LLD_RUN_ROUNDTRIP_TEST" in the test that you want
to disable, as

RUN: env LLD_RUN_ROUNDTRIP_TEST= <run>

This was a patch that I made, but I find this a better way to accomplish what we
want to do.

llvm-svn: 228376
2015-02-06 04:15:02 +00:00
Shankar Easwaran e315edd747 [ELF] Fix -nostdlib option.
Only search library directories explicitly specified
on the command line. Library directories specified in linker
scripts (including linker scripts specified on the command
line) are ignored.

llvm-svn: 228375
2015-02-06 04:15:00 +00:00
Rui Ueyama f038a52542 Add methods to get archive file name from member file.
Previously we only have File::path() to get the path name of a file.
If a file was a member of an archive file, path() returns a concatenated
string of the file name in the archive and the archive file name.
If we wanted to get a file name or an archive file name, we had to
parse that string. That's of course not good.

This patch adds new member functions, archivePath and memberPath, to File.

http://reviews.llvm.org/D7447

llvm-svn: 228352
2015-02-05 22:51:36 +00:00
Rui Ueyama 540842ccf5 Cleanup. NFC.
Make customOrder pareamter mandatory because the argument is
always passed.

llvm-svn: 228342
2015-02-05 20:08:04 +00:00
Rui Ueyama 0076215b88 MachO: Move LayoutPass to MachO directory.
The real user of the LayoutPass is now only Mach-O, so move that
pass out of the common directory to Mach-O directory.

"Core" architecture were using the LayoutPass. I modified that
to use a simple OrderPass. I think no one actually have authority
what feature should be in Core and what's not, but I believe the
LayoutPass is not very suitable for Core. Before more code starts
depending on the complex pass, it's better to remove that from
Core.

I could have simplified that pass because Mach-O is the only user
of the LayoutPass. For example, the second parameter of the
LayoutPass constructor can be converted from optional to mandatory.
I didn't do that in this patch to keep it simple. I'll do in a
followup patch.

http://reviews.llvm.org/D7311

llvm-svn: 228341
2015-02-05 20:05:33 +00:00
Rui Ueyama df7d133cdf PECOFF: Fix I386_DIR32 relocation to an absolute symbol
Previously, we incorrectly added the image base address to an absolute
symbol address (that calculation doesn't make any sense) if an
IMAGE_REL_I386_DIR32 relocation is applied to an absolute symbol.

This patch fixes the issue. With this fix, we can link Bochs using LLD.
(Choosing Bochs has no special meaining -- I just picked it up as a
test program and found it didn't work.) This also fixes one of the
issues we currently have to link Chromium using LLD.

llvm-svn: 228279
2015-02-05 07:22:53 +00:00
Shankar Easwaran d67bcb5f5c [ELF] Dont discard sections in the input file.
The reader was discarding certain types of sections from the input file.

llvm-svn: 228268
2015-02-05 02:56:06 +00:00
Shankar Easwaran 50ad727051 [ELF] Dont release ownership of MemoryBuffer.
MemoryBuffer is being released too early. ELFFile owns MemoryBuffer.

llvm-svn: 228260
2015-02-05 02:00:03 +00:00
Eric Christopher ddaf4fd680 lldReaderWriter.a depends on lldCore.a so make sure
to link that in as well.

llvm-svn: 228252
2015-02-05 01:10:40 +00:00
Eric Christopher 8e4f68b141 The PPC lld backend has been removed, don't require it here.
llvm-svn: 228251
2015-02-05 01:10:10 +00:00
Rui Ueyama e032d73ec5 Add a comment to Lexer::canContinueNumber.
llvm-svn: 228201
2015-02-04 21:46:27 +00:00
Rui Ueyama 7d8ffc9cfb Early return. NFC.
llvm-svn: 228106
2015-02-04 02:01:04 +00:00