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

toolchain: update GCC to 14.2.0 #207

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ EXPORT_LDFLAGS := $(LDFLAGS)

# add our coding-style related options
CFLAGS += -Wall -Wstrict-prototypes -fno-common
# TODO: try not to break this rule outside of kernel
CFLAGS += -fno-strict-aliasing
CXXFLAGS += -Wall
LDFLAGS += -z noexecstack

Expand Down
12 changes: 4 additions & 8 deletions toolchain/build-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@ if command -v "${TARGET}-gcc" > /dev/null; then
exit 1
fi

# old legacy versions of the compiler:
#BINUTILS=binutils-2.28
#GCC=gcc-7.1.0

BINUTILS=binutils-2.43
GCC=gcc-9.5.0
GCC=gcc-14.2.0

TOOLCHAIN_PREFIX="${BUILD_ROOT}/${TARGET}"
SYSROOT="${TOOLCHAIN_PREFIX}/${TARGET}"
Expand Down Expand Up @@ -139,6 +135,7 @@ build_gcc_stage1() {
# --enable-initfini-array -> force init/fini array support instead of .init .fini sections
# --disable-decimal-float -> not relevant for other than i386 and PowerPC
# --disable-libquadmath -> not using fortran and quad floats
# --disable-tm-clone-registry -> no support for Transactional Memory
# --enable-threads=posix -> enable POSIX threads


Expand All @@ -153,7 +150,8 @@ build_gcc_stage1() {
--disable-decimal-float \
--disable-libquadmath \
--disable-libssp --disable-nls \
--enable-threads=posix
--enable-threads=posix \
--disable-tm-clone-registry

make all-gcc

Expand Down Expand Up @@ -226,7 +224,6 @@ build_libstdcpp() {
# LIBSTDC++ compilation options
# --host -> target is a host for libstdc++
# --with-gxx-include-dir -> configure as a subdir of sysroot for c++ includes to work with external (out-of-toolchain) sysroot
# --with-libphoenix -> use libphoenix as standard C library
# --enable-tls -> enable Thread Local Storage
# --disable-nls -> all compiler messages will be in english
# --disable-shared -> disable building shared libraries [default=yes]
Expand All @@ -238,7 +235,6 @@ build_libstdcpp() {
--host="${TARGET}" \
--prefix="${SYSROOT}" \
--with-gxx-include-dir="${SYSROOT}/include/c++" \
--with-libphoenix \
--enable-tls \
--disable-nls \
--disable-shared \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
--- gcc-9.3.0-orig/gcc/config.gcc 2020-03-12 12:07:21.000000000 +0100
+++ gcc-9.3.0/gcc/config.gcc 2020-03-18 19:25:57.937836171 +0100
@@ -1205,7 +1205,9 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 95c91ee02be..7ad62278cfa 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1465,7 +1465,9 @@ arm*-*-phoenix*)
tm_file="elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
tm_file="${tm_file} newlib-stdint.h phoenix.h"
tm_file="${tm_file} arm/aout.h arm/arm.h"
Expand All @@ -11,3 +13,4 @@
target_cpu_cname="arm7tdmi"
;;
arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*)

40 changes: 40 additions & 0 deletions toolchain/gcc-14.2.0-02-i386-pc-phoenix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/fixincludes/mkfixinc.sh b/fixincludes/mkfixinc.sh
--- a/fixincludes/mkfixinc.sh
+++ b/fixincludes/mkfixinc.sh
@@ -11,6 +11,7 @@ target=fixinc.sh

# Check for special fix rules for particular targets
case $machine in
+ *-phoenix* | \
i?86-*-cygwin* | \
i?86-*-mingw32* | \
x86_64-*-mingw32* | \
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1934,6 +1934,9 @@ i[34567]86-*-elfiamcu)
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h"
;;
+i[34567]86-*-phoenix*)
+ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h phoenix.h"
+ ;;
x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
;;
diff --git a/libgcc/config.host b/libgcc/config.host
index e75a7af647f..9ec10581966 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -818,6 +818,10 @@ i[34567]86-pc-msdosdjgpp*)
;;
i[34567]86-*-lynxos*)
;;
+i[34567]86-*-phoenix*)
+ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o"
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ ;;
i[34567]86-*-nto-qnx*)
tmake_file="$tmake_file i386/t-nto t-libgcc-pic"
extra_parts=crtbegin.o

