diff options
author | Nick Clifton <nickc@redhat.com> | 2015-04-07 16:29:41 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-04-07 16:29:41 +0100 |
commit | 3ea6077552ad86ebb441bef6e1bd40e18d06ab44 (patch) | |
tree | 2a705af6063e141f715ad6e96547feffacec90a8 /ld/testsuite/ld-elf | |
parent | 8a06aea71e0aa9099d0ca593dbb58f6e056af4ff (diff) | |
download | gdb-3ea6077552ad86ebb441bef6e1bd40e18d06ab44.zip gdb-3ea6077552ad86ebb441bef6e1bd40e18d06ab44.tar.gz gdb-3ea6077552ad86ebb441bef6e1bd40e18d06ab44.tar.bz2 |
Add new linker option: --warn-orphan which generates warning messages when orphan sections are detected.
ld * ld.h (struct ld_config_type): Add new field: warn_orphan.
* ldlex.h (enum option_values): Add OPTION_WARN_ORPHAN and
OPTION_NO_WARN_ORPHAN.
* lexsup.c (ld_options): Add --warn-orphan and --no-warn-orphan.
(parse_args): Handle the new options.
* ldemul.c (ldemul_place_orphan): If requested, generate a warning
message when an orphan section is placed in the output file.
* ld.texinfo: Document the new option.
* NEWS: Mention the new feature.
tests * ld-elf/orphan-5.l: New test - checks the linker's output with
--warn-orphan enabled.
* ld-elf/elf.exp: Run the new test.
Diffstat (limited to 'ld/testsuite/ld-elf')
-rw-r--r-- | ld/testsuite/ld-elf/elf.exp | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/orphan-5.l | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index f126650..d1a70ea 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -116,6 +116,18 @@ foreach t $test_list { run_dump_test [file rootname $t] } +# Check that the --warn-orphan option works correctly. +run_ld_link_tests { + {"Report orphan sections" + "--script orphan.ld --warn-orphan" + "" + "" + {orphan.s} + { { ld "orphan-5.l" } } + "orphan" + } +} + if { [istarget *-*-linux*] || [istarget *-*-nacl*] || [istarget *-*-gnu*] } { diff --git a/ld/testsuite/ld-elf/orphan-5.l b/ld/testsuite/ld-elf/orphan-5.l new file mode 100644 index 0000000..7b65af2 --- /dev/null +++ b/ld/testsuite/ld-elf/orphan-5.l @@ -0,0 +1,5 @@ +#... +.*Warning: input section '.notbad' from file 'tmpdir/orphan.o' is not mentioned in linker script +#... +.*Warning: input section '.note.bar' from file 'tmpdir/orphan.o' is not mentioned in linker script +#... |