aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/testsuite/ChangeLog7
-rw-r--r--ld/testsuite/ld-scripts/defined.exp3
-rw-r--r--ld/testsuite/ld-scripts/defined6.d23
-rw-r--r--ld/testsuite/ld-scripts/defined6.s9
-rw-r--r--ld/testsuite/ld-scripts/defined6.t21
5 files changed, 63 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index fdef038..628c906 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-24 Alan Modra <amodra@gmail.com>
+
+ * ld-scripts/defined6.s,
+ * ld-scripts/defined6.t,
+ * ld-scripts/defined6.d: New test.
+ * ld-scripts/defined.exp: Run it.
+
2014-12-23 Andrew Burgess <andrew.burgess@embecosm.com>
* ld-avr/relax-elf-flags-01.d: New file.
diff --git a/ld/testsuite/ld-scripts/defined.exp b/ld/testsuite/ld-scripts/defined.exp
index b871004..16dcbe9 100644
--- a/ld/testsuite/ld-scripts/defined.exp
+++ b/ld/testsuite/ld-scripts/defined.exp
@@ -69,4 +69,7 @@ run_dump_test "defined4"
if ![is_aout_format] {
run_dump_test "defined5"
}
+if [is_elf_format] {
+ run_dump_test "defined6"
+}
set LDFLAGS "$saved_LDFLAGS"
diff --git a/ld/testsuite/ld-scripts/defined6.d b/ld/testsuite/ld-scripts/defined6.d
new file mode 100644
index 0000000..c8ea863
--- /dev/null
+++ b/ld/testsuite/ld-scripts/defined6.d
@@ -0,0 +1,23 @@
+#source: defined6.s
+#ld: -T defined6.t
+#nm: -B
+#notarget: hppa*-hpux*
+# hppa64-hpux has a different .comm
+
+# Check that DEFINED works with various symbol types
+#...
+0+1 A common
+0+1 A common_post
+0+1 A common_pre
+0+1 A defined
+0+1 A defined_post
+0+1 A defined_pre
+0+1 A undef
+0+1 A undef_post
+0+0 A undef_pre
+0+1 A undefweak
+0+1 A undefweak_post
+0+0 A undefweak_pre
+0+1 A weak
+0+1 A weak_post
+0+1 A weak_pre
diff --git a/ld/testsuite/ld-scripts/defined6.s b/ld/testsuite/ld-scripts/defined6.s
new file mode 100644
index 0000000..00b1f7f
--- /dev/null
+++ b/ld/testsuite/ld-scripts/defined6.s
@@ -0,0 +1,9 @@
+ .globl defined
+ defined == 1
+ .globl undef
+ .comm common,1
+ .weak weak
+ weak == 2
+ .weak undefweak
+ .data
+ .dc.a undefweak
diff --git a/ld/testsuite/ld-scripts/defined6.t b/ld/testsuite/ld-scripts/defined6.t
new file mode 100644
index 0000000..f4ca38a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/defined6.t
@@ -0,0 +1,21 @@
+SECTIONS
+{
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .bss : { *(.bss) *(COMMON) }
+}
+defined_pre = DEFINED (defined);
+defined = 1;
+defined_post = DEFINED (defined);
+undef_pre = DEFINED (undef);
+undef = 1;
+undef_post = DEFINED (undef);
+common_pre = DEFINED (common);
+common = 1;
+common_post = DEFINED (common);
+weak_pre = DEFINED (weak);
+weak = 1;
+weak_post = DEFINED (weak);
+undefweak_pre = DEFINED (undefweak);
+undefweak = 1;
+undefweak_post = DEFINED (undefweak);