NetBSD Problem Report #57245

From www@netbsd.org  Sun Feb 26 14:19:26 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 9F6081A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 26 Feb 2023 14:19:26 +0000 (UTC)
Message-Id: <20230226141924.B31AC1A923B@mollari.NetBSD.org>
Date: Sun, 26 Feb 2023 14:19:24 +0000 (UTC)
From: jbglaw@lug-owl.de
Reply-To: jbglaw@lug-owl.de
To: gnats-bugs@NetBSD.org
Subject: (Most?) MIPS Ports: Error: symbol type "gnu_indirect_function" is not supported by MIPS targets
X-Send-Pr-Version: www-1.0

>Number:         57245
>Category:       port-pmax
>Synopsis:       (Most?) MIPS Ports: Error: symbol type "gnu_indirect_function" is not supported by MIPS targets
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-pmax-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 26 14:20:00 +0000 2023
>Closed-Date:    Sun May 28 21:16:31 +0000 2023
>Last-Modified:  Sun May 28 21:16:31 +0000 2023
>Originator:     Jan-Benedict Glaw
>Release:        Last tested on HEAD (commit 840287686d07191aeb8db5ff71daa795559d05c9 as of Sat Feb 25 13:57:37 2023 +0000), but since a few days/weeks
>Organization:
>Environment:
Linux lili 5.16.0-4-amd64 #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08) x86_64 GNU/Linux
>Description:
I'm doing a lot of Free Software test builds (http://toolchain.lug-owl.de/) and recently, all?/most? MIPS builds for NetBSD (cross-builds from Linux and builds from within a amd64 NetBSD system) fail:

./build.sh -P -U -m pmax -a mipsel -E -D /var/lib/laminar/run/netbsd-pmax-mipsel/6/dest-pmax-mipsel -R /var/lib/laminar/run/netbsd-pmax-mipsel/6/release-pmax-mipsel tools

./build.sh -P -U -u -m pmax -a mipsel -E -D /var/lib/laminar/run/netbsd-pmax-mipsel/6/dest-pmax-mipsel -R /var/lib/laminar/run/netbsd-pmax-mipsel/6/release-pmax-mipsel release
[...]
[bld rls 2023-02-08 13:33:26] dependall ===> tests/libexec/ld.elf_so/helper_ifunc_dso
[bld rls 2023-02-08 13:33:26] #    create  helper_ifunc_dso/h_helper_ifunc.d
[bld rls 2023-02-08 13:33:26] CC=/var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/obj/tooldir.Linux-5.16.0-4-amd64-x86_64/bin/mipsel--netbsd-gcc /va
r/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/obj/tooldir.Linux-5.16.0-4-amd64-x86_64/bin/nbmkdep -f h_helper_ifunc.d.tmp  --   -std=gnu99 -Wall -Ws
trict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wsystem-headers -Wno-traditional -Wa,--fatal-warnings -Wreturn-type -Wswitch -W
shadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Wsign-compare -Wformat=2 -Wno-format-zero-length -Werror -Wno-missin
g-noreturn  --sysroot=/var/lib/laminar/run/netbsd-pmax-mipsel/6/dest-pmax-mipsel -I/var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/tests/libexec/ld
.elf_so/helper_ifunc_dso/../../.. -Wp,-fno-canonical-system-headers     /var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/tests/libexec/ld.elf_so/hel
per_ifunc_dso/h_helper_ifunc.c &&  mv -f h_helper_ifunc.d.tmp h_helper_ifunc.d
[bld rls 2023-02-08 13:33:27] #    create  helper_ifunc_dso/.depend
[bld rls 2023-02-08 13:33:27] rm -f .depend
[bld rls 2023-02-08 13:33:27] CC=/var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/obj/tooldir.Linux-5.16.0-4-amd64-x86_64/bin/mipsel--netbsd-gcc /va
r/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/obj/tooldir.Linux-5.16.0-4-amd64-x86_64/bin/nbmkdep -s .o\ .po\ .pico\ .go\ .ln\ .d -d -f .depend h_he
lper_ifunc.d
[bld rls 2023-02-08 13:33:27] #   compile  helper_ifunc_dso/h_helper_ifunc.pico
[bld rls 2023-02-08 13:33:27] /var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/obj/tooldir.Linux-5.16.0-4-amd64-x86_64/bin/mipsel--netbsd-gcc -O2 -f
debug-prefix-map=\$DESTDIR= -fdebug-prefix-map=\$NETBSDSRCDIR=/usr/src -fdebug-prefix-map=\$X11SRCDIR=/usr/xsrc -fdebug-regex-map='/usr/src/(.*)/obj$=/u
sr/obj/\1' -fdebug-regex-map='/usr/src/(.*)/obj/(.*)=/usr/obj/\1/\2' -fdebug-regex-map='/usr/src/(.*)/obj\..*=/usr/obj/\1' -fdebug-regex-map='/usr/src/(
.*)/obj\..*/(.*)=/usr/obj/\1/\2'   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -W
no-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Wsig
n-compare -Wformat=2  -Wno-format-zero-length  -Werror -Wno-missing-noreturn   -fPIE    --sysroot=/var/lib/laminar/run/netbsd-pmax-mipsel/6/dest-pmax-mi
psel -I/var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/tests/libexec/ld.elf_so/helper_ifunc_dso/../../.. -Wp,-iremap,/var/lib/laminar/run/netbsd-pm
ax-mipsel/6/dest-pmax-mipsel: -Wp,-fno-canonical-system-headers -Wp,-iremap,/var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src:/usr/src -Wp,-iremap,/u
sr/xsrc:/usr/xsrc  -c    -fPIC   /var/lib/laminar/run/netbsd-pmax-mipsel/6/NetBSD-src/tests/libexec/ld.elf_so/helper_ifunc_dso/h_helper_ifunc.c -o h_hel
per_ifunc.pico
[bld rls 2023-02-08 13:33:27] /tmp/ccYF10VN.s: Assembler messages:
[bld rls 2023-02-08 13:33:27] /tmp/ccYF10VN.s:11: Error: symbol type "gnu_indirect_function" is not supported by MIPS targets
[bld rls 2023-02-08 13:33:27] /tmp/ccYF10VN.s:15: Error: symbol type "gnu_indirect_function" is not supported by MIPS targets
[bld rls 2023-02-08 13:33:27] 
[bld rls 2023-02-08 13:33:27] *** Failed target:  h_helper_ifunc.pico

