Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc-11: enable GNAT #655

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tur/gcc-11/0012-ada-gnat-handler.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Disable this error handler as it is only written for ARM (32-bit).

--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2631,7 +2631,7 @@
__gnat_handler_installed = 1;
}

-#elif defined(__ANDROID__)
+#elif 0

/*******************/
/* Android Section */
22 changes: 22 additions & 0 deletions tur/gcc-11/0013-ada-libgnarl-syscall.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Fix error like `a-intnam.ads:164:25: "SIGSYS" not declared in "OS_Interface"` on ARM (32-bit)

--- a/gcc/ada/libgnarl/s-linux__android.ads
+++ b/gcc/ada/libgnarl/s-linux__android.ads
@@ -109,6 +109,7 @@
SIGPROF : constant := 27; -- profiling timer expired
SIGXCPU : constant := 24; -- CPU time limit exceeded
SIGXFSZ : constant := 25; -- filesize limit exceeded
+ SIGSYS : constant := 31; -- bad system call
SIGUNUSED : constant := 31; -- unused signal (GNU/Linux)
SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux)
SIG32 : constant := 32; -- glibc internal signal
--- a/gcc/ada/libgnarl/s-osinte__android.ads
+++ b/gcc/ada/libgnarl/s-osinte__android.ads
@@ -112,6 +112,7 @@
SIGPROF : constant := System.Linux.SIGPROF;
SIGXCPU : constant := System.Linux.SIGXCPU;
SIGXFSZ : constant := System.Linux.SIGXFSZ;
+ SIGSYS : constant := System.Linux.SIGSYS;
SIGUNUSED : constant := System.Linux.SIGUNUSED;
SIGSTKFLT : constant := System.Linux.SIGSTKFLT;

16 changes: 16 additions & 0 deletions tur/gcc-11/0014-ada-x64-nallfl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Fix error like following on x86_64.

a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on return value
a-nallfl.ads:48:13: warning: intrinsic binding type mismatch on argument 1
a-nallfl.ads:48:13: warning: profile of "Sin" doesn't match the builtin it binds

--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2685,6 +2685,7 @@
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
a-synbar.adb<libgnarl/a-synbar__posix.adb \
a-synbar.ads<libgnarl/a-synbar__posix.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
23 changes: 23 additions & 0 deletions tur/gcc-11/0015-ada-fix-name-handle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
https://github.com/gcc-mirror/gcc/commit/7aa3800216ea991050ec904a28c628cd7799021b
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -2279,8 +2279,6 @@ package body Osint is

Find_Program_Name;

- Start_Of_Suffix := Name_Len + 1;
-
-- Find the target prefix if any, for the cross compilation case.
-- For instance in "powerpc-elf-gcc" the target prefix is
-- "powerpc-elf-"
@@ -2304,9 +2302,7 @@ package body Osint is
end if;
end loop;

- if End_Of_Prefix > 1 then
- Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1;
- end if;
+ Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1;

-- Create the new program name

49 changes: 49 additions & 0 deletions tur/gcc-11/0016-ada-remove-usage-of-r_debug.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Do not pick up `s-tsmona.adb` on x86_64 and i686. It requires `_r_debug` which is GNU-specific.

--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1748,7 +1748,7 @@
s-intman.adb<libgnarl/s-intman__posix.adb \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
s-linux.ads<libgnarl/s-linux.ads \
@@ -2355,7 +2355,7 @@
s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2597,7 +2597,7 @@
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2701,7 +2701,7 @@
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2744,7 +2744,7 @@
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
9 changes: 7 additions & 2 deletions tur/gcc-11/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="GNU C compiler"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_DEPENDS="binutils, libc++, libgmp, libmpfr, libmpc, libisl, zlib"
TERMUX_PKG_VERSION=11.4.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_MAINTAINER="@licy183"
TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/gcc/gcc-${TERMUX_PKG_VERSION}/gcc-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=af828619dd1970734dda3cfb792ea3f2cba61b5a00170ba8bce4910749d73c07
Expand All @@ -11,7 +12,7 @@ TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+="\
--enable-initfini-array
--enable-default-pie
--enable-languages=c,c++,fortran
--enable-languages=c,c++,fortran,ada
--enable-lto
--enable-host-shared
--enable-host-libquadmath
Expand Down Expand Up @@ -72,6 +73,10 @@ termux_step_pre_configure() {

_setup_toolchain_ndk_gcc_11

# For GNAT build
env -i PATH="$PATH" sudo apt update
env -i PATH="$PATH" sudo apt install -y gnat-11

# Explicitly define __BIONIC__ and __ANDROID__API__
CFLAGS+=" -D__BIONIC__ -D__ANDROID_API__=$TERMUX_PKG_API_LEVEL"
CPPFLAGS+=" -D__BIONIC__ -D__ANDROID_API__=$TERMUX_PKG_API_LEVEL"
Expand All @@ -96,5 +101,5 @@ termux_step_post_make_install() {
# Copy the build spec file
cp $TERMUX_PKG_TMPDIR/specs $TERMUX_PREFIX/lib/gcc/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_VERSION/
# Avoid extract `ndk-sysroot-gcc-compact` at building time.
TERMUX_PKG_DEPENDS+=", ndk-sysroot-gcc-compact"
TERMUX_PKG_DEPENDS+=", ndk-sysroot-gcc-compact (>= 26b-3)"
}