summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-gc
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2012-02-22 16:27:31 +0000
committerNick Clifton <nickc@redhat.com>2012-02-22 16:27:31 +0000
commit0786bd3c43fc3e8860f09fe5af7a9b3cf2564f58 (patch)
tree25ea35e406710a420d7a707d897dfe8691b2f895 /ld/testsuite/ld-gc
parentfea0b69c0dd2707aa35522f45510f3cde8f0b372 (diff)
downloadbinutils-redhat-0786bd3c43fc3e8860f09fe5af7a9b3cf2564f58.tar.gz
PR ld/13683
* ldlang.c (lang_process): Rerun lang_do_assignments before starting garbage collection. * ldexp.c (fold_name): Generate a reloc for defined symbols found without an associated output section during the mark phase. (exp_fold_tree_1): Continue processing an expression, even if we are unable to fold it, if we are in the first two evaluation phases. * ldexp.h (enum lang_phase_type): Add descriptions of the phases. * ld-gc/pr13683.c: New test source file. * ld-gc/pr13683.d: New test control and output file. * ld-gc/gc.exp: Run the pr13683 test. * ld-cris/tls-gc-68: Update expected symbol table dump. * ld-cris/tls-gc-69: Likewise. * ld-cris/tls-gc-70: Likewise. * ld-cris/tls-gc-71: Likewise. * ld-cris/tls-gc-75: Likewise. * ld-cris/tls-gc-76.d: Likewise. * ld-cris/tls-gc-79.d: Likewise.
Diffstat (limited to 'ld/testsuite/ld-gc')
-rw-r--r--ld/testsuite/ld-gc/gc.exp5
-rw-r--r--ld/testsuite/ld-gc/pr13683.c28
-rw-r--r--ld/testsuite/ld-gc/pr13683.d12
3 files changed, 45 insertions, 0 deletions
diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp
index 57f0ec3f7c..d8d34fa6e8 100644
--- a/ld/testsuite/ld-gc/gc.exp
+++ b/ld/testsuite/ld-gc/gc.exp
@@ -120,3 +120,8 @@ if { [is_remote host] || [which $CC] != 0 } {
run_dump_test "pr11218"
}
}
+
+if { [is_remote host] || [which $CC] != 0 } {
+ ld_compile "$CC $CFLAGS $cflags" $srcdir/$subdir/pr13683.c tmpdir/pr13683.o
+ run_dump_test "pr13683"
+}
diff --git a/ld/testsuite/ld-gc/pr13683.c b/ld/testsuite/ld-gc/pr13683.c
new file mode 100644
index 0000000000..c585e06db5
--- /dev/null
+++ b/ld/testsuite/ld-gc/pr13683.c
@@ -0,0 +1,28 @@
+void foo(void);
+
+int main(void)
+{
+ foo ();
+
+ for (;;)
+ ;
+}
+
+int a;
+
+void foo1(void)
+{
+ a = 1;
+}
+
+void foo2(void)
+{
+ a = 2;
+}
+
+void foo3(void)
+{
+ a = 3;
+}
+
+
diff --git a/ld/testsuite/ld-gc/pr13683.d b/ld/testsuite/ld-gc/pr13683.d
new file mode 100644
index 0000000000..31aaee4d43
--- /dev/null
+++ b/ld/testsuite/ld-gc/pr13683.d
@@ -0,0 +1,12 @@
+#name: --gc-sections with --defsym
+#source: dummy.s
+#ld: --gc-sections -e main --defsym foo=foo2 tmpdir/pr13683.o
+#nm: --format=bsd
+#xfail: sh64*-*-* iq2000-*-* lm32-*-* epiphany-*-* mips64vr-*-* frv-*-* m32c-*-* rl78-*-* rx-*-* sh-*-*
+
+# Note - look for both "foo" and "foo2" being defined, non-zero function symbols
+
+#...
+0+[1-9a-f]+[0-9a-f]*[ ]T[ ]_*foo
+0+[1-9a-f]+[0-9a-f]*[ ]T[ ]_*foo2
+#...