Commit Graph

43 Commits

Author SHA1 Message Date
Eugene Zelenko 5668bb3fce Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D26293


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@286000 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-04 17:39:46 +00:00
Pete Cooper 56ea9297bf Convert lld file writing to llvm::Error. NFC.
This converts the writeFile method, as well as some of the ones it calls
in the normalized binary file writer and yaml writer.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264961 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 23:10:39 +00:00
Rui Ueyama 833fd5a88e Use C++11 initializers for data members.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262447 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 01:49:27 +00:00
Rui Ueyama e14cc3ffb4 Remove more dead code.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 01:34:36 +00:00
Rui Ueyama 297b371c93 Remove default implementations that are always overridden by subclasses.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262444 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 01:34:34 +00:00
Rui Ueyama ef97618b4a Remove dead code for ELF.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 21:59:02 +00:00
Rui Ueyama ac52e22e86 Remove remaining code for COFF.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262193 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 21:22:40 +00:00
Pete Cooper bd281ef5dc Add File::kind's for all subclasses of File.
This is to enable isa<> support for any files which need it.

It will be used in an upcoming patch to differentiate MachOFile from other implicitly generated files.

Reviewed by Lang Hames.

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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@257830 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 22:55:38 +00:00
Davide Italiano 970323fe0f Reapply r234378, with test fixed (by emaste).
Hopefully this time the build won't be broken.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234553 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 01:40:25 +00:00
Rui Ueyama b1659cd156 Revert "Allow undefined symbols in shared library by default."
This reverts commit r234378 because it broke buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234414 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 16:55:03 +00:00
Davide Italiano 641ea22072 Allow undefined symbols in shared library by default.
It's not our business to resolve those undefined symbols.
We just trust the linker will load the library and its dependencies
correctly, which is actually what happens, modulo bugs in the dynamic
linker itself.

PR:		23035
Differential Revision:	http://reviews.llvm.org/D8886


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 01:00:19 +00:00
Simon Atanasyan f4f9411a5d Replace the createImplicitFiles method return type with void
All instances of the `createImplicitFiles` always return `true` and this
return value is used nowhere.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 20:43:35 +00:00
Shankar Easwaran 3345841995 [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.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@228376 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-06 04:15:02 +00:00
Greg Fitzgerald 3f4f811cd5 Fix five of the shared library build targets
Before this patch there was a cyclic dependency between lldCore and
lldReaderWriter.  Only lldConfig could be built as a shared library.

* Moved Reader and Writer base classes into lldCore.
* The following shared libraries can now be built:
     lldCore
     lldYAML
     lldNative
     lldPasses
     lldReaderWriter

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

From: Greg Fitzgerald <garious@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@226732 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-21 22:54:56 +00:00
Shankar Easwaran 13ab67374d [Core] Remove function to not override RoundTripPasses.
RoundTripPasses should always be called in DEBUG mode if the environment
variable "LLD_RUN_ROUNDTRIP_TEST" is set.

Flavors should not be able to override this behavior.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@223073 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 20:28:54 +00:00
Shankar Easwaran 8df50ad51e [Core] Add flag to check if RoundTripPasses need to be run.
This would allow other flavor specific contexts to override the default value,
if they want to optionally run the round trip passes.

There is some information lost like the original file owner of the atom with
RoundTripPasses. The Gnu flavor needs this information inorder to implement
LinkerScript matching and for other diagnostic outputs such as Map files.

The flag also can be used to record information in the Atom if the information
to the Writer needs to be conveyed through References too.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@222983 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 01:04:11 +00:00
Nick Kledzik 0ef1204a1f Add MachOLinkingContext parameter to MachOFileNode constructor.
No functionality change.  This removes a down-cast from LinkingContext to
MachOLinkingContext.

Also, remove const from LinkingContext::createImplicitFiles() to remove
the need for another const cast.  Seems reasonable for createImplicitFiles()
to need to modify the context (MachOLinkingContext does).

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@218796 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 20:24:30 +00:00
Rafael Espindola ea4f05b470 Don't import error_code into the lld namespace.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@210785 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 14:53:47 +00:00
Rui Ueyama 7eb64636c3 Move Simple.h and Alias.h to include/Core.
Because the files in Core actually depend on these files.

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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@210710 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-11 21:47:51 +00:00
Rui Ueyama 8131afb8fa Move alias symbols from ELFLinkingContext to LinkingContext.
Alias symbols are SimpleDefinedAtoms and are platform neutral. They
don't have to belong ELF. This patch is to make it available to all
platforms. No functionality change intended.

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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@209475 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-22 21:37:56 +00:00
Rui Ueyama c52194f02e Simplify nullptr check.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@209357 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-22 00:36:36 +00:00
Rui Ueyama 695d533a08 Don't use "auto" where the actual type is not obvious.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@207875 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-02 21:48:01 +00:00
Rui Ueyama eab5776a81 Move nextFile() from LinkingContext to InputGraph.
LinkingContext and InputGraph are unnecessarily entangled. Most linker
input file data, e.g. the vector containing input files, the next index
of the input file, etc. are managed by InputGraph, but only the current
input file is for no obvious reason managed by LinkingContext.

This patch is to move code from LinkingContext to InputGraph to fix it.
It's now clear who's reponsible for managing input file state, which is
InputGraph, and LinkingContext is now free from that responsibility.
It improves the readability as we now have fewer dependencies between
classes. No functionality change.

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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@205394 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-02 05:03:40 +00:00
Rui Ueyama d8b474dca3 [ELF] Support --defsym option to define an absolute symbol.
This patch is to support --defsym option for ELF file format/GNU-compatible
driver. Currently it takes a symbol name followed by '=' and a number. If such
option is given, the driver sets up an absolute symbol with the specified
address. You can specify multiple --defsym options to define multiple symbols.

GNU LD's --defsym provides many more features. For example, it allows users to
specify another symbol name instead of a number to define a symbol alias, or it
even allows a symbol plus an offset (e.g. --defsym=foo+3) to define symbol-
relative alias. This patch does not support that, but will be supported in
subsequent patches.

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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@205029 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-28 19:02:06 +00:00
Rui Ueyama b351cc8e04 [ELF] Add --allow-multiple-definition option.
If --allow-multiple-definition option is given, LLD does not treat duplicate
symbol error as a fatal error. GNU LD supports this option.

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

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@205015 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-28 16:26:38 +00:00