Commit Graph

154 Commits

Author SHA1 Message Date
Rui Ueyama a60058c8f5 Fix -output option.
Usually, options that are longer than one character can be preceded
either by "-" or "--", but options starting with "o" are exceptions
because they conflict with "-o" option. They have to be preceded by
"--".

llvm-svn: 281004
2016-09-09 00:25:56 +00:00
Rui Ueyama 881406e787 Define '-undefined foo' as an alias to '-undefined=foo'.
llvm-svn: 280985
2016-09-08 20:35:29 +00:00
Ed Maste 4d9947ba09 ELF: Add -Qy as ignored option
GCC passes it by default on powerpc64 on FreeBSD. GNU ld claims "this
option is ignored for SVR4 compatibility", so we can ignore it too.

Differential Revision:	https://reviews.llvm.org/D24313

llvm-svn: 280864
2016-09-07 21:10:25 +00:00
George Rimar bcbbb3987d [ELF] - Sort command line options. NFC.
llvm-svn: 280803
2016-09-07 11:43:18 +00:00
Petr Hosek 5baa1c7641 [ELF] Add support for -no-gc-sections flag
This flag is supported by both BFD ld and gold and is occasionally
used to negate the effect of -gc-sections flag.

Differential Revision: https://reviews.llvm.org/D24270

llvm-svn: 280729
2016-09-06 18:28:49 +00:00
Rui Ueyama 6c7ad13f89 Add -nostdlib.
llvm-svn: 280528
2016-09-02 19:20:33 +00:00
George Rimar b952ece2df [ELF] - Fix for: bug 30237 - lld does not implement -f option
FreeBSD's libstdc++ build (used on tier-2 architectures) uses GNU ld's 
-f <name> option, which sets the DT_AUXILIARY field to the specified name.
Multiple -f options may be specified and the DT_AUXILIARY entries 
will be added in the order in which they appear.

Patch implements that option.

Differential revision: https://reviews.llvm.org/D24139