22 changes: 22 additions & 0 deletions toolchain/gcc-14.2.0-03-riscv64-phoenix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2509,13 +2509,16 @@ riscv*-*-linux*)
gcc_cv_initfini_array=yes
with_tls=${with_tls:-trad}
;;
-riscv*-*-elf* | riscv*-*-rtems*)
+riscv*-*-elf* | riscv*-*-rtems* | riscv*-*-phoenix*)
tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
case ${target} in
*-*-rtems*)
tm_file="${tm_file} riscv/rtems.h rtems.h"
tmake_file="${tmake_file} riscv/t-rtems"
;;
+ *-*-phoenix*)
+ tm_file="${tm_file} phoenix.h"
+ ;;
*)
if test "x${with_multilib_generator}" = xdefault; then
case "x${enable_multilib}" in

Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
diff -Naur gcc-9.3.0-orig/libgcc/config/arm/t-phoenix gcc-9.3.0/libgcc/config/arm/t-phoenix
--- gcc-9.3.0-orig/libgcc/config/arm/t-phoenix 1970-01-01 01:00:00.000000000 +0100
+++ gcc-9.3.0/libgcc/config/arm/t-phoenix 2021-08-23 13:40:28.290478307 +0200
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -556,6 +556,7 @@ arm*-*-uclinux*) # ARM ucLinux
arm*-*-phoenix*)
tmake_file="t-hardfp t-softfp arm/t-arm arm/t-elf arm/t-softfp arm/t-phoenix"
tmake_file="${tmake_file} arm/t-bpabi"
+ tmake_file="${tmake_file} t-crtstuff-pic t-libgcc-pic"
tm_file="$tm_file arm/bpabi-lib.h"
extra_parts="crtbegin.o crtend.o crti.o crtn.o"
unwind_header=config/arm/unwind-arm.h
diff --git a/libgcc/config/arm/t-phoenix b/libgcc/config/arm/t-phoenix
new file mode 100644
--- /dev/null
+++ b/libgcc/config/arm/t-phoenix
@@ -0,0 +1,13 @@
+# PhoenixRTOS uses relocatable ELFs on NOMMU platforms
+# if this is ARM Cortex-M/R subvariant -> build libgcc/crtstuff with PIC
Expand All @@ -15,14 +27,4 @@ diff -Naur gcc-9.3.0-orig/libgcc/config/arm/t-phoenix gcc-9.3.0/libgcc/config/ar
+ CRTSTUFF_T_CFLAGS = $(PICFLAG) -mno-pic-data-is-text-relative
+ INTERNAL_CFLAGS += $(PICFLAG) -mno-pic-data-is-text-relative
+endif
diff -Naur gcc-9.3.0-orig/libgcc/config.host gcc-9.3.0/libgcc/config.host
--- gcc-9.3.0-orig/libgcc/config.host 2020-03-12 12:07:23.000000000 +0100
+++ gcc-9.3.0/libgcc/config.host 2021-07-23 10:19:14.900201201 +0200
@@ -454,6 +454,7 @@
arm*-*-phoenix*)
tmake_file="t-hardfp t-softfp arm/t-arm arm/t-elf arm/t-softfp arm/t-phoenix"
tmake_file="${tmake_file} arm/t-bpabi"
+ tmake_file="${tmake_file} t-crtstuff-pic t-libgcc-pic"
tm_file="$tm_file arm/bpabi-lib.h"
extra_parts="crtbegin.o crtend.o crti.o crtn.o"
unwind_header=config/arm/unwind-arm.h

Loading
Loading