NetBSD-Bugs archive

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

Re: port-mips/59064 (jemalloc switch to 5.3 broke userland)



The following reply was made to PR port-mips/59064; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Martin Husemann <martin%duskware.de@localhost>
Cc: Rin Okuyama <rokuyama.rk%gmail.com@localhost>, gnats-bugs%netbsd.org@localhost,
	port-mips-maintainer%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
	netbsd-bugs%netbsd.org@localhost, martin%NetBSD.org@localhost
Subject: Re: port-mips/59064 (jemalloc switch to 5.3 broke userland)
Date: Sat, 12 Apr 2025 14:51:08 +0000

 This is a multi-part message in MIME format.
 --=_k+R2A0jPCfl/fFvU84G4E4n02s6AxFtx
 
 Can you try the attached patch?  Will require a clean build of
 anything that uses bsd.lib.mk.  (Will also need something to wash the
 embarrassment off my face if this turns out to be the culprit!)
 
 --=_k+R2A0jPCfl/fFvU84G4E4n02s6AxFtx
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr59064-picmistake"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr59064-picmistake.patch"
 
 # HG changeset patch
 # User Taylor R Campbell <riastradh%NetBSD.org@localhost>
 # Date 1744468511 0
 #      Sat Apr 12 14:35:11 2025 +0000
 # Branch trunk
 # Node ID 322da4dc83ede0aad9db9ac0a0e3b31143a7eddb
 # Parent  abced29d5da6d71badf2de46a8b1e589d4703b90
 # EXP-Topic riastradh-pr59064-jemalloc53fallout
 bsd.lib.mk: Redo rev. 1.418 more selectively.
 
 Previously, in rev. 1.418, I had changed:
 
  .if ${LIBISPRIVATE} !=3D "no"
 ...
  . if defined(NOSTATICLIB) && ${MKPICLIB} !=3D "no"
  MAKESTATICLIB?=3D	no
  . elif ${LIBISPRIVATE} !=3D "pic"
  MKPIC:=3D		no
  . endif
 ...
  .endif
 ...
 -.if ${LIBISPRIVATE} =3D=3D "pic"
 +.if ${MKPIC} !=3D "no"
  CFLAGS+=3D        -fPIC
  AFLAGS+=3D        -fPIC
  .endif
 
 This was an attempt to obviate the need for grody conditionals in
 private shared libraries like libuv:
 
 .if ${MACHINE} =3D=3D "sun2"
 LIBISPRIVATE=3Dyes
 .else
 LIBISPRIVATE=3Dpic
 .endif
 
 This is wrong, after all, because you can also do MKPIC=3Dno on
 non-sun2 platforms if you really want a static build, and it's a mess
 to have to write it out in every case.
 
 My theory in making that change was that:
 
 (a) on MKPIC=3Dyes platforms in makefiles without LIBISPRIVATE=3Dyes,
     we're building with -fPIC anyway, so ${MKPIC} !=3D no is right;
 
 (b) on MKPIC=3Dyes platforms in makefiles with LIBISPRIVATE=3Dyes, we
     shouldn't build with -fPIC and the conditional above sets
     MKPIC=3Dno in that case, so ${MKPIC} !=3D no is right;
 
 (c) on MKPIC=3Dno platforms (mainly sun2), no matter what LIBISPRIVATE
     is set to, we shouldn't build with -fPIC, so ${MKPIC} !=3D no is
     right.
 
 But (a) is wrong, because we use the same makefile to build .pico and
 .o objects from which we link (PIC) .so and (non-PIC) .a libraries,
 and the distinction is made not in CFLAGS/AFLAGS but in PICFLAGS and
 CSHLIBFLAGS.
 
 So, to obviate the need for the .if sun2 conditionals around
 LIBISPRIVATE=3Dpic, but avoid breaking everything _other_ than
 LIBISPRIVATE=3Dpic, let's make the addition of -fPIC to CFLAGS/AFLAGS
 conditional on _both_ LIBISPRIVATE=3Dpic _and_ MKPIC=3Dyes.
 
 PR port-mips/59064: jemalloc switch to 5.3 broke userland
 
 diff -r abced29d5da6 -r 322da4dc83ed share/mk/bsd.lib.mk
 --- a/share/mk/bsd.lib.mk	Fri Apr 11 19:15:42 2025 +0000
 +++ b/share/mk/bsd.lib.mk	Sat Apr 12 14:35:11 2025 +0000
 @@ -59,7 +59,7 @@ AFLAGS+=3D        ${PIE_AFLAGS}
  .endif
  # The -fPIC is needed for libraries that include other libraries
  # The order matters here, PIC needs to be last
 -.if ${MKPIC} !=3D "no"
 +.if ${LIBISPRIVATE} =3D=3D "pic" && ${MKPIC} !=3D "no"
  CFLAGS+=3D        -fPIC
  AFLAGS+=3D        -fPIC
  .endif
 
 --=_k+R2A0jPCfl/fFvU84G4E4n02s6AxFtx--
 


Home | Main Index | Thread Index | Old Index