This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: SH gas: support `.long foo@PLT' again
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: 06 Feb 2002 03:33:27 -0200
- Subject: Re: SH gas: support `.long foo@PLT' again
- Organization: GCC Team, Red Hat
- References: <Pine.BSF.4.30.0202052342510.96898-100000@dair.pair.com>
On Feb 6, 2002, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> On 6 Feb 2002, Alexandre Oliva wrote:
>> A patch I installed last week broke `.long symbol@PLT', for assuming
>> that a PLT fix would always contain a non-NULL subsy, as is the case
>> for all GCC-generated PLT references. However, hand-written assembly
>> code in glibc didn't follow this pattern, and exposed the bug I
>> introduced. Here's a fix. Ok to install?
> Yes, but please also add a gas test-case. I suggest following
> the pattern of dsp.[sd].
Thanks, here is the patch that adds the tests:
M-m a ; same as M-x mml-attach-file RET
erhm...
C-g C-x i ...
:-)
Ok to install?
Index: gas/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* gas/sh/pic.d, gas/sh/pic.s: New test.
* gas/sh/basic.exp: Run it.
Index: gas/testsuite/gas/sh/basic.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/sh/basic.exp,v
retrieving revision 1.4
diff -u -p -r1.4 basic.exp
--- gas/testsuite/gas/sh/basic.exp 2002/02/04 12:29:32 1.4
+++ gas/testsuite/gas/sh/basic.exp 2002/02/06 05:27:58
@@ -91,5 +91,7 @@ if [istarget sh*-*-*] then {
# Test DSP instructions
run_dump_test "dsp"
+ run_dump_test "pic"
+
run_dump_test "pcrel"
}
Index: gas/testsuite/gas/sh/pic.d
===================================================================
RCS file: pic.d
diff -N pic.d
--- /dev/null Tue May 5 13:32:27 1998
+++ gas/testsuite/gas/sh/pic.d Tue Feb 5 21:27:58 2002
@@ -0,0 +1,40 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: SH PIC constructs
+# Test SH PIC constructs:
+
+.*: file format elf.*sh.*
+
+Disassembly of section .text:
+0x00000000 c7 0a mova 0x0000002c,r0
+0x00000002 dc 0a mov.l 0x0000002c,r12 ! 0x0
+0x00000004 3c 0c add r0,r12
+0x00000006 d0 0a mov.l 0x00000030,r0 ! 0x0
+0x00000008 00 ce mov.l @(r0,r12),r0
+0x0000000a 40 0b jsr @r0
+0x0000000c 00 09 nop
+0x0000000e d0 09 mov.l 0x00000034,r0 ! 0x0
+0x00000010 30 cc add r12,r0
+0x00000012 40 0b jsr @r0
+0x00000014 00 09 nop
+0x00000016 d1 08 mov.l 0x00000038,r1 ! 0x0
+0x00000018 c7 07 mova 0x00000038,r0
+0x0000001a 30 1c add r1,r0
+0x0000001c 40 0b jsr @r0
+0x0000001e 00 09 nop
+0x00000020 d0 06 mov.l 0x0000003c,r0 ! 0x16
+0x00000022 40 0b jsr @r0
+0x00000024 00 09 nop
+0x00000026 d0 06 mov.l 0x00000040,r0 ! 0x14
+0x00000028 40 0b jsr @r0
+0x0000002a 00 09 nop
+ ...
+ 2c: R_SH_DIR32 GLOBAL_OFFSET_TABLE
+ 30: R_SH_GOT32 foo
+ 34: R_SH_GOTOFF foo
+ 38: R_SH_PLT32 foo
+0x0000003c 00 00 .word 0x0000
+ 3c: R_SH_PLT32 foo
+0x0000003e 00 16 mov.l r1,@(r0,r0)
+0x00000040 00 00 .word 0x0000
+ 40: R_SH_PLT32 foo
+0x00000042 00 14 mov.b r1,@(r0,r0)
Index: gas/testsuite/gas/sh/pic.s
===================================================================
RCS file: pic.s
diff -N pic.s
--- /dev/null Tue May 5 13:32:27 1998
+++ gas/testsuite/gas/sh/pic.s Tue Feb 5 21:27:58 2002
@@ -0,0 +1,41 @@
+ .text
+ .align
+
+ mova .Lgot, r0
+ mov.l .Lgot, r12
+ add r0, r12
+ mov.l .Lfoogot, r0
+ mov.l @(r0,r12), r0
+ jsr @r0
+ nop
+ mov.l .Lfoogotoff, r0
+ add r12, r0
+ jsr @r0
+ nop
+ mov.l .Lfooplt, r1
+ mova .Lfooplt, r0
+ add r1, r0
+ jsr @r0
+ nop
+ mov.l .Lfooplt_old, r0
+ jsr @r0
+.LPLTcall_old:
+ nop
+ mov.l .Lfooplt_new, r0
+ jsr @r0
+.LPLTcall_new:
+ nop
+
+ .p2align 2
+.Lgot:
+ .long GLOBAL_OFFSET_TABLE
+.Lfoogot:
+ .long foo@GOT
+.Lfoogotoff:
+ .long foo@GOTOFF
+.Lfooplt:
+ .long foo@PLT
+.Lfooplt_old:
+ .long foo@PLT + . - (.LPLTcall_old + 2)
+.Lfooplt_new:
+ .long foo@PLT - (.LPLTcall_new + 2 - .)
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer