From 0f5e0993ecce5e529126d83ccdaa2c2e84a1bf24 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 24 Jul 1995 21:03:12 +0000 Subject: [PATCH] * config/default.exp: Define objcopy if it is not defined. * ld-sh/*: New tests for SH relaxing. --- ld/testsuite/.Sanitize | 1 + ld/testsuite/ld-sh/.Sanitize | 39 ++++++++++++ ld/testsuite/ld-sh/sh1.s | 13 ++++ ld/testsuite/ld-sh/sh2.c | 115 +++++++++++++++++++++++++++++++++++ ld/testsuite/ld-sh/start.s | 27 ++++++++ 5 files changed, 195 insertions(+) create mode 100644 ld/testsuite/ld-sh/.Sanitize create mode 100644 ld/testsuite/ld-sh/sh1.s create mode 100644 ld/testsuite/ld-sh/sh2.c create mode 100644 ld/testsuite/ld-sh/start.s diff --git a/ld/testsuite/.Sanitize b/ld/testsuite/.Sanitize index d68fbc21de4..46d518ca52b 100644 --- a/ld/testsuite/.Sanitize +++ b/ld/testsuite/.Sanitize @@ -30,6 +30,7 @@ ld-bootstrap ld-cdtest ld-empic ld-scripts +ld-sh ld-shared ld-undefined ld-versados diff --git a/ld/testsuite/ld-sh/.Sanitize b/ld/testsuite/ld-sh/.Sanitize new file mode 100644 index 00000000000..c85f41651fd --- /dev/null +++ b/ld/testsuite/ld-sh/.Sanitize @@ -0,0 +1,39 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order.. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +sh.exp +sh1.s +sh2.c +start.s + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + +#eof diff --git a/ld/testsuite/ld-sh/sh1.s b/ld/testsuite/ld-sh/sh1.s new file mode 100644 index 00000000000..13c2858f4aa --- /dev/null +++ b/ld/testsuite/ld-sh/sh1.s @@ -0,0 +1,13 @@ + .text +foo: +L1: + mov.l L2,r0 + .uses L1 + jsr @r0 + rts + .align 2 +L2: + .long bar +bar: + rts + .align 2 diff --git a/ld/testsuite/ld-sh/sh2.c b/ld/testsuite/ld-sh/sh2.c new file mode 100644 index 00000000000..057812bb76a --- /dev/null +++ b/ld/testsuite/ld-sh/sh2.c @@ -0,0 +1,115 @@ +int global; + +extern void trap (int, int); +static void quit (int); +static int foo (int); + +int +main () +{ + if (foo (0) != 0 || global != 0) + quit (1); + if (foo (1) != 1 || global != 1) + quit (1); + if (foo (2) != 2 || global != 2) + quit (1); + if (foo (3) != 3 || global != 3) + quit (1); + if (foo (4) != 4 || global != 4) + quit (1); + if (foo (5) != 5 || global != 5) + quit (1); + if (foo (6) != 6 || global != 6) + quit (1); + if (foo (7) != 7 || global != 7) + quit (1); + if (foo (8) != 8 || global != 8) + quit (1); + quit (0); +} + +static void +quit (int status) +{ + trap (1, status); +} + +int +bar (int i) +{ + global = i; + return i; +} + +int +bar0 (int i) +{ + global = 0; + return i; +} + +int +bar1 (int i) +{ + global = 1; + return i; +} + +int +bar2 (int i) +{ + global = 2; + return i; +} + +int +bar3 (int i) +{ + global = 3; + return i; +} + +int +bar4 (int i) +{ + global = 4; + return i; +} + +int +bar5 (int i) +{ + global = 5; + return i; +} + +int +bar6 (int i) +{ + global = 6; + return i; +} + +int +bar7 (int i) +{ + global = 7; + return i; +} + +int +foo (int i) +{ + switch (i) + { + case 0: bar0 (0); return 0; + case 1: bar1 (1); return 1; + case 2: bar2 (2); return 2; + case 3: bar3 (3); return 3; + case 4: bar4 (4); return 4; + case 5: bar5 (5); return 5; + case 6: bar6 (6); return 6; + case 7: bar7 (7); return 7; + default: return bar (i); + } +} diff --git a/ld/testsuite/ld-sh/start.s b/ld/testsuite/ld-sh/start.s new file mode 100644 index 00000000000..2af4c799f33 --- /dev/null +++ b/ld/testsuite/ld-sh/start.s @@ -0,0 +1,27 @@ + .section .text + .global start +start: + + mov.l stack_k,r15 + + ! call the mainline +L1: + mov.l main_k,r0 + .uses L1 + jsr @r0 + nop + + .align 2 +stack_k: + .long _stack +main_k: + .long _main + + .global _trap +_trap: + trapa #3 + rts + nop + + .section .stack +_stack: .long 0xdeaddead -- 2.30.2