This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SH gas: support `.long foo@PLT' again


On Feb  6, 2002, Hans-Peter Nilsson <hp@bitrange.com> wrote:

>> M-m a    ; same as  M-x mml-attach-file RET

> You mean M-x mml-inline-file, right? :-)

I wish!  There's no such function, so I end up having to adjust the
disposition afterwards, which sucks because I often forget to do so
:-(

>> * gas/sh/pic.d, gas/sh/pic.s: New test.
>> * gas/sh/basic.exp: Run it.

> Ok, but fix:

>> +Disassembly of section .text:

> Escape "." (not critical) and other regex metachars (might be
> critical).

Please pretend I didn't post that other patch.  I had fired a build to
verify that the tests were correct, got back to the other task I was
working on, then remembered I hadn't posted the testsuite patch and
did it, before verifying that the tests had succeeded.  Obviously,
they didn't.  Too bad I have to be working on multiple issues at the
same time :-(

> Don't you have to escape "()" here?

Yup.  Here's a patch that has actually been tested and, since you'd
approved it except for the quoting that I put in, I'm checking it in
before I make further mistakes :-)

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 06:14:46
@@ -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 22:14:46 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 22:14:46 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]