Skip to content

Commit bc4e62e

Browse files
committed
a
1 parent 35aa360 commit bc4e62e

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ if ! [ -f "${gcc_tarball}" ]; then
645645
patch --directory="${gcc_directory}" --strip='1' --input="${workdir}/patches/gcc-2.9/0004-libiberty-hide-sys_nerr-from-system-headers-in-strerror.patch"
646646
patch --directory="${gcc_directory}" --strip='1' --input="${workdir}/patches/gcc-2.9/0005-libiberty-hide-sys_nsig-from-system-headers-in-strsignal.patch"
647647
patch --directory="${gcc_directory}" --strip='1' --input="${workdir}/patches/gcc-2.9/0006-gcc-drop-unused-sys-dir.h-include-from-protoize.patch"
648+
patch --directory="${gcc_directory}" --strip='1' --input="${workdir}/patches/gcc-2.9/0007-gcc-also-set-POSIX-xm_defines-for-Android-hosts.patch"
648649
fi
649650

650651
if (( gcc_major == 11 )); then
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From 528470c4ab4919e4d90b58f421bf0a8db8a684e1 Mon Sep 17 00:00:00 2001
2+
From: Kartatz <105828205+Kartatz@users.noreply.github.com>
3+
Date: Sun, 9 Aug 2026 19:18:37 +0000
4+
Subject: [PATCH] gcc: also set POSIX xm_defines for Android hosts
5+
6+
The second pass of the cpu_type loop registers HAVE_ATEXIT/POSIX/BSTRING
7+
for hosts whose triple matches "*-*-linux-gnu*". Android host triples
8+
are "*-*-linux-android*" (e.g. aarch64-unknown-linux-android21), so they
9+
slipped through this case and POSIX was left undefined for the build/host.
10+
Code like protoize.c then took the non-POSIX branch (using the
11+
<sys/dir.h> include that bionic does not provide), breaking the build.
12+
13+
Extend the pattern to also match "*-*-linux-android*", treating Android
14+
like the other GNU/Linux hosts it shares a POSIX kernel interface with.
15+
---
16+
gcc/configure | 4 ++--
17+
gcc/configure.in | 4 ++--
18+
2 files changed, 4 insertions(+), 4 deletions(-)
19+
20+
diff --git a/gcc/configure b/gcc/configure
21+
index 9810e80..82a0642 100755
22+
--- a/gcc/configure
23+
+++ b/gcc/configure
24+
@@ -2962,9 +2962,9 @@ for machine in $build $host $target; do
25+
tm_file=${cpu_type}/${cpu_type}.h
26+
xm_file=${cpu_type}/xm-${cpu_type}.h
27+
28+
- # Common parts for linux-gnu and openbsd systems
29+
+ # Common parts for Linux (glibc/Android) and openbsd systems
30+
case $machine in
31+
- *-*-linux-gnu*)
32+
+ *-*-linux-gnu* | *-*-linux-android*)
33+
xm_defines="HAVE_ATEXIT POSIX BSTRING"
34+
;;
35+
*-*-openbsd*)
36+
diff --git a/gcc/configure.in b/gcc/configure.in
37+
index b177082..79ace1f 100644
38+
--- a/gcc/configure.in
39+
+++ b/gcc/configure.in
40+
@@ -528,9 +528,9 @@ changequote([,])dnl
41+
tm_file=${cpu_type}/${cpu_type}.h
42+
xm_file=${cpu_type}/xm-${cpu_type}.h
43+
44+
- # Common parts for linux-gnu and openbsd systems
45+
+ # Common parts for Linux (glibc/Android) and openbsd systems
46+
case $machine in
47+
- *-*-linux-gnu*)
48+
+ *-*-linux-gnu* | *-*-linux-android*)
49+
xm_defines="HAVE_ATEXIT POSIX BSTRING"
50+
;;
51+
*-*-openbsd*)
52+
--
53+
2.54.0
54+

0 commit comments

Comments
 (0)