[RTEMS Project] #4892: MacOS tools build failures on Ventura and M series processors
RTEMS trac
trac at rtems.org
Sun Apr 2 23:29:15 UTC 2023
#4892: MacOS tools build failures on Ventura and M series processors
-------------------------+--------------------------
Reporter: Chris Johns | Owner: Chris Johns
Type: defect | Status: assigned
Priority: normal | Milestone: 6.1
Component: tool/rsb | Version: 6
Severity: normal | Resolution:
Keywords: | Blocked By:
Blocking: |
-------------------------+--------------------------
Comment (by Chris Johns):
Building on M2 Pro with Ventura 13.3 and Xcode Version 14.3 (14E222b)
results in segmentation faults in `cc1` and `cc1plus`. Inspecting the
MacOS crash reports showed invalid accesses to the stack guard area of
memory. A typical crash report is:
{{{
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000001699dbff0
Exception Codes: 0x0000000000000002, 0x00000001699dbff0
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [30551]
VM Region Info: 0x1699dbff0 is in 0x1699d8000-0x1699dc000; bytes after
start: 16368 bytes before end: 15
REGION TYPE START - END [ VSIZE] PRT/MAX
SHRMOD REGION DETAIL
MALLOC_MEDIUM (reserved) 147800000-148000000 [ 8192K] rw-/rwx
SM=NUL ...(unallocated)
GAP OF 0x219d8000 BYTES
---> STACK GUARD 1699d8000-1699dc000 [ 16K] ---/rwx
SM=NUL ... for thread 0
Stack 1699dc000-16d9d8000 [ 64.0M] rw-/rwx
SM=PRV thread 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 cc1 0x10335d630 __gmpn_lshift +
208
1 cc1 0x1033438c8 mpfr_mpn_exp +
684 (mpn_exp.c:151)
2 ??? 0x2db39f030 ???
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x00000001699dc010 x2:
0x0000000000000000 x3: 0x0000000000000001
x4: 0x0000000000000000 x5: 0x0000000000000000 x6:
0x0000000000000000 x7: 0x0000000000000000
x8: 0xffffffffffffffff x9: 0x0000000000000007 x10:
0x0000000000000000 x11: 0x0000000000000000
x12: 0x0000000000000000 x13: 0x0000000000000000 x14:
0x0000000000000001 x15: 0x00000000ffffffd0
x16: 0x00000001699dc170 x17: 0x0000000082eff7fb x18:
0xfffffffffffffe00 x19: 0xffffffffffffff04
x20: 0x0000000000000003 x21: 0x0000000000000003 x22:
0x000000016d9cf818 x23: 0x0000000000000005
x24: 0xffffffffffffff08 x25: 0x0000000000000004 x26:
0x0000000000000012 x27: 0x000000016d9cf6c8
x28: 0x000000016d9cf6e0 fp: 0x000000016d9cf7c0 lr:
0x00000001033438c8
sp: 0x000000016d9cf6b0 pc: 0x000000010335d630 cpsr: 0x20001000
far: 0x00000001699dbff0 esr: 0x92000007 (Data Abort) byte read
Translation fault
Binary Images:
0x102428000 - 0x10359bfff cc1 (*) <72d6a4cf-055f-369c-89cb-
4cbf48bff6cf> /Users/USER/*/cc1
0x0 - 0xffffffffffffffff ??? (*)
<00000000-0000-0000-0000-000000000000> ???
}}}
The `FAR` is in the stack guard area. The crashes are always in the MPFR
library and relate to calls to GMP. The GMP tests pass. The MPFR built by
`gcc` tests fail and a hand built MPFR tests pass.
The crash leaves the build so changing to the MPFR build directory lets
you run the tests:
{{{
cd build/arm-rtems6-gcc-cf59d86-newlib-17ac400-arm64-apple-
darwin22.4.0-1/build/mpfr
make check
}}}
The results are:
{{{
============================================================================
Testsuite summary for MPFR 4.2.0
============================================================================
# TOTAL: 197
# PASS: 97
# SKIP: 3
# XFAIL: 0
# FAIL: 97
# XPASS: 0
# ERROR: 0
}}}
The failures are all seg faults.
I upgraded to MPFR 4.2.0 as it does not need the `fix-mac-arm64-mpfr-
config.patch` patch. Building by hand and referencing the `gcc` build GMP
has the following results:
{{{
============================================================================
Testsuite summary for MPFR 4.2.0
============================================================================
# TOTAL: 197
# PASS: 194
# SKIP: 3
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
}}}
I provided the same `configure` command line used by `gcc` when it builds
the library internally. There are no sig faults.
I ran the tests for GMP and there were no errors.
Close inspection of the build and the `config.log` reveals a difference.
The `gcc` build has:
{{{
-DHAVE___GMPN_INVERT_LIMB=1 -DHAVE___GMPN_RSBLSH1_N=1
}}}
and they are not present when building by hand. The `config.log` shows:
{{{
configure:19315: checking for __gmpn_invert_limb
[..]
configure:19315: result: yes
}}}
The hand built MPFR has:
{{{
configure:19315: checking for __gmpn_invert_limb
[..]
configure:19315: result: no
}}}
This is the only difference I could see.
--
Ticket URL: <http://devel.rtems.org/ticket/4892#comment:10>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list