Subject: Re: port-powerpc/25941: build problem with 1.6.2-STABLE
To: None <carton@ivy.net>
From: Nick Hudson <skrll@netbsd.org>
List: netbsd-bugs
Date: 06/17/2004 10:20:43
--Boundary-00=_rJW0ANnxCXCKKJz
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Wednesday 16 June 2004 06:37, carton@ivy.net wrote:
> >Number:         25941

PPC gas got changed shortly after 1.6 was branched to understand %r prefixes. 
Please test the attached patch.

Thanks,
Nick

--Boundary-00=_rJW0ANnxCXCKKJz
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="ppc.ld.elf_so.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="ppc.ld.elf_so.diff"

Index: libexec/ld.elf_so/arch/powerpc/rtld_start.S
===================================================================
RCS file: /cvsroot/src/libexec/ld.elf_so/arch/powerpc/rtld_start.S,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 rtld_start.S
--- libexec/ld.elf_so/arch/powerpc/rtld_start.S	28 May 2004 08:31:22 -0000	1.4.2.1
+++ libexec/ld.elf_so/arch/powerpc/rtld_start.S	17 Jun 2004 09:18:49 -0000
@@ -36,45 +36,45 @@
 	.text
 
 _rtld_start:
-	stwu	%r1,-48(%r1)
-	stw	%r3,12(%r1)		# argc
-	stw	%r4,16(%r1)		# argv
-	stw	%r5,20(%r1)		# envp
-/*	stw	%r6,24(%r1)		# obj		(always 0) */
-/*	stw	%r7,28(%r1)		# cleanup	(always 0) */
-	stw	%r8,32(%r1)		# ps_strings
+	stwu	1,-48(1)
+	stw	3,12(1)			# argc
+	stw	4,16(1)			# argv
+	stw	5,20(1)			# envp
+/*	stw	6,24(1)			# obj		(always 0) */
+/*	stw	7,28(1)			# cleanup	(always 0) */
+	stw	8,32(1)			# ps_strings
 
 	bl	_GLOBAL_OFFSET_TABLE_-4@local
-	mflr	%r31			# r31 = (real) GOT
-	lwz	%r28,0(%r31)		# base-relative &_DYNAMIC
+	mflr	31			# r31 = (real) GOT
+	lwz	28,0(31)		# base-relative &_DYNAMIC
 
 	bl	0f			# lr = next instruction
 	b	_DYNAMIC@local
-0:	mflr	%r30
-	lwz	%r29,0(%r30)		# load instruction contents
-	rlwinm	%r29,%r29,0,6,29	# extract PC offset
-	add	%r3,%r29,%r30		# r3 = &_DYNAMIC
-	sub	%r28,%r3,%r28
-	mr	%r4,%r28		# r4 = relocbase
+0:	mflr	30
+	lwz	29,0(30)		# load instruction contents
+	rlwinm	29,29,0,6,29		# extract PC offset
+	add	3,29,30			# r3 = &_DYNAMIC
+	sub	28,3,28
+	mr	4,28			# r4 = relocbase
 	bl	_rtld_relocate_nonplt_self@plt
 
-	lwz	%r3,16(%r1)
-	addi	%r3,%r3,-12		# sp = &argv[-3]	/* XXX */
-	mr	%r4,%r28		# r4 = relocbase
+	lwz	3,16(1)
+	addi	3,3,-12			# sp = &argv[-3]	/* XXX */
+	mr	4,28			# r4 = relocbase
 	bl	_rtld@plt		# _start = _rtld(sp, relocbase)
-	mtlr	%r3
+	mtlr	3
 
-	lwz	%r3,12(%r1)		# argc
-	lwz	%r4,16(%r1)		# argv
-	lwz	%r5,20(%r1)		# envp
-	lwz	%r6,-8(%r4)		# obj = sp[1] (== argv[-2])
-	lwz	%r7,-12(%r4)		# cleanup = sp[0] (== argv[-3])
-	lwz	%r8,32(%r1)		# ps_strings
+	lwz	3,12(1)			# argc
+	lwz	4,16(1)			# argv
+	lwz	5,20(1)			# envp
+	lwz	6,-8(4)			# obj = sp[1] (== argv[-2])
+	lwz	7,-12(4)		# cleanup = sp[0] (== argv[-3])
+	lwz	8,32(1)			# ps_strings
 
-	addi	%r1,%r1,48
+	addi	1,1,48
 	blrl		# _start(argc, argv, envp, obj, cleanup, ps_strings)
 
-	li	%r0,1			# _exit()
+	li	0,1			# _exit()
 	sc
 
 
@@ -82,44 +82,44 @@
 	.globl	_rtld_bind
 
 _rtld_bind_start:
-	stwu	%r1,-160(%r1)
+	stwu	1,-160(1)
 
-	stw	%r0,20(%r1)
-	mflr	%r0
-	stw	%r0,16(%r1)		# save lr
-	mfcr	%r0
-	stw	%r0,12(%r1)		# save cr
-	stmw	%r3,24(%r1)		# save r3-r31
+	stw	0,20(1)
+	mflr	0
+	stw	0,16(1)			# save lr
+	mfcr	0
+	stw	0,12(1)			# save cr
+	stmw	3,24(1)			# save r3-r31
 
-	mr	%r3,%r12		# obj
-	mr	%r4,%r11		# reloff
+	mr	3,12			# obj
+	mr	4,11			# reloff
 	bl	_rtld_bind@plt		# _rtld_bind(obj, reloff)
-	mtctr	%r3
+	mtctr	3
 
-	lmw	%r3,24(%r1)		# load r3-r31
-	lwz	%r0,12(%r1)		# restore cr
-	mtcr	%r0
-	lwz	%r0,16(%r1)		# restore lr
-	mtlr	%r0
-	lwz	%r0,20(%r1)
+	lmw	3,24(1)			# load r3-r31
+	lwz	0,12(1)			# restore cr
+	mtcr	0
+	lwz	0,16(1)			# restore lr
+	mtlr	0
+	lwz	0,20(1)
 
-	addi	%r1,%r1,160
+	addi	1,1,160
 	bctr
 
 	.globl	_rtld_powerpc_pltcall
 	.globl	_rtld_powerpc_pltresolve
 
 _rtld_powerpc_pltcall:
-	slwi	%r11,%r11,2
-	addis	%r11,%r11,0		# addis	11,11,jmptab@ha
-	lwz	%r11,0(%r11)		# lwz	11,jmptab@l(11)
-	mtctr	%r11
+	slwi	11,11,2
+	addis	11,11,0			# addis	11,11,jmptab@ha
+	lwz	11,0(11)		# lwz	11,jmptab@l(11)
+	mtctr	11
 	bctr
 
 _rtld_powerpc_pltresolve:
-	lis	%r12,0			# lis	12,_rtld_bind_start@ha
-	addi	%r12,%r12,0		# addi	12,12,_rtld_bind_start@l
-	mtctr	%r12
-	lis	%r12,0			# lis	12,obj@ha
-	addi	%r12,%r12,0		# addi	12,12,obj@l
+	lis	12,0			# lis	12,_rtld_bind_start@ha
+	addi	12,12,0		# addi	12,12,_rtld_bind_start@l
+	mtctr	12
+	lis	12,0			# lis	12,obj@ha
+	addi	12,12,0		# addi	12,12,obj@l
 	bctr

--Boundary-00=_rJW0ANnxCXCKKJz--