NetBSD Problem Report #52857

From www@NetBSD.org  Sun Dec 24 02:17:26 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 BF0C97A103
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 24 Dec 2017 02:17:26 +0000 (UTC)
Message-Id: <20171224021720.605287A178@mollari.NetBSD.org>
Date: Sun, 24 Dec 2017 02:17:20 +0000 (UTC)
From: coypu@sdf.org
Reply-To: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Subject: cannot run dynamically linked mips n64 binaries
X-Send-Pr-Version: www-1.0

>Number:         52857
>Category:       toolchain
>Synopsis:       cannot run dynamically linked mips n64 binaries
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 24 02:20:00 +0000 2017
>Closed-Date:    Sat Mar 06 21:28:35 +0000 2021
>Last-Modified:  Sat Mar 06 21:28:35 +0000 2021
>Originator:     coypu
>Release:        NetBSD  8.99.9 NetBSD 8.99.9 (ERLITE) #1: Sat Dec 23 01:25:04 IST 2017  fly@localhost:/home/fly/mipseb/sys/arch/evbmips/compile/ERLITE evbmips
>Organization:
>Environment:
NetBSD 8.99.9
>Description:
# cat test.c
int main() { return 0; }
# gcc -mabi=64 test.c
# ./a.out
pid 6581(sh): ABI set to N64 (e_flags=0x20000007)
sp = 0xffffff78b0, argc = 1, argv = 0xffffff78c8 <./a.out> relocbase 0xfff86c0000
got is at 0xfff86e7860, dynamic is at 0xfff86c0cf8
env[0] = 0xffffff7e38 ENV=/root/.shrc
env[1] = 0xffffff7e48 BLOCKSIZE=1k
env[2] = 0xffffff7e55 PWD=/root
env[3] = 0xffffff7e5f HOME=/root
env[4] = 0xffffff7e6a PATH=/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/pkg/bin:/home/fly/bin:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/
env[5] = 0xffffff7f8b HOST=
env[6] = 0xffffff7f91 TERM=vt100
env[7] = 0xffffff7f9c OLDPWD=/usr/tests/libexec
env[8] = 0xffffff7fb6 USER=root
env[9] = 0xffffff7fc0 LOGNAME=root
env[10] = 0xffffff7fcd SHELL=/bin/sh
headers: digesting PT_DYNAMIC at 0xfff86c0cf8
  d_tag 16 at 0xfff86c0cf8
  d_tag 4 at 0xfff86c0d08
  d_tag 5 at 0xfff86c0d18
  d_tag 6 at 0xfff86c0d28
  d_tag 10 at 0xfff86c0d38
  d_tag 11 at 0xfff86c0d48
  d_tag 3 at 0xfff86c0d58
  d_tag 17 at 0xfff86c0d68
  d_tag 18 at 0xfff86c0d78
  d_tag 19 at 0xfff86c0d88
  d_tag 1879048193 at 0xfff86c0d98
  d_tag 1879048197 at 0xfff86c0da8
  d_tag 1879048198 at 0xfff86c0db8
  d_tag 1879048202 at 0xfff86c0dc8
  d_tag 1879048209 at 0xfff86c0dd8
  d_tag 1879048210 at 0xfff86c0de8
  d_tag 1879048211 at 0xfff86c0df8
 added path "/usr/lib"
 added path "/usr/lib/64"
/usr/lib/64/libc.so.12: Unsupported relocation type 4611 in non-PLT relocations
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/52857: cannot run dynamically linked mips n64 binaries
Date: Sun, 24 Dec 2017 04:05:39 +0000

 comparing to freebsd which does run n64 i see something about a second
 plt got, which led me to this:
 https://dmz-portal.mips.com/wiki/MIPS_Multi_GOT

 (I assume it can be >2 too...)

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 05 Mar 2018 16:45:34 +0000
State-Changed-Why:
Christos did a thing to fix this specific error. I don't remember if the result worked,
but the information in the bug report is not useful any more.


State-Changed-From-To: closed->open
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Mon, 05 Mar 2018 19:05:05 +0000
State-Changed-Why:
this is still a problem.  yes, some more stuff works than used
to, but anything interesting still crashes so the problem exists.

eg:

Core was generated by `irc'.
Program terminated with signal SIGBUS, Bus error.
#0  0x000000fff86d9014 in xvsnprintf () from /usr/libexec/ld.elf_so
(gdb) bt
#0  0x000000fff86d9014 in xvsnprintf () from /usr/libexec/ld.elf_so
#1  0x0000000000000344 in ?? ()
Backtrace stopped: frame did not save the PC


From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/52857: cannot run dynamically linked mips n64 binaries 
Date: Thu, 04 Feb 2021 20:22:22 +1100

 i noticed that you can trigger this problem quite simply:

 transitions ~> cat hello.c
 #include <stdio.h>
 int main() {
         printf("hello world\n");
         return 0;
 }
 transitions ~> cc -mabi=64 hello.c
 transitions ~> ./a.out
 hello world
 transitions ~> cc -mabi=64 hello.c -lcrypto
 transitions ~> ./a.out
 Segmentation fault (core dumped)

 it does not happen with -ltermcap.

 i don't have any more info or idea what is wrong here, but
 the above seems like a useful data point for this PR.


 .mrg.

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 coypu@sdf.org
Subject: Re: toolchain/52857: cannot run dynamically linked mips n64 binaries 
Date: Sat, 6 Mar 2021 15:13:28 -0500

 --Apple-Mail=_5CC11C2B-3302-45AA-8B49-035F46AEAC1A
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 Fixed in mips_reloc.c:1.74

 christos


 --Apple-Mail=_5CC11C2B-3302-45AA-8B49-035F46AEAC1A
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename=signature.asc
 Content-Type: application/pgp-signature;
 	name=signature.asc
 Content-Description: Message signed with OpenPGP

 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - http://gpgtools.org

 iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCYEPiaAAKCRBxESqxbLM7
 OplYAKDg3t0ClEVHiAtebUUPUIfRAsI7UQCgj5p2xXUFWX5aCAVW5uYIsRPWSg0=
 =Nu4Y
 -----END PGP SIGNATURE-----

 --Apple-Mail=_5CC11C2B-3302-45AA-8B49-035F46AEAC1A--

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 06 Mar 2021 21:28:35 +0000
State-Changed-Why:
fixed by christos.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.