From 6de919175633d784d0b6038a1133431040c0765d Mon Sep 17 00:00:00 2001 From: amodra Date: Fri, 23 Aug 2002 08:14:06 +0000 Subject: [PATCH] * ld-sh/sh64/rd-sh64.exp: New framework file. * ld-sh/sh64/init-cmpct.d, ld-sh/sh64/init-media.d, ld-sh/sh64/init64.d, ld-sh/sh64/init.s: New tests for correct setting of ISA bit for init and fini entry-points. --- ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-sh/sh64/init-cmpct.d | 20 ++++++++++++++++++++ ld/testsuite/ld-sh/sh64/init-media.d | 19 +++++++++++++++++++ ld/testsuite/ld-sh/sh64/init.s | 16 ++++++++++++++++ ld/testsuite/ld-sh/sh64/init64.d | 19 +++++++++++++++++++ ld/testsuite/ld-sh/sh64/rd-sh64.exp | 30 ++++++++++++++++++++++++++++++ 6 files changed, 111 insertions(+) create mode 100644 ld/testsuite/ld-sh/sh64/init-cmpct.d create mode 100644 ld/testsuite/ld-sh/sh64/init-media.d create mode 100644 ld/testsuite/ld-sh/sh64/init.s create mode 100644 ld/testsuite/ld-sh/sh64/init64.d create mode 100644 ld/testsuite/ld-sh/sh64/rd-sh64.exp diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 9ec8ea2ea0..c8f31b8a31 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2002-08-23 Stephen Clarke + + * ld-sh/sh64/rd-sh64.exp: New framework file. + * ld-sh/sh64/init-cmpct.d, ld-sh/sh64/init-media.d, + ld-sh/sh64/init64.d, ld-sh/sh64/init.s: New tests for + correct setting of ISA bit for init and fini entry-points. + 2002-08-16 Stephen Clarke * ld-sh/sh64/sh64.exp: Add dlsection. diff --git a/ld/testsuite/ld-sh/sh64/init-cmpct.d b/ld/testsuite/ld-sh/sh64/init-cmpct.d new file mode 100644 index 0000000000..0005950818 --- /dev/null +++ b/ld/testsuite/ld-sh/sh64/init-cmpct.d @@ -0,0 +1,20 @@ +#source: init.s +#as: --abi=32 --isa=SHcompact +#ld: -shared -mshelf32 +#readelf: -d +#target: sh64-*-elf + +# Make sure that the lsb of DT_INIT and DT_FINI entries is not set +# when _init and _fini are SHcompact code. + +Dynamic segment at offset 0x358 contains 8 entries: + Tag Type Name/Value + 0x0000000c \(INIT\) 0x346 + 0x0000000d \(FINI\) 0x34e + 0x00000004 \(HASH\) 0x94 + 0x00000005 \(STRTAB\) 0x2d4 + 0x00000006 \(SYMTAB\) 0x144 + 0x0000000a \(STRSZ\) 114 \(bytes\) + 0x0000000b \(SYMENT\) 16 \(bytes\) + 0x00000000 \(NULL\) 0x0 + diff --git a/ld/testsuite/ld-sh/sh64/init-media.d b/ld/testsuite/ld-sh/sh64/init-media.d new file mode 100644 index 0000000000..81b41c2ef8 --- /dev/null +++ b/ld/testsuite/ld-sh/sh64/init-media.d @@ -0,0 +1,19 @@ +#source: init.s +#as: --abi=32 --isa=SHmedia +#ld: -shared -mshelf32 +#readelf: -d +#target: sh64-*-elf + +# Make sure that the lsb of DT_INIT and DT_FINI entries is set +# when _init and _fini are SHmedia code. + +Dynamic segment at offset 0x368 contains 8 entries: + Tag Type Name/Value + 0x0000000c \(INIT\) 0x347 + 0x0000000d \(FINI\) 0x357 + 0x00000004 \(HASH\) 0x94 + 0x00000005 \(STRTAB\) 0x2d4 + 0x00000006 \(SYMTAB\) 0x144 + 0x0000000a \(STRSZ\) 114 \(bytes\) + 0x0000000b \(SYMENT\) 16 \(bytes\) + 0x00000000 \(NULL\) 0x0 diff --git a/ld/testsuite/ld-sh/sh64/init.s b/ld/testsuite/ld-sh/sh64/init.s new file mode 100644 index 0000000000..4aa1ff937c --- /dev/null +++ b/ld/testsuite/ld-sh/sh64/init.s @@ -0,0 +1,16 @@ + .section .text,"ax" + .global _init + .type _init,@function +_init: + nop + nop + nop + nop + + .global _fini + .type _fini,@function +_fini: + nop + nop + nop + nop diff --git a/ld/testsuite/ld-sh/sh64/init64.d b/ld/testsuite/ld-sh/sh64/init64.d new file mode 100644 index 0000000000..6855a3235a --- /dev/null +++ b/ld/testsuite/ld-sh/sh64/init64.d @@ -0,0 +1,19 @@ +#source: init.s +#as: --abi=64 +#ld: -shared -mshelf64 +#readelf: -d +#target: sh64-*-elf + +# Make sure that the lsb of DT_INIT and DT_FINI entries is set +# when _init and _fini are SHmedia code. + +Dynamic segment at offset 0x488 contains 8 entries: + Tag Type Name/Value + 0x000000000000000c \(INIT\) 0x463 + 0x000000000000000d \(FINI\) 0x473 + 0x0000000000000004 \(HASH\) 0xe8 + 0x0000000000000005 \(STRTAB\) 0x3f0 + 0x0000000000000006 \(SYMTAB\) 0x198 + 0x000000000000000a \(STRSZ\) 114 \(bytes\) + 0x000000000000000b \(SYMENT\) 24 \(bytes\) + 0x0000000000000000 \(NULL\) 0x0 diff --git a/ld/testsuite/ld-sh/sh64/rd-sh64.exp b/ld/testsuite/ld-sh/sh64/rd-sh64.exp new file mode 100644 index 0000000000..cc5c3f7968 --- /dev/null +++ b/ld/testsuite/ld-sh/sh64/rd-sh64.exp @@ -0,0 +1,30 @@ +# Expect script for run_dump_test based ld-sh/sh64 tests. +# Copyright 2002 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Written by Stephen Clarke (stephen.clarke@superh.com) +# + +if ![istarget sh64-*-*] { + return +} + +set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +foreach sh64test $rd_test_list { + # We need to strip the ".d", but can leave the dirname. + verbose [file rootname $sh64test] + run_dump_test [file rootname $sh64test] +} -- 2.11.0