From 035801cebe9ffbdddb465b81ae514a465ce9c64c Mon Sep 17 00:00:00 2001 From: Faraz Shahbazker Date: Tue, 2 Apr 2019 20:17:16 +0000 Subject: ld: Add --no-print-map-discarded option Add a new option to disable the listing of discarded sections in map file output. The use case stems from a large application built with -ffunction-sections --gc-sections where the list of discarded sections blows up the map file output. The default behaviour remains to print discarded sections, but the new option allows us to disable it. ld/ * NEWS: Mention new option --no-print-map-discarded. * ld.h (ld_config_type) : New field. * ldlang.c (lang_map): Conditionally output discarded sections in map files based on configuration option. * ldlex.h (option_values) : New. * ldmain.c (main): Enabled print_map_discarded by default. * lexsup.c (ld_options): Add new command-line options. (parse_args) : New cases. * ld.texi: Document new options. * testsuite/ld-gc/gc.exp: Add new test. * testsuite/ld-gc/skip-map-discarded.s: New file. * testsuite/ld-gc/skip-map-discarded.d: New file. * testsuite/ld-gc/skip-map-discarded.map: New file. --- ld/testsuite/ld-gc/gc.exp | 2 ++ ld/testsuite/ld-gc/skip-map-discarded.d | 3 +++ ld/testsuite/ld-gc/skip-map-discarded.map | 5 +++++ ld/testsuite/ld-gc/skip-map-discarded.s | 5 +++++ 4 files changed, 15 insertions(+) create mode 100644 ld/testsuite/ld-gc/skip-map-discarded.d create mode 100644 ld/testsuite/ld-gc/skip-map-discarded.map create mode 100644 ld/testsuite/ld-gc/skip-map-discarded.s (limited to 'ld/testsuite/ld-gc') diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp index 536356c..13968cc 100644 --- a/ld/testsuite/ld-gc/gc.exp +++ b/ld/testsuite/ld-gc/gc.exp @@ -171,3 +171,5 @@ if { [is_elf_format] && [check_shared_lib_support] \ ] run_dump_test "pr20306" } + +run_dump_test "skip-map-discarded" diff --git a/ld/testsuite/ld-gc/skip-map-discarded.d b/ld/testsuite/ld-gc/skip-map-discarded.d new file mode 100644 index 0000000..2e79f0b --- /dev/null +++ b/ld/testsuite/ld-gc/skip-map-discarded.d @@ -0,0 +1,3 @@ +#name: Check --no-print-map-discarded linker option +#ld: -e 0 --gc-sections --no-print-map-discarded +#map: skip-map-discarded.map diff --git a/ld/testsuite/ld-gc/skip-map-discarded.map b/ld/testsuite/ld-gc/skip-map-discarded.map new file mode 100644 index 0000000..ca4818e --- /dev/null +++ b/ld/testsuite/ld-gc/skip-map-discarded.map @@ -0,0 +1,5 @@ +#failif +Discarded input sections +#... + _foo.* +#... diff --git a/ld/testsuite/ld-gc/skip-map-discarded.s b/ld/testsuite/ld-gc/skip-map-discarded.s new file mode 100644 index 0000000..630aab0 --- /dev/null +++ b/ld/testsuite/ld-gc/skip-map-discarded.s @@ -0,0 +1,5 @@ +.globl __start +__start: + .section _foo +foo: + .long 1 -- cgit v1.1