Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 895964 - dev-libs/gmp in stage3 tarball triggers `Illegal Instruction` on PPC64 e6500 CPU
Summary: dev-libs/gmp in stage3 tarball triggers `Illegal Instruction` on PPC64 e6500 CPU
Status: RESOLVED DUPLICATE of bug 894134
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-23 07:50 UTC by David Lamparter
Modified: 2023-02-23 22:12 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Lamparter 2023-02-23 07:50:18 UTC
The binary of dev-libs/gmp included in stage3-ppc64-openrc-20230220T024702Z.tar.xz triggers SIGILL in __gmpn_invert_limb when running gcc on an e6500 (Freescale T4240) CPU.  Not all uses of gcc trigger the issue, presumably that math function is only used in specific circumstances.  Trying to build sys-devel/gcc triggers the issue reliably.

This is on a 5.15 kernel with math emulation for unimplemented math functions *enabled*. (The e6500 does not have FSQRT.)

I haven't tracked down yet what instruction exactly is causing the issue;  I ended up overwriting libgmp with a binary from Debian to get gcc working so I could rebuild dev-libs/gmp (which then worked as expected - no issue with the ebuild itself.)

It seems that this is simply an issue of the stage3 tarball being built with too aggressive CPU flags.

As I was under time pressure to get the setup running, I'll circle back to grab additional information in a few days.  (I can of course simply grab the stage tarball again, unpack it in a fresh directory on the now-working system, and run gcc inside that to reproduce the problem.  Just need to get the box up&running otherwise first, sorry.)

Reproducible: Always

Steps to Reproduce:
1. acquire an e6500 powerpc64 system or try emulating one with QEMU
2. grab stage3-ppc64-openrc-20230220T024702Z.tar.xz 
3. emerge sys-devel/gcc
Actual Results:  
SIGILL during build.

Expected Results:  
sys-devel/gcc being built.

# uname -a                            
Linux zehir 5.15.71+ #9 SMP Sun Feb 19 07:51:53 CET 2023 ppc64 GNU/Linux

# gunzip -c /proc/config.gz | grep MATH
CONFIG_MATH_EMULATION=y
# CONFIG_MATH_EMULATION_FULL is not set
CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y

# tail -n8 /proc/cpuinfo
processor       : 23
cpu             : e6500, altivec supported
clock           : 1666.666650MHz
revision        : 2.0 (pvr 8040 0120)

timebase        : 45833333
platform        : CoreNet Generic
model           : fsl,T4240QDS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-23 22:12:55 UTC
You're spot on, but I'll mark this as a dupe of bug 894134 and copy/paste your comment there to keep the discussion in one place. Thank you!

(Please do feel free to post more there)

*** This bug has been marked as a duplicate of bug 894134 ***