NetBSD Problem Report #57627

From www@netbsd.org  Sun Sep 24 14:30:12 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CF1DF1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 24 Sep 2023 14:30:12 +0000 (UTC)
Message-Id: <20230924142652.956031A9239@mollari.NetBSD.org>
Date: Sun, 24 Sep 2023 14:26:52 +0000 (UTC)
From: vezhlys@gmail.com
Reply-To: vezhlys@gmail.com
To: gnats-bugs@NetBSD.org
Subject: mmeye locore.S assembler code fails to build when ROMIMAGE is defined
X-Send-Pr-Version: www-1.0

>Number:         57627
>Category:       port-mmeye
>Synopsis:       mmeye locore.S assembler code fails to build when ROMIMAGE is defined
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    andvar
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 24 14:35:00 +0000 2023
>Closed-Date:    Sun Sep 24 20:20:58 +0000 2023
>Last-Modified:  Sun Sep 24 20:20:58 +0000 2023
>Originator:     Andrius V
>Release:        10.99.9
>Organization:
>Environment:
NetBSD 10.0_BETA amd64 x86_64
>Description:
mmeye has a MMTAROMNEW kernel config with ROMIMAGE option enabled by default. This option has specific code defined in mmeye/locore.S file, however, currently it fails to build with the errors below:

--- locore.o ---
/home/andriusv/netbsd-src-cvs/src/sys/arch/mmeye/mmeye/locore.S: Assembler messages:
/home/andriusv/netbsd-src-cvs/src/sys/arch/mmeye/mmeye/locore.S:122: Error: pcrel too far
/home/andriusv/netbsd-src-cvs/src/sys/arch/mmeye/mmeye/locore.S:143: Error: pcrel too far

Both failing lines are virtually the same:
mov.l	_C_LABEL(ram_start), r4

I looked around and evbsh3 locore.S has very similar code under the same option. In fact, applying the difference actually makes the code build (see patch below). However, I have quite poor understanding what the code does and if the changes would not change the functionality. Thus, I need some SH4 assembly guru to take a look.

Regards,
Andrius V
>How-To-Repeat:
Try to build mmeye MMTAROMNEW rev 1.57 kernel, observe build failures.
>Fix:
--- sys/arch/mmeye/mmeye/locore.S	2023-09-24 16:48:07.364356199 +0300
+++ sys/arch/mmeye/mmeye/locore.S.updated	2023-09-24 16:47:59.696094820 +0300
@@ -119,7 +119,8 @@ start1:
 #ifdef ROMIMAGE
 	/* Initialize BUS State Control Regs. */
 	mov.l	_ROM_START, r3
-	mov.l	_C_LABEL(ram_start), r4
+	mov.l	XL_ram_start, r4
+	mov.l	@r4, r4
 	sub	r3, r4
 	/* Set Bus State Controller */
 	mov.l	XLInitializeBsc, r0
@@ -140,7 +141,8 @@ start1:
 	add	r3, r1		/* src address */
 	mov.l	___start, r3
 	sub	r2, r3
-	mov.l	_C_LABEL(ram_start), r4
+	mov.l	XL_ram_start, r4
+	mov.l	@r4, r4
 	add	r4, r3		/* dest address */
 1:
 	mov.l	@r1+, r4
@@ -157,6 +159,8 @@ start1:
 	.align	2
 LXstart_in_RAM:
 	.long	start_in_RAM
+XL_ram_start:
+	.long	_C_LABEL(ram_start)
 #else /* ROMIMAGE */
 	/* Set Bus State Controller */
 	mov.l	XLInitializeBsc, r0

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-mmeye-maintainer->andvar
Responsible-Changed-By: andvar@NetBSD.org
Responsible-Changed-When: Sun, 24 Sep 2023 19:24:35 +0000
Responsible-Changed-Why:
will apply the patch.

From: "Andrius Varanavicius" <andvar@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57627 CVS commit: src/sys/arch/mmeye/mmeye
Date: Sun, 24 Sep 2023 19:57:10 +0000

 Module Name:	src
 Committed By:	andvar
 Date:		Sun Sep 24 19:57:10 UTC 2023

 Modified Files:
 	src/sys/arch/mmeye/mmeye: locore.S

 Log Message:
 unify ROMIMAGE specific assembler code between evbsh3 and mmeye.

 fixes mmeye ROMIMAGE enabled build and in turn MMTAROMNEW kernel config.
 patch checked by martin. PR port-mmeye/57627.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mmeye/mmeye/locore.S

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: andvar@NetBSD.org
State-Changed-When: Sun, 24 Sep 2023 20:20:58 +0000
State-Changed-Why:
patch applied.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.