aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-07-03 16:32:45 +0930
committerAlan Modra <amodra@gmail.com>2014-07-03 17:05:42 +0930
commitd215621ebe5a6b60dff2e60c788a0f761e3cb5bd (patch)
treeeb5c641bf87b201f435e3cc6d0d753a7410ceab0 /ld/testsuite
parentfd48cee0093fef69608959d0f577c0c81fe24eec (diff)
downloadgdb-d215621ebe5a6b60dff2e60c788a0f761e3cb5bd.zip
gdb-d215621ebe5a6b60dff2e60c788a0f761e3cb5bd.tar.gz
gdb-d215621ebe5a6b60dff2e60c788a0f761e3cb5bd.tar.bz2
Reload --as-needed libraries inside groups
When a shared library appears within --start-group/--end-group ld may only discover a need for loading the library on the second or subsequent pass over archive libraries, as more objects are extracted. ld/ PR 17068 * ldlang.c (load_symbols): Always check flags.reload. (open_input_bfds): Always reload --as-needed shared libraries, not just when rescanning. * ldlang.h (struct lang_input_statement_flags): Update reload comment. * plugin.c (plugin_should_reload): Assume shared library arg. * plugin.h (plugin_should_reload): Update comment. ld/testsuite * ld-elf/pr17068.s: New. * ld-elf/pr17068a.s: New. * ld-elf/pr17068b.s: New. * ld-elf/pr17068c.s: New. * ld-elf/pr17068d.s: New. * ld-elf/pr17068e.s: New. * ld-elf/pr17068ez.s: New. * ld-elf/elf.exp: Run new test.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-elf/elf.exp26
-rw-r--r--ld/testsuite/ld-elf/pr17068.s2
-rw-r--r--ld/testsuite/ld-elf/pr17068a.s4
-rw-r--r--ld/testsuite/ld-elf/pr17068b.s4
-rw-r--r--ld/testsuite/ld-elf/pr17068c.s4
-rw-r--r--ld/testsuite/ld-elf/pr17068d.s6
-rw-r--r--ld/testsuite/ld-elf/pr17068e.s3
-rw-r--r--ld/testsuite/ld-elf/pr17068ez.s4
9 files changed, 58 insertions, 6 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index b59f584..7d3a6e4 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2014-07-03 Alan Modra <amodra@gmail.com>
+
+ * ld-elf/pr17068.s: New.
+ * ld-elf/pr17068a.s: New.
+ * ld-elf/pr17068b.s: New.
+ * ld-elf/pr17068c.s: New.
+ * ld-elf/pr17068d.s: New.
+ * ld-elf/pr17068e.s: New.
+ * ld-elf/pr17068ez.s: New.
+ * ld-elf/elf.exp: Run new test.
+
2014-07-02 Alan Modra <amodra@gmail.com>
* ld-powerpc/ambiguousv1.d: Match symbol table too.
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index 4c8ca3a..839c931 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -77,13 +77,12 @@ if { ![istarget hppa64*-hpux*] } {
}
}
-# Run a test to check linking a shared library with a broken linker
-# script that accidentally marks dynamic sections as notes. The
-# resulting executable is not expected to work, but the linker
-# should not seg-fault whilst creating the binary.
-#
-# Only run the test on targets thats support creating shared libraries.
+# Only run these tests on targets thats support creating shared libraries.
if { [check_shared_lib_support] } then {
+ # Run a test to check linking a shared library with a broken linker
+ # script that accidentally marks dynamic sections as notes. The
+ # resulting executable is not expected to work, but the linker
+ # should not seg-fault whilst creating the binary.
setup_xfail "tic6x-*-*"
run_ld_link_tests {
{"Build shared library for next test"
@@ -93,6 +92,21 @@ if { [check_shared_lib_support] } then {
{ { ld "note-3.l" } }
"a.out" }
}
+ setup_xfail "tic6x-*-*"
+ run_ld_link_tests {
+ {"Build pr17068.so"
+ "-shared" "" ""
+ {pr17068d.s} {} "pr17068.so"}
+ {"Build pr17068a.a"
+ "" "" ""
+ {pr17068a.s pr17068c.s pr17068ez.s} {} "pr17068a.a"}
+ {"Build pr17068b.a"
+ "" "" ""
+ {pr17068b.s pr17068e.s} {} "pr17068b.a"}
+ {"pr17068 link --as-needed lib in group"
+ "--as-needed" "--start-group tmpdir/pr17068a.a tmpdir/pr17068.so tmpdir/pr17068b.a --end-group" ""
+ {start.s pr17068.s} {} "pr17068"}
+ }
}
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
diff --git a/ld/testsuite/ld-elf/pr17068.s b/ld/testsuite/ld-elf/pr17068.s
new file mode 100644
index 0000000..9675ab4
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17068.s
@@ -0,0 +1,2 @@
+ .data
+ .dc.a a
diff --git a/ld/testsuite/ld-elf/pr17068a.s b/ld/testsuite/ld-elf/pr17068a.s
new file mode 100644
index 0000000..552697c
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17068a.s
@@ -0,0 +1,4 @@
+ .data
+ .globl a
+a:
+ .dc.a b
diff --git a/ld/testsuite/ld-elf/pr17068b.s b/ld/testsuite/ld-elf/pr17068b.s
new file mode 100644
index 0000000..aa536f2
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17068b.s
@@ -0,0 +1,4 @@
+ .data
+ .globl b
+b:
+ .dc.a c
diff --git a/ld/testsuite/ld-elf/pr17068c.s b/ld/testsuite/ld-elf/pr17068c.s
new file mode 100644
index 0000000..1d78f6d
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17068c.s
@@ -0,0 +1,4 @@
+ .data
+ .globl c
+c:
+ .dc.a d
diff --git a/ld/testsuite/ld-elf/pr17068d.s b/ld/testsuite/ld-elf/pr17068d.s
new file mode 100644
index 0000000..6165128
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17068d.s
@@ -0,0 +1,6 @@
+ .data
+ .globl d
+ .type d,%object
+d:
+ .dc.a e
+ .size d,.-d
diff --git a/ld/testsuite/ld-elf/pr17068e.s b/ld/testsuite/ld-elf/pr17068e.s
new file mode 100644
index 0000000..095eb89
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17068e.s
@@ -0,0 +1,3 @@
+ .data
+ .globl e
+e:
diff --git a/ld/testsuite/ld-elf/pr17068ez.s b/ld/testsuite/ld-elf/pr17068ez.s
new file mode 100644
index 0000000..70e040d
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr17068ez.s
@@ -0,0 +1,4 @@
+ .data
+ .globl e
+e:
+ .dc.a z