>How-To-Repeat:
Use any recent HEAD commit (I'm fetching via GIT, should work equally via CVS of course) and build on a NetBSD or Linux box as outlined above.

PMAX is only one of many here. These all fail with similar diagnostics:

algor-mips64el
algor-mipsel
arc-mipsel
cobalt-mipsel
emips-mipseb
evbmips-mipseb
evbmips-mipsel
ews4800mips-mipseb
hpcmips-mipsel
mipsco-mipseb
newsmips-mipseb
playstation2-mipsel
pmax-mipsel
sbmips-mipseb
sbmips-mipsel
sgimips-mipseb

Other compiler issues:

arc-mips64el      ("Fatal error: selected target format 'elf32-ntradlittlemips' unknown" while building libc's CSU code)
cobalt-mips64el   (ditto)
evbmips-mips64el  (ditto)
pmax-mips64el     (ditto)
sbmips-mips64el   (ditto)

evbmips-mipsn64eb ("Fatal error: selected target format 'elf32-ntradbigmips' unknown" while building libc's CSU code)
evbmips-mips64eb  (ditto)
sbmips-mips64eb   (ditto)
sgimips-mips64eb  (ditto)

evbmips-mipsn64el ("error: unknown type name 'bool'")
>Fix:
If it helps, I'd try to bisect between last-known-working and first-broken, but I guess it was a Binutils import and some configury option went missing (or needs to be supplied right now.)

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-pmax/57245: (Most?) MIPS Ports: Error: symbol type
 "gnu_indirect_function" is not supported by MIPS targets
Date: Sun, 26 Feb 2023 17:20:37 +0100

 You need to investigate a bit more where the local build issue comes
 from, as the pmax build works fine on our build cluster:

 	https://releng.netbsd.org/cgi-bin/builds.cgi

 Possible issues: the tooldir version of gas is configured differently
 when building on linux? You have something in mk.conf that causes the
 build failure?

 Martin

From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-pmax/57245: (Most?) MIPS Ports: Error: symbol type
 "gnu_indirect_function" is not supported by MIPS targets
Date: Sun, 26 Feb 2023 20:26:36 +0100

 On Sun, 2023-02-26 16:25:02 +0000, Martin Husemann <martin@duskware.de> wro=
 te:
 >  You need to investigate a bit more where the local build issue comes
 >  from, as the pmax build works fine on our build cluster:
 > =20
 >  	https://releng.netbsd.org/cgi-bin/builds.cgi
 > =20
 >  Possible issues: the tooldir version of gas is configured differently
 >  when building on linux? You have something in mk.conf that causes the
 >  build failure?

 I started a bisect run, we'll see where that ends.

 All (Linux-based) builds start off a fresh Debian Docker container,
 with no local mk.conf changes. (The amd64 NetBSD based builds are
 running in Qemu with likewise fresh base images for every build.)

 So let's see what changes; in theory, it could also be caused by some
 update in the versions within the Docker container.

 (As I do the within-NetBSD builds less often compared to the
 Linux-based builds, I'm not sure about their current state, but at
 leaset I'm quite sure the "selected target format
 'elf32-ntradlittlemips' unknown" error came up over there as well.
 Likewise, no mk.conf changes, just a plain GIT checkout, as that's
 fitting better within my whole setup.)

 I'll keep you updated!

 MfG, JBG

 --=20

From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: gnats-bugs@netbsd.org, Christos Zoulas <christos@zoulas.com>
Cc: port-pmax-maintainer@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: port-pmax/57245: (Most?) MIPS Ports: Error: symbol type
 "gnu_indirect_function" is not supported by MIPS targets
Date: Mon, 27 Feb 2023 00:26:58 +0100

 On Sun, 2023-02-26 16:25:02 +0000, Martin Husemann <martin@duskware.de> wro=
 te:
 >  Possible issues: the tooldir version of gas is configured differently
 >  when building on linux? You have something in mk.conf that causes the
 >  build failure?

 Not yet done with bisecting, but in the remaining range, I suspect
 this commit:

 commit 0d328f22aad77fab31f5e0ca8a976746002f4db0
 Author: christos <christos@NetBSD.org>
 Date:   Wed Jan 25 19:08:41 2023 +0000

     disable no ifuncs no mips error for now.

 diff --git a/external/gpl3/binutils/dist/gas/config/obj-elf.c b/external/gp=
 l3/binutils/dist/gas/config/obj-elf.c
 index e5ab8514de74..d3fe949adeaa 100644
 --- a/external/gpl3/binutils/dist/gas/config/obj-elf.c
 +++ b/external/gpl3/binutils/dist/gas/config/obj-elf.c
 @@ -2395,10 +2395,12 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
           && bed->elf_osabi !=3D ELFOSABI_FREEBSD)
         as_bad (_("symbol type \"%s\" is supported only by GNU "
                   "and FreeBSD targets"), type_name);
 +#ifndef __NetBSD__
        /* MIPS targets do not support IFUNCS.  */
        else if (bed->target_id =3D=3D MIPS_ELF_DATA)
         as_bad (_("symbol type \"%s\" is not supported by "
                      "MIPS targets"), type_name);
 +#endif
        elf_tdata (stdoutput)->has_gnu_osabi |=3D elf_gnu_osabi_ifunc;
        type =3D BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
      }


 That won't fly for cross-compilation. I'll finish bisecting this
 initial issue and then continue with the other MIPS-related issues
 mentioned in this ticket. (I'd probably open a new ticket for those?)

 Thanks,
   Jan-Benedict
 --=20

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-pmax/57245: (Most?) MIPS Ports: Error: symbol type
 "gnu_indirect_function" is not supported by MIPS targets
Date: Fri, 12 May 2023 19:38:23 +0000

 This mail didn't make it to gnats. (You tend to have to change the
 address explicitly to include/be gnats-bugs when replying to yourself,
 I'm afraid.)

    ------

 From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
 To: port-pmax-maintainer@netbsd.org, gnats-admin@netbsd.org,
 	netbsd-bugs@netbsd.org, Christos Zoulas <christos@zoulas.com>
 Subject: Re: port-pmax/57245: (Most?) MIPS Ports: Error: symbol type
 	"gnu_indirect_function" is not supported by MIPS targets
 Date: Mon, 27 Feb 2023 09:39:48 +0100

 Hi!

 On Sun, 2023-02-26 23:30:02 +0000, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
 >  Not yet done with bisecting, but in the remaining range, I suspect
 >  this commit:
 >  
 >  commit 0d328f22aad77fab31f5e0ca8a976746002f4db0
 >  Author: christos <christos@NetBSD.org>
 >  Date:   Wed Jan 25 19:08:41 2023 +0000
 >  
 >      disable no ifuncs no mips error for now.
 >  
 >  diff --git a/external/gpl3/binutils/dist/gas/config/obj-elf.c b/external/gp=
 >  l3/binutils/dist/gas/config/obj-elf.c
 >  index e5ab8514de74..d3fe949adeaa 100644
 >  --- a/external/gpl3/binutils/dist/gas/config/obj-elf.c
 >  +++ b/external/gpl3/binutils/dist/gas/config/obj-elf.c
 >  @@ -2395,10 +2395,12 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
 >            && bed->elf_osabi !=3D ELFOSABI_FREEBSD)
 >          as_bad (_("symbol type \"%s\" is supported only by GNU "
 >                    "and FreeBSD targets"), type_name);
 >  +#ifndef __NetBSD__
 >         /* MIPS targets do not support IFUNCS.  */
 >         else if (bed->target_id =3D=3D MIPS_ELF_DATA)
 >          as_bad (_("symbol type \"%s\" is not supported by "
 >                       "MIPS targets"), type_name);
 >  +#endif
 >         elf_tdata (stdoutput)->has_gnu_osabi |=3D elf_gnu_osabi_ifunc;
 >         type =3D BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
 >       }

 Actually, the above commit is an attempted _fix_, which I guess could
 be a simple '#if 0' in this case. Just ftr, the build broke when
 mipsel was moved to Binutils 2.39 (I guess that's the first release
 doing the IFUNC check?)

 commit 58c565ec20c718b8cd8733f9c60d40935ad741e0
 Author: christos <christos@NetBSD.org>
 Date:   Wed Jan 25 22:36:56 2023 +0000

     add mipsel and m68k to binutils 2.39

 diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
 index c37e8f45f446..e9db8e480a8a 100644
 --- a/share/mk/bsd.own.mk
 +++ b/share/mk/bsd.own.mk
 @@ -1,4 +1,4 @@
 -#      $NetBSD: bsd.own.mk,v 1.1301 2023/01/25 00:16:50 christos Exp $
 +#      $NetBSD: bsd.own.mk,v 1.1302 2023/01/25 22:36:56 christos Exp $

  # This needs to be before bsd.init.mk
  .if defined(BSD_MK_COMPAT_FILE)
 @@ -102,12 +102,14 @@ MKGCCCMDS?=       no
      ${MACHINE_ARCH:Maarch64*} || \
      ${MACHINE_ARCH} == "alpha" || \
      ${MACHINE_ARCH} == "i386" || \
 -    ${MACHINE_CPU} == "hppa" || \
 -    ${MACHINE_CPU} == "powerpc" || \
 -    ${MACHINE_CPU} == "riscv" || \
 +    ${MACHINE_ARCH} == "m68k" || \
 +    ${MACHINE_ARCH} == "mipsel" || \
      ${MACHINE_ARCH:Msparc*} || \
      ${MACHINE_ARCH} == "x86_64" || \
      ${MACHINE_ARCH} == "vax" || \
 +    ${MACHINE_CPU} == "hppa" || \
 +    ${MACHINE_CPU} == "powerpc" || \
 +    ${MACHINE_CPU} == "riscv" || \
      ${MACHINE} == "sun2" 
  HAVE_BINUTILS?=        239
  .else



 So... My suggested fix is to either not have IFUNC symbols and/or just
 '#if 0' the check.

 MfG, JBG

 -- 

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-pmax/57245: (Most?) MIPS Ports: Error: symbol type
 "gnu_indirect_function" is not supported by MIPS targets
