NetBSD Problem Report #60061

From www@netbsd.org  Sat Mar  7 15:38:48 2026
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "R12" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id DC9DF1A923C
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  7 Mar 2026 15:38:48 +0000 (UTC)
Message-Id: <20260307153847.AE5961A923D@mollari.NetBSD.org>
Date: Sat,  7 Mar 2026 15:38:47 +0000 (UTC)
From: dettus@dettus.net
Reply-To: dettus@dettus.net
To: gnats-bugs@NetBSD.org
Subject: Endianness in /usr/lib/crt0.o
X-Send-Pr-Version: www-1.0
X-From4GNATS: "dettus@dettus.net via gnats" <gnats-admin@NetBSD.org>

>Number:         60061
>Category:       port-alpha
>Synopsis:       Endianness in /usr/lib/crt0.o
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-alpha-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 07 15:40:00 +0000 2026
>Closed-Date:    Sun Mar 08 15:55:56 +0000 2026
>Last-Modified:  Sun Mar 08 15:55:56 +0000 2026
>Originator:     Thomas Dettbarn
>Release:        8.0
>Organization:
>Environment:
NetBSD herdplatte.deep.space 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/alpha/compile/GENERIC alpha

>Description:
This might seem like an odd bug report, but...
I took the liberty of installing NetBSD 8.0 on my DEC Alpha. 
Just for fun.
And also, just for fun, I decided to disassemble /usr/lib/crt0.o

Here is the result:

$ objdump -d /usr/lib/crt0.o 

/usr/lib/crt0.o:     file format elf64-alpha


Disassembly of section .text:

0000000000000000 <__start>:
   0:   00 00 bb 27     ldah    gp,0(t12)
   4:   00 00 bd 23     lda     gp,0(gp)
   8:   10 04 f1 47     mov     a1,a0
   c:   11 04 f2 47     mov     a2,a1
  10:   12 04 f3 47     mov     a3,a2
  14:   00 00 7d a7     ldq     t12,0(gp)
  18:   00 40 5b 6b     jsr     ra,(t12),1c <__start+0x1c>
  1c:   00 00 ba 27     ldah    gp,0(ra)
  20:   00 00 bd 23     lda     gp,0(gp)
  24:   47 ff 04 1f     .long 0x1f04ff47
  28:   47 ff 04 1f     .long 0x1f04ff47
  2c:   47 ff 04 1f     .long 0x1f04ff47

0000000000000030 <___start>:
  30:   00 00 bb 27     ldah    gp,0(t12)
...

 250:   1f 04 ff 47     nop  



OBVIOUSLY, the instructions at 24, 28, 2c seem to have an endianess Problem. They should read NOP, = 1f 04 ff 47, but they are the other way around.

This code is probably never being called, 
maybe somebody had some fun, 
it is NOT NECESSARY TO FIX IT, 
but it is definitely worth mentioning. And maybe something for the history books. :) 


>How-To-Repeat:
Not a problem, just some oddity!
>Fix:
With a hex editor. 

>Release-Note:

>Audit-Trail:
From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-alpha/60061: Endianness in /usr/lib/crt0.o
Date: Sun, 8 Mar 2026 10:42:12 -0500

 This is no longer weird in -current:

 # uname -pr;cat foo.s; as foo.s; objdump -d a.out |tail -n 5;objdump -d /usr/lib/crt0.o|grep .long
 11.99.5 alpha
 .long 0xfeedface
 .long 0xdeadbeef
 .align 4
 0000000000000000 <.text>:
    0:   ce fa ed fe     bgt     t9,0x37eb3c
    4:   ef be ad de     fbgt    $f21,0x36fbc4
    8:   1f 04 ff 47     nop
    c:   00 00 fe 2f     unop
 # 

State-Changed-From-To: open->closed
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Sun, 08 Mar 2026 15:55:56 +0000
State-Changed-Why:
No longer a problem in -current
.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.