aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elf
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-07-28 19:20:37 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-09-04 22:30:55 +0100
commitc005eb9e34ac08be0cd40e19a741d345bd43eab9 (patch)
treee161b0bf51e8b02bfc7e1c6e1cc5beb92fa86e4b /ld/testsuite/ld-elf
parente65b52456bc3f60a176fece5e34e420c5a75bd16 (diff)
downloadgdb-c005eb9e34ac08be0cd40e19a741d345bd43eab9.zip
gdb-c005eb9e34ac08be0cd40e19a741d345bd43eab9.tar.gz
gdb-c005eb9e34ac08be0cd40e19a741d345bd43eab9.tar.bz2
ld: Extend options for altering orphan handling behaviour.
Replace the options --warn-orphan and --no-warn-orphan with a single option --orphan-handling=MODE, where mode can be place, warn, error, and discard. Mode 'place' is the default, and is the current behaviour, placing the orphan section into a suitable output section. Mode 'warn' is the same as '--warn-orphan'. The orphan is also placed using the same algorithm as for 'place'. Mode 'error' is the same as '--warn-orphan' and '--fatal-warnings'. Mode 'discard' assigns all output sections to the /DISCARD/ section. ld/ChangeLog: * ld.h (enum orphan_handling_enum): New. (ld_config_type): Remove warn_orphan, add orphan_handling. * ldemul.c (ldemul_place_orphan): Remove warning about orphan sections. * ldlang.c (ldlang_place_orphan): New function. (lang_place_orphans): Call ldlang_place_orphan. * ldlex.h (enum option_values): Remove OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add OPTION_ORPHAN_HANDLING. * lexsup.c (ld_options): Remove 'warn-orphan' and 'no-warn-orphan', add 'orphan-handling'. (parse_args): Remove handling for OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add handling for OPTION_ORPHAN_HANDLING. * NEWS: Replace text about --warn-orphan with --orphan-handling. * ld.texinfo (Options): Remove --warn-orphan entry and add entry on --orphan-handling. (Orphan Sections): Add reference to relevant command line options. ld/testsuite/ChangeLog: * ld-elf/elf.exp: Switch to rely on run_dump_test. * ld-elf/orphan-5.l: Update expected output. * ld-elf/orphan-5.d: New file. * ld-elf/orphan-6.d: New file. * ld-elf/orphan-6.l: New file. * ld-elf/orphan-7.d: New file. * ld-elf/orphan-7.map: New file. * ld-elf/orphan-8.d: New file. * ld-elf/orphan-8.map: New file.
Diffstat (limited to 'ld/testsuite/ld-elf')
-rw-r--r--ld/testsuite/ld-elf/elf.exp12
-rw-r--r--ld/testsuite/ld-elf/orphan-5.d4
-rw-r--r--ld/testsuite/ld-elf/orphan-5.l4
-rw-r--r--ld/testsuite/ld-elf/orphan-6.d4
-rw-r--r--ld/testsuite/ld-elf/orphan-6.l5
-rw-r--r--ld/testsuite/ld-elf/orphan-7.d4
-rw-r--r--ld/testsuite/ld-elf/orphan-7.map7
-rw-r--r--ld/testsuite/ld-elf/orphan-8.d4
-rw-r--r--ld/testsuite/ld-elf/orphan-8.map7
9 files changed, 37 insertions, 14 deletions
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index 55bcb72..e56c205 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -124,18 +124,6 @@ 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.d b/ld/testsuite/ld-elf/orphan-5.d
new file mode 100644
index 0000000..4f99cd0
--- /dev/null
+++ b/ld/testsuite/ld-elf/orphan-5.d
@@ -0,0 +1,4 @@
+#name: Report warning for orphan sections
+#ld: --script orphan.ld --orphan-handling=warn
+#source: orphan.s
+#warning_output: orphan-5.l
diff --git a/ld/testsuite/ld-elf/orphan-5.l b/ld/testsuite/ld-elf/orphan-5.l
index 7b65af2..20a9fe7 100644
--- a/ld/testsuite/ld-elf/orphan-5.l
+++ b/ld/testsuite/ld-elf/orphan-5.l
@@ -1,5 +1,5 @@
#...
-.*Warning: input section '.notbad' from file 'tmpdir/orphan.o' is not mentioned in linker script
+.*warning: orphan section `\.notbad' from `tmpdir/orphan\.o' being placed in section `\.notbad'\.
#...
-.*Warning: input section '.note.bar' from file 'tmpdir/orphan.o' is not mentioned in linker script
+.*warning: orphan section `\.note\.bar' from `tmpdir/orphan\.o' being placed in section `\.note\.bar'\.
#...
diff --git a/ld/testsuite/ld-elf/orphan-6.d b/ld/testsuite/ld-elf/orphan-6.d
new file mode 100644
index 0000000..c6565fb
--- /dev/null
+++ b/ld/testsuite/ld-elf/orphan-6.d
@@ -0,0 +1,4 @@
+#name: Report error for orphan sections
+#ld: --script orphan.ld --orphan-handling=error
+#source: orphan.s
+#error_output: orphan-6.l
diff --git a/ld/testsuite/ld-elf/orphan-6.l b/ld/testsuite/ld-elf/orphan-6.l
new file mode 100644
index 0000000..5ac7895
--- /dev/null
+++ b/ld/testsuite/ld-elf/orphan-6.l
@@ -0,0 +1,5 @@
+#...
+.*error: unplaced orphan section `\.notbad' from `tmpdir/orphan\.o'\.
+#...
+.*error: unplaced orphan section `\.note\.bar' from `tmpdir/orphan\.o'\.
+#...
diff --git a/ld/testsuite/ld-elf/orphan-7.d b/ld/testsuite/ld-elf/orphan-7.d
new file mode 100644
index 0000000..01d6e80
--- /dev/null
+++ b/ld/testsuite/ld-elf/orphan-7.d
@@ -0,0 +1,4 @@
+#name: Discard orphan sections
+#ld: --script orphan.ld --orphan-handling=discard
+#source: orphan.s
+#map: orphan-7.map
diff --git a/ld/testsuite/ld-elf/orphan-7.map b/ld/testsuite/ld-elf/orphan-7.map
new file mode 100644
index 0000000..52cc359
--- /dev/null
+++ b/ld/testsuite/ld-elf/orphan-7.map
@@ -0,0 +1,7 @@
+
+Discarded input sections
+
+ \.notbad 0x0+ 0x4 tmpdir/.*\.o
+ \.note\.bar 0x0+ 0x4 tmpdir/.*\.o
+
+#...
diff --git a/ld/testsuite/ld-elf/orphan-8.d b/ld/testsuite/ld-elf/orphan-8.d
new file mode 100644
index 0000000..bbd7288
--- /dev/null
+++ b/ld/testsuite/ld-elf/orphan-8.d
@@ -0,0 +1,4 @@
+#name: Place orphan sections
+#ld: --script orphan.ld --orphan-handling=place
+#source: orphan.s
+#map: orphan-8.map
diff --git a/ld/testsuite/ld-elf/orphan-8.map b/ld/testsuite/ld-elf/orphan-8.map
new file mode 100644
index 0000000..b672978
--- /dev/null
+++ b/ld/testsuite/ld-elf/orphan-8.map
@@ -0,0 +1,7 @@
+#...
+.notbad 0x0000000000000004 0x4
+ .notbad 0x0000000000000004 0x4 tmpdir/dump0.o
+#...
+.note.bar 0x0000000000000010 0x4
+ .note.bar 0x0000000000000010 0x4 tmpdir/dump0.o
+#...