From 931804de6cec4ba55de1bf8b2f893879ebbf1537 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 24 Dec 2014 01:03:44 +1030 Subject: [PATCH] Yet another DEFINED testcase * ld-scripts/defined6.s, * ld-scripts/defined6.t, * ld-scripts/defined6.d: New test. * ld-scripts/defined.exp: Run it. --- ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-scripts/defined.exp | 3 +++ ld/testsuite/ld-scripts/defined6.d | 23 +++++++++++++++++++++++ ld/testsuite/ld-scripts/defined6.s | 9 +++++++++ ld/testsuite/ld-scripts/defined6.t | 21 +++++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 ld/testsuite/ld-scripts/defined6.d create mode 100644 ld/testsuite/ld-scripts/defined6.s create mode 100644 ld/testsuite/ld-scripts/defined6.t 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 + + * 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 * 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); -- 2.7.4