Date: Fri, 12 May 2023 19:42:59 +0000

 On Fri, May 12, 2023 at 07:40:02PM +0000, David Holland wrote:
  >  So... My suggested fix is to either not have IFUNC symbols and/or just
  >  '#if 0' the check.

 ISTM that if it works for us the way it is, #if 0 is the way to go...

 -- 
 David A. Holland
 dholland@netbsd.org

From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-pmax/57245
Date: Sun, 28 May 2023 22:59:33 +0200

 --qkyb77v36wghram7
 Content-Type: text/plain; charset=utf-8
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 Hi!

 Checked my build logs: This is working fine these days natively on
 NetBSD (http://toolchain.lug-owl.de/laminar/jobs/nnetbsd-pmax-mipsel)
 as well as a cross-build from Linux
 (http://toolchain.lug-owl.de/laminar/jobs/netbsd-pmax-mipsel).

 Thanks,
   Jan-Benedict

 --=20

 --qkyb77v36wghram7
 Content-Type: application/pgp-signature; name="signature.asc"

 -----BEGIN PGP SIGNATURE-----

 iF0EABECAB0WIQQlDTvPcScNjKREqWEdvV51g5nhuwUCZHPAtQAKCRAdvV51g5nh
 uxz5AJ4rvC3KrWdS7Iz44rIywf1EwGBNVQCeMWqK+l6STYbFNn/D1//dZRgp4fY=
 =hjCl
 -----END PGP SIGNATURE-----

 --qkyb77v36wghram7--

State-Changed-From-To: open->closed
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Sun, 28 May 2023 21:16:31 +0000
State-Changed-Why:
Jan-Benedict confirmed that the problem is now resolved.
Thanks for confirming!


>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.