llvm-svn: 280475
2016-09-02 09:13:05 +00:00
George Rimar 449cf3e44a Removed trailing whitespace. NFC.
llvm-svn: 279729
2016-08-25 10:39:04 +00:00
George Rimar 86ce267a4a [ELF] - Implemented --oformat binary option.
-oformat output-format
`-oformat' option can be used to specify the binary format for the output object file.

Patch implements binary format output type.

Differential revision: https://reviews.llvm.org/D23769

llvm-svn: 279726
2016-08-25 09:05:47 +00:00
Ed Maste dec9808353 ELF: ignore -EB and -EL options
Differential Revision:	https://reviews.llvm.org/D23124

llvm-svn: 279058
2016-08-18 12:44:45 +00:00
Ed Maste b2c8037c35 ELF: ignored option -G may be joined with its argument
llvm-svn: 278819
2016-08-16 16:26:46 +00:00
Davide Italiano a9210ef4f5 [ELF] Ignore -g option for compatibility.
Also ld.bfd and ld.gold ignore this options. I hit this one in
the wild, and just ignoring it's trivial, so, let's do it.

llvm-svn: 277531
2016-08-02 22:14:00 +00:00
Davide Italiano 38115ffcef [ELF/ARM] Add support for R_ARM_TARGET1 relocation.
Differential Revision:  https://reviews.llvm.org/D22990

llvm-svn: 277369
2016-08-01 19:28:13 +00:00
Davide Italiano 8c83382a95 [ELF] Support --output. Also output= can take two dashes.
llvm-svn: 276826
2016-07-27 01:57:15 +00:00
Petr Hosek d7bd2389ce [ELF] Support for setting the base address
The -image-base option allows for overriding the base address.

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

llvm-svn: 275206
2016-07-12 19:37:53 +00:00
Davide Italiano 3f36781dec [ELF] Ignore --demangle. We already demangle symbols by default.
llvm-svn: 274806
2016-07-07 23:32:36 +00:00
Davide Italiano f296a7eeae [ELF] Introduce a flag to parse response files according to windows rules.
Differential Revision:  http://reviews.llvm/org/D22015

llvm-svn: 274684
2016-07-06 21:24:34 +00:00
Davide Italiano c03d610cff [ELF] Support --entry= option variant. Update tests while I'm there.
llvm-svn: 274524
2016-07-04 21:50:50 +00:00
George Rimar 857644cef8 [ELF] - Implemented --fatal-warnings option.
--fatal-warnings: Treat warnings as errors

DIfferential revision: http://reviews.llvm.org/D21969

llvm-svn: 274504
2016-07-04 13:43:12 +00:00
Rui Ueyama 1df56894f8 Do not allow "--" with single-letter options.
In general, we accept both -foo and --foo as command line options,
but if an option is a single letter option, we don't want to allow
double dashes because GNU linkers don't accept such combination.

llvm-svn: 274219
2016-06-30 08:43:23 +00:00
George Rimar e86dcd0cbd [ELF] - Added support for --unresolved-symbols option.
Option has next description (http://linux.die.net/man/1/ld):
"--unresolved-symbols=method
Determine how to handle unresolved symbols. There are four possible values for method
according to documentation:

ignore-all: Do not report any unresolved symbols.
report-all: Report all unresolved symbols. This is the default.
ignore-in-object-files: Report unresolved symbols that are contained in shared libraries, but ignore them if they come from regular object files.
ignore-in-shared-libs: Report unresolved symbols that come from regular object files, but ignore them if they come from shared libraries."

Since report-all is default and we traditionally do not report about undefined symbols in lld,
report-all does not report about undefines from DSO. 
ignore-in-object-files also does not do that. Handling of that option differs from what gnu linkers do.

Option works in next way in lld:
ignore-all: Do not report any unresolved symbols.
report-all: Report all unresolved symbols except symbols from DSOs. This is the default.
ignore-in-object-files: The same as ignore-all.
gnore-in-shared-libs: The same as report-all.

This is PR24524.

Differential revision: http://reviews.llvm.org/D21794

llvm-svn: 274123
2016-06-29 12:35:04 +00:00
George Rimar 36b2c0a683 [ELF] - Implemented --no-undefined-version flag
Option checks for cases where a version script explicitly lists
a symbol, but the symbol is not defined and errors out such
cases if any.

Differential revision: http://reviews.llvm.org/D21745

llvm-svn: 273998
2016-06-28 08:07:26 +00:00
Rui Ueyama 6a9940260c Define -v and -V as aliases to --version.
This is for GNU compatibility.

llvm-svn: 273847
2016-06-27 07:35:00 +00:00
Rui Ueyama 596eba86bc Ignore --sort-common.
Because we always sort common symbols, we can ignore the option.

llvm-svn: 273842
2016-06-27 02:43:27 +00:00
Rui Ueyama d60dae8a6a Implement --trace-symbol=symbol option.
Patch by Shridhar Joshi.

This option provides names of all the link time modules which define and
reference symbols requested by user. This helps to speed up application
development by detecting references causing undefined symbols.
It also helps in detecting symbols being resolved to wrong (unintended)
definitions in case of applications containing multiple definitions for
same symbols with different types, bindings.

Implements PR28226.

llvm-svn: 273536
2016-06-23 07:00:17 +00:00
Rui Ueyama d1188f757c Accept both single and double dashes for all options.
This is a follow-up patch to r273218. GNU ld accepts both "--" and "-"
for all multi-letter options except "-o". This patch makes lld compatible
with that behavior.

llvm-svn: 273256
2016-06-21 08:45:50 +00:00
Rui Ueyama 36a31171ff Allow both one and two dashes for all multi-letter options.
GNU ld's manual page says that all options whose names are
multiple letters, except those who start with "o", can start
either with one or two dashes.

llvm-svn: 273218
2016-06-20 23:10:40 +00:00
Davide Italiano a074fe41bf [ELF] Accept --soname= (two dashes).
Update an existing test to exercise the new functionality, while
I'm here.

llvm-svn: 273175
2016-06-20 17:58:09 +00:00
Davide Italiano df24d5b8c8 [LTO] Add --lto-aa-pipeline.
Differential Revision:  http://reviews.llvm.org/D20888

llvm-svn: 271605
2016-06-02 22:58:11 +00:00
Sean Silva 8ef190c7b0 Make -L description a bit more precise.
llvm-svn: 270966
2016-05-27 04:48:26 +00:00
Sean Silva 3b536d0916 Explain a bit better what --start-lib and --end-lib do.
llvm-svn: 270965
2016-05-27 04:48:24 +00:00
Sean Silva 688fade4dd Add a help description for --threads to avoid confusion.
llvm-svn: 270964
2016-05-27 04:48:21 +00:00
Sean Silva 2c1a9da83f --threads is a flag, not a number
We would previously accept `--threads=4`, but this option just turns on
threading and does not specify a number of threads.

I ran into this by accident because I was passing `--threads=<n>` but
the number didn't seem to affect anything.

llvm-svn: 270963
2016-05-27 04:30:27 +00:00
Rui Ueyama 1795f782e9 Do not ignore --no_ctors_in_init_array flag.
That flag is probably too dangerous to ignore silently.

llvm-svn: 270711
2016-05-25 15:30:11 +00:00
Rui Ueyama c789b631f3 Really define --export-dynamic-symbol= as an alias to --export-dynamic-symbol.
Thanks to Sean for pointing it out.

llvm-svn: 270660
2016-05-25 04:29:55 +00:00
Rui Ueyama dadda2fe08 Add a few options for compatibility with GNU.
llvm-svn: 270651
2016-05-25 03:38:16 +00:00
Saleem Abdulrasool 5e9944ee0a ELF: accept and ignore --no-undefined-version for compatibility
This is currently unsupported.  Accept and ignore the flag for invocation
compatibility.

llvm-svn: 269788
2016-05-17 17:34:50 +00:00
Davide Italiano d26c4a14ca [LTO] Add the ability to specify a subset of passes to run.
Differential Revision:  http://reviews.llvm.org/D20267

llvm-svn: 269605
2016-05-15 19:29:38 +00:00
Davide Italiano bf5ef7b63b [ELF] Ignore -d option (and aliases).
The linker already allocates common symbols by default.
Discussed with Rafael.

llvm-svn: 268117
2016-04-29 21:44:02 +00:00
Davide Italiano 575ad8c2e1 [ELF] -R is an alias for -rpath.
perl-5 uses the former, so provide an alias. Found while linking
the whole set of FreeBSD ports with lld.

llvm-svn: 267801
2016-04-27 21:56:53 +00:00
Davide Italiano 034f58a9bd [ELF] Introduce --reproduce flag.
--reproduce dumps the object files in a directory chosen
(preserving the file system layout) and the linker invocation
so that people can create an archive and upload for debugging.

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

llvm-svn: 267497
2016-04-26 00:22:24 +00:00
Rui Ueyama 1e9e615f92 LTO: Merge -lto-no-discard-value-names with -save-temps.
This patch is to remove -lto-no-discard-value-names flag and
instead to use -save-temps as we discussed in the post-commit
review thread for r267020.

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

llvm-svn: 267230
2016-04-22 21:43:10 +00:00
Peter Collingbourne 66ac1d6152 ELF: Implement basic support for --version-script.
This patch only implements support for version scripts of the form:
  { [ global: symbol1; symbol2; [...]; symbolN; ] local: *; };
No wildcards are supported, other than for the local entry. Symbol versioning
is also not supported.

It works by introducing a new Symbol flag which tracks whether a symbol
appears in the global section of a version script.

This patch also simplifies the logic in SymbolBody::isPreemptible(), and
teaches it to handle the case where symbols with default visibility in DSOs
do not appear in the dynamic symbol table because of a version script.

Fixes PR27482.

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

llvm-svn: 267208
2016-04-22 20:21:26 +00:00
Peter Collingbourne 760e583e22 ELF: Implement --export-dynamic-symbol.
llvm-svn: 267184
2016-04-22 18:44:06 +00:00
Saleem Abdulrasool 1b5bf445a0 ELF: support -- version of discard-{all,locals}
GNU ld and gold only support the discard-all and discard-locals with two dashes.
Retain the compatibility with the one dash spelling, but also accept the two
dashed form.

llvm-svn: 267032
2016-04-21 18:29:13 +00:00
Saleem Abdulrasool 1761dddc4f ELF: alias `--no-copy-dt-needed-entries` to `--no-add-needed`
`--add-needed` and `--no-add-needed` have been deprecated due to the similarity
of their spelling to `--as-needed` and `--no-as-needed`.  They have been renamed
to `--copy-dt-needed-entries` and `--no-copy-dt-needed-entries`.

llvm-svn: 267031
2016-04-21 18:29:09 +00:00
Davide Italiano 5abcb3cc5b [LTO] Discard names for values that are not global by default.
Rafael reported on the mailing list that this reduces peak memory
usage while linking llvm-as by 15%. It makes sense to make it
the default, and introduce an inverse knob -lto-no-discard-value-names
for those who want to restore the old behavior.

llvm-svn: 267020
2016-04-21 17:46:38 +00:00
Davide Italiano 3c0410d09d [LTO] Discard names for Values that are not global.
This is not on by default (but it might be in the future).
The knob to enable the optimization is -lto-discard-value-names.

llvm-svn: 266953
2016-04-21 04:46:22 +00:00
Davide Italiano bc176631cd [LTO] Implement parallel Codegen for LTO using splitCodeGen.
Parallelism level can be chosen using the new --lto-jobs=K option
where K is the number of threads used for CodeGen. It currently
defaults to 1.

llvm-svn: 266484
2016-04-15 22:38:10 +00:00
Adhemerval Zanella 9df0720766 ELF: Implement --dynamic-list
This patch implements the --dynamic-list option, which adds a list of
global symbol that either should not be bounded by default definition
when creating shared libraries, or add in dynamic symbol table in the
case of creating executables.

The patch modifies the ScriptParserBase class to use a list of Token
instead of StringRef, which contains information if the token is a
quoted or unquoted strings. It is used to use a faster search for
exact match symbol name.

The input file follow a similar format of linker script with some
simplifications (it does not have scope or node names). It leads
to a simplified parser define in DynamicList.{cpp,h}.

Different from ld/gold neither glob pattern nor mangled names
(extern 'C++') are currently supported.

llvm-svn: 266227
2016-04-13 18:51:11 +00:00