Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
Re: python fix for armv7 (and potentially powerpc)
To:
Peter Hessler <phessler@theapt.org>, ports@openbsd.org, gkoehler@openbsd.org, Kurt Mosiejczuk <kmos@openbsd.org>
Date:
Wed, 22 Oct 2025 18:59:00 +0200

Download raw body.

Thread
On Tue, Oct 21, 2025 at 12:53:58PM +0100, Stuart Henderson wrote:
> On 2025/10/21 13:37, Jeremie Courreges-Anglas wrote:
> > On Tue, Oct 21, 2025 at 01:16:41PM +0200, Peter Hessler wrote:
> > > Selectively enable LTO depending on platform, this fixes the build for me
> > > on armv7.  
> > > 
> > > OK?
> > 
> > Unless there actually is a pattern, I'd rather have LTO disabled
> > selectively on platforms where it is known to break, and not
> > forcefully enabled on other architectures.
> > 
> > The current powerpc build seems to have succeeded on powerpc, but I'll
> > let gkoehler@ confirm.
> > 
> > > I also slipped this into the 7.8-release build for armv7, OK to commit to
> > > branch?
> > 
> > Makes sense, but not this diff please.
> 
> as a first step, how about this instead, which avoids changing things
> except for arm?

--with-lto is opt-in so this doesn't change the build on non-ld.lld
archs.  AFAIK base ld.bfd doesn't support LTO anyway.

ok jca@

That being said, I'm slightly worried about the actual failure:
cc -pthread -L/usr/local/lib/  -flto=thin -g -L/usr/obj/ports/Python-3.12.11/Python-3.12.11 -L/usr/local/lib/ -o Programs/_freeze_module Programs/_freeze_module.o [...]  Modules/pwdmodule.o -lintl -lpthread  -lutil                        -lm
cc: error: unable to execute command: Illegal instruction (core dumped)
cc: error: linker command failed due to signal (use -v to see invocation)

That means ld.lld did something stupid.

> then other changes can be done after per-arch testing.

--enable-optimizations is still broken on amd64 so at this point I
wonder whether we should just drop it altogether. :)

> Index: Makefile.inc
> ===================================================================
> RCS file: /cvs/ports/lang/python/Makefile.inc,v
> diff -u -p -r1.168 Makefile.inc
> --- Makefile.inc	31 Jan 2025 12:46:51 -0000	1.168
> +++ Makefile.inc	21 Oct 2025 11:50:26 -0000
> @@ -128,15 +128,12 @@ CONFIGURE_ARGS +=	--with-fpectl \
>  			--with-tcltk-libs='-L${X11BASE}/lib -l${MODTCL_LIB} -l${MODTK_LIB}'
>  .else
>  CONFIGURE_ARGS +=	--enable-loadable-sqlite-extensions
> -.  if ${PROPERTIES:Mlld}
> +.  if ${PROPERTIES:Mlld} && ${MACHINE_ARCH} != "arm"
>  CONFIGURE_ARGS +=	--with-lto
> -.    if ${MACHINE_ARCH} != "arm" && ${MACHINE_ARCH} != "powerpc"
> -# On armv7, clang errors out due to lack of memory.
> -# On powerpc, the python binary would crash by "Segmentation fault".
> -# XXX lld from llvm-16 errors out with:
> -# ld.lld: error: relocation R_X86_64_PC32 cannot be used against symbol '__profd_isdigit'; recompile with -fPIC
> -#CONFIGURE_ARGS +=	--enable-optimizations
> +.    else
> +CONFIGURE_ARGS +=	--with-lto=no
>  .    endif
> +# XXX try using --enable-optimizations again; needs per-arch testing
>  .  endif
>  TEST_IS_INTERACTIVE =	Yes
>  .endif
> 

-- 
jca