Commit Graph

1276 Commits

Author SHA1 Message Date
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
Rui Ueyama 170a1a892e Run clang-format on r197727.
llvm-svn: 197788
2013-12-20 07:48:29 +00:00
Joey Gouly 86409e1cde Fix the build by adding back a comma...
llvm-svn: 197754
2013-12-20 00:01:00 +00:00
Joey Gouly f39ec17371 Fix some typos of 'extension'.
llvm-svn: 197753
2013-12-19 23:52:00 +00:00
Joey Gouly 6eb02ef568 Make SimpleFileNode inherit from FileNode.
This removes a lot of duplicated code.

llvm-svn: 197751
2013-12-19 23:39:02 +00:00
Nick Kledzik fc3a975d85 [lld] fix unused variable warnings
llvm-svn: 197737
2013-12-19 22:50:08 +00:00
Nick Kledzik 58089e1362 [lld] fix build when LLVM_HAS_VARIADIC_TEMPLATES is false
llvm-svn: 197734
2013-12-19 22:40:17 +00:00