Commit Graph

9 Commits

Author SHA1 Message Date
George Rimar a99b3759bf [ELF] - Repair (re-enable) few ICF test cases.
--verbose is not used to report ICF sections since r324755,
--print-icf-sections is used instead.

These tests were at fact disabled since that time.

llvm-svn: 335354
2018-06-22 15:08:01 +00:00
Rui Ueyama 2d9e7a8956 Use toString to stringize sections and files.
Differential Revision: https://reviews.llvm.org/D43251

llvm-svn: 325065
2018-02-13 22:56:49 +00:00
Rui Ueyama 7b90efbece Do not print out removed ICF sections for -verbose.
GNU gold doesn't print out ICF sections for -verbose. It only shows
them for -print-icf-sections. We printed out them for -verbose because
we didn't have -print-icf-sections. Now that we have the option, there's
no reason to print out for -verbose.

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

llvm-svn: 324755
2018-02-09 17:55:09 +00:00
James Henderson 9c6e2fd5a4 [ELF] Add --print-icf-sections flag
Currently ICF information is output through stderr if the "--verbose"
flag is used. This differs to Gold for example, which uses an explicit
flag to output this to stdout. This commit adds the
"--print-icf-sections" and "--no-print-icf-sections" flags and changes
the output message format for clarity and consistency with
"--print-gc-sections". These messages are still output to stderr if
using the verbose flag. However to avoid intermingled message output to
console, this will not occur when the "--print-icf-sections" flag is
used.

Existing tests have been modified to expect the new message format from
stderr.

Patch by Owen Reynolds.

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

Reviewers: ruiu, rafael

Reviewed by: 

llvm-svn: 323976
2018-02-01 16:00:46 +00:00
Rafael Espindola b5506e6baf Rename --icf-data and add a corresponding flag for functions.
When we have --icf=safe we should be able to define --icf=all as a
shorthand for --icf=safe --ignore-function-address-equality.

For now --ignore-function-address-equality is used only to control
access to non preemptable symbols in shared libraries.

llvm-svn: 322152
2018-01-10 01:37:36 +00:00
Rafael Espindola 814ece6854 Add an option for ICFing data.
An internal linker has support for merging identical data and in some
cases it can be a significant win.

This is behind an off by default flag so it has to be requested
explicitly.

llvm-svn: 320448
2017-12-12 01:36:24 +00:00
Sam Clegg 77c1def71a Use ErrorOS for log messages as well as error
log are also diagnostics so it seems like they should to
the same place as errors and debug messages.

Without this change when I enable --verbose those messages
go to stdout, but when I enable "-mllvm -debug" those messages
go to stderr (because dbgs() goes to stderr by default).

So I end up having to do this a lot:
 lld <args> > output_message 2>&1

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

llvm-svn: 320427
2017-12-11 21:57:31 +00:00
Rafael Espindola b43da540cd Fix test to test what it intended to test.
The test was added to test that we don't merge read only data
sections, but the sections in the test were rw.

llvm-svn: 320339
2017-12-11 01:06:39 +00:00
Rui Ueyama 13ed0b691e ELF ICF: Merge only functions.
Previously, LLD merged all read-only sections. So the following
program prints out "true" if -icf=all is specified.

  static const int foo = 1;
  static const int bar = 1;
  int main() { printf("%s\n", &foo == &bar ? "true" : "false"); }

This is somewhat counter-intuitive, and it actually caused nasty issues.
One example is https://bugs.chromium.org/p/chromium/issues/detail?id=682773#c24.

This patch changes the way how it works. Now ICF merges only functions
(i.e. executable sections).

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

llvm-svn: 296534
2017-02-28 22:42:49 +00:00