pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/51400: bootstrap 32 bits in NetBSD amd64



The following reply was made to PR pkg/51400; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: netbsd-bugs%NetBSD.org@localhost
Subject: Re: pkg/51400: bootstrap 32 bits in NetBSD amd64
Date: Mon, 11 Dec 2023 01:04:41 +0000

 This is a multi-part message in MIME format.
 --=_fDlpu8OzeqfFpAJUhARZcts9raUpcXJJ
 
 This happens because the libfetch build tries, via the rules in
 pkgtools/bootstrap-mk-files/files/bsd.lib.mk, to do:
 
 	${LD} -r ${.TARGET}.o -o ${.TARGET}
 
 i.e.:
 
 	ld -r common.o.o -o common.o
 
 Since common.o.o was built with -m32 because of the `--abi 32'
 bootstrap argument, it's an i386 binary.  But the system ld expects to
 be creating an amd64 output.  To make it produce an i386 output, we
 have to additionally specify `-m elf_i386' to ld.
 
 The attached patch does this (and creates the infrastructure to do it
 for other architectures).  Since it's somewhat late in the branch
 cycle, I think I'll hold off on committing it until January.
 
 --=_fDlpu8OzeqfFpAJUhARZcts9raUpcXJJ
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr51400"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr51400.patch"
 
 From 5828dee6b34fa382d8e61294b91bc96c9dec3a0f Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Mon, 11 Dec 2023 00:42:17 +0000
 Subject: [PATCH] mk/platform/NetBSD.mk: Handle i386-on-amd64 builds.
 
 XXX This should be extended to other compat32-on-64bit builds, and
 the wackier variations on that theme one finds in MIPS systems -- may
 require spelunking through the ld emulation schemes in GNU binutils.
 
 PR pkg/51400
 ---
  mk/bsd.prefs.mk       |  5 +++++
  mk/platform/NetBSD.mk | 12 ++++++++++++
  2 files changed, 17 insertions(+)
 
 diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
 index 9b7954ebebca..fbd067b8def7 100644
 --- a/mk/bsd.prefs.mk
 +++ b/mk/bsd.prefs.mk
 @@ -158,6 +158,11 @@ MACHINE_GNU_ARCH?=3D		${GNU_ARCH.${MACHINE_ARCH}:U${MA=
 CHINE_ARCH}}
  .if ${NATIVE_OPSYS} =3D=3D "NetBSD"
  NATIVE_LOWER_OPSYS?=3D	netbsd
 =20
 +.  if !defined(HOST_MACHINE_ARCH)
 +HOST_MACHINE_ARCH!=3D	${UNAME} -m
 +MAKEFLAGS+=3D		HOST_MACHINE_ARCH=3D${HOST_MACHINE_ARCH:Q}
 +.  endif
 +
  .elif ${NATIVE_OPSYS} =3D=3D "AIX"
  .  if exists(/usr/bin/oslevel)
  _NATIVE_OS_VERSION!=3D	/usr/bin/oslevel
 diff --git a/mk/platform/NetBSD.mk b/mk/platform/NetBSD.mk
 index 5c40361b16bb..8484fa18708a 100644
 --- a/mk/platform/NetBSD.mk
 +++ b/mk/platform/NetBSD.mk
 @@ -223,3 +223,15 @@ _OPSYS_CAN_CHECK_SSP=3D		no  # only supports libssp at=
  this time
  # check for maximum command line length and set it in configure's environm=
 ent,
  # to avoid a test required by the libtool script that takes forever.
  _OPSYS_MAX_CMDLEN_CMD=3D	/sbin/sysctl -n kern.argmax
 +
 +# ABI selection.  (XXX Can we do this in terms of ${ABI} instead of
 +# ${MACHINE_ARCH} vs ${HOST_MACHINE_ARCH} (uname -m)?  Complication is
 +# I don't know how to get the value of ${ABI} that ld is configured for
 +# by default.)
 +_OPSYS_LDEMUL.i386=3D		elf_i386
 +
 +.if ${MACHINE_ARCH} !=3D ${HOST_MACHINE_ARCH} && \
 +    defined(_OPSYS_LDEMUL.${MACHINE_ARCH})
 +_WRAP_EXTRA_ARGS.LD+=3D	-m ${_OPSYS_LDEMUL.${MACHINE_ARCH}}
 +CWRAPPERS_APPEND.ld+=3D	-m ${_OPSYS_LDEMUL.${MACHINE_ARCH}}
 +.endif
 
 --=_fDlpu8OzeqfFpAJUhARZcts9raUpcXJJ--
 


Home | Main Index | Thread Index | Old Index