Skip to content

Commit

Permalink
toolchain: update GCC to 14.2.0
Browse files Browse the repository at this point in the history
JIRA: RTOS-927
  • Loading branch information
badochov committed Oct 1, 2024
1 parent 08bcf10 commit bb39f7d
Show file tree
Hide file tree
Showing 14 changed files with 249 additions and 200 deletions.
2 changes: 1 addition & 1 deletion toolchain/build-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fi
#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
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,10 +1,10 @@
diff --git gcc-9.3.0-orig/gcc/config/phoenix.h gcc-9.3.0/gcc/config/phoenix.h
index c1aad95..1985dde 100644
--- gcc-9.3.0-orig/gcc/config/phoenix.h
+++ gcc-9.3.0/gcc/config/phoenix.h
diff --git a/gcc/config/phoenix.h b/gcc/config/phoenix.h
--- a/gcc/config/phoenix.h
+++ b/gcc/config/phoenix.h
@@ -31,3 +31,5 @@ along with GCC; see the file COPYING3. If not see
/* This will prevent selecting 'unsigned long int' instead of 'unsigned int' as 'uint32_t' in stdint-newlib.h. */
#undef STDINT_LONG32
#define STDINT_LONG32 0
+/* libitm is not supported on Phoenix - disable it in crtstuff */
+#define USE_TM_CLONE_REGISTRY 0

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

Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configure
--- gcc-9.3.0-orig/libstdc++-v3/configure 2020-03-12 12:07:24.000000000 +0100
+++ cc-9.3.0/libstdc++-v3/configure 2023-02-24 13:44:47.346288244 +0100
@@ -899,6 +899,7 @@
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -921,6 +921,7 @@ enable_largefile
with_target_subdir
with_cross_host
with_newlib
+with_libphoenix
enable_maintainer_mode
enable_shared
enable_static
@@ -1653,6 +1654,7 @@
@@ -1697,6 +1698,7 @@ Optional Packages:
configuring in a subdirectory
--with-cross-host=HOST configuring with a cross compiler
--with-newlib assume newlib as a system C library
+ --with-libphoenix assume libphoenix as a system C library
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
@@ -5447,6 +5449,13 @@
@@ -5571,6 +5573,13 @@ if test "${with_newlib+set}" = set; then :
fi


Expand All @@ -31,7 +31,7 @@ diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configur
# Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
# available). Uncomment the next line to force a particular method.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
@@ -9070,6 +9079,30 @@
@@ -9239,6 +9248,30 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
lt_prog_compiler_static='-static'

case $host_os in
Expand Down Expand Up @@ -62,7 +62,7 @@ diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configur
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
@@ -9344,6 +9377,36 @@
@@ -9513,6 +9546,36 @@ case $host_os in
*djgpp*)
lt_prog_compiler_pic=
;;
Expand Down Expand Up @@ -99,17 +99,17 @@ diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configur
*)
lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
;;
@@ -11757,6 +11820,9 @@
@@ -11987,6 +12050,9 @@ else
lt_cv_dlopen_libs=

case $host_os in
+ phoenix*)
+ ;;
+
+
beos*)
lt_cv_dlopen="load_add_on"
lt_cv_dlopen_libs=
@@ -13953,6 +14019,31 @@
@@ -14235,6 +14301,31 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
lt_prog_compiler_static_CXX='-static'

case $host_os in
Expand Down Expand Up @@ -141,7 +141,7 @@ diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configur
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
@@ -14263,6 +14354,36 @@
@@ -14545,6 +14636,36 @@ case $host_os in
*djgpp*)
lt_prog_compiler_pic_CXX=
;;
Expand Down Expand Up @@ -178,21 +178,21 @@ diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configur
*)
lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
;;
@@ -15466,6 +15587,13 @@
@@ -15783,6 +15904,13 @@ if test "$enable_shared" = yes; then
glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"
glibcxx_compiler_shared_flag="-D_GLIBCXX_SHARED"

+elif test "$pic_mode" = yes; then
+ # It was not possible to use pic without shared libraries in the default configure file
+ # due to the above code. If the "shaded" option is not enabled, the selected
+ # due to the above code. If the "shaded" option is not enabled, the selected
+ # lt_prog_compiler_pic_CXX flags will not be propagated to makefiles.
+
+ glibcxx_lt_pic_flag="-prefer-pic"
+ glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"
else
glibcxx_lt_pic_flag=
glibcxx_compiler_pic_flag=
@@ -28848,7 +28976,7 @@
@@ -27336,7 +27464,7 @@ else
# Construct crosses by hand, eliminating bits that need ld...
# GLIBCXX_CHECK_MATH_SUPPORT

Expand All @@ -201,10 +201,10 @@ diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configur
# on a hosted environment.
if test "x${with_newlib}" = "xyes"; then
os_include_dir="os/newlib"
@@ -28908,6 +29036,61 @@

$as_echo "#define HAVE_MEMALIGN 1" >>confdefs.h
@@ -28612,6 +28740,60 @@ _ACEOF

;;
esac
+ elif test "x${with_libphoenix}" = "xyes"; then
+ os_include_dir="os/generic"
+ printf "%s\n" "#define HAVE_HYPOT 1" >>confdefs.h
Expand Down Expand Up @@ -257,9 +257,47 @@ diff -Naur gcc-9.3.0-orig/libstdc++-v3/configure gcc-9.3.0/libstdc++-v3/configur
+ printf "%s\n" "#define HAVE_TANF 1" >>confdefs.h
+
+ printf "%s\n" "#define HAVE_TANHF 1" >>confdefs.h
+
+ printf "%s\n" "#define HAVE_STRTOLD 1" >>confdefs.h
+
else
+ printf "%s\n" "#define HAVE_STRTOLD 1" >>confdefs.h
elif test "x$with_headers" != "xno"; then

# Base decisions on target environment.
@@ -53875,6 +54057,9 @@ done
*) have_fcntl=yes ;;
esac
else
+ case "${host}" in
+ *-*-phoenix*) have_fcntl=yes ;;
+ *)
ac_fn_c_check_func "$LINENO" "fcntl" "ac_cv_func_fcntl"
if test "x$ac_cv_func_fcntl" = xyes; then :
have_fcntl=yes
@@ -53882,6 +54067,8 @@ else
have_fcntl=no
fi

+ ;;
+ esac
fi
if test "$have_fcntl" = "yes"; then
BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_FCNTL=1"
@@ -53906,6 +54093,9 @@ _ACEOF
*) have_getexecname=no ;;
esac
else
+ case "${host}" in
+ *-*-phoenix*) have_fcntl=yes ;;
+ *)
ac_fn_c_check_func "$LINENO" "getexecname" "ac_cv_func_getexecname"
if test "x$ac_cv_func_getexecname" = xyes; then :
have_getexecname=yes
@@ -53913,6 +54103,8 @@ else
have_getexecname=no
fi

+ ;;
+ esac
fi
if test "$have_getexecname" = "yes"; then
BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_GETEXECNAME=1"

Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
diff -Naur gcc-9.3.0-orig/gcc/config/sparc/t-phoenix gcc-9.3.0/gcc/config/sparc/t-phoenix
--- gcc-9.3.0-orig/gcc/config/sparc/t-phoenix
+++ gcc-9.3.0/gcc/config/sparc/t-phoenix
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3446,6 +3446,10 @@ sparc-*-rtems*)
tm_file="${tm_file} elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems"
;;
+sparc-*-phoenix*)
+ tm_file="${tm_file} elfos.h sparc/sysv4.h sparc/sp-elf.h phoenix.h newlib-stdint.h"
+ tmake_file="${tmake_file} sparc/t-sparc sparc/t-phoenix"
+ ;;
sparc-*-linux*)
tm_file="${tm_file} elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h"
extra_options="${extra_options} sparc/long-double-switch.opt"
diff --git a/gcc/config/sparc/t-phoenix b/gcc/config/sparc/t-phoenix
new file mode 100644
--- /dev/null
+++ b/gcc/config/sparc/t-phoenix
@@ -0,0 +1,14 @@
+MULTILIB_OPTIONS = mcpu=leon3 msoft-float mfix-gr712rc fPIC mno-pic-data-is-text-relative mpic-register=g6
+MULTILIB_DIRNAMES = leon3 soft gr712rc pic no-pditr pic-reg-g6
Expand All @@ -16,25 +31,11 @@ diff -Naur gcc-9.3.0-orig/gcc/config/sparc/t-phoenix gcc-9.3.0/gcc/config/sparc/
+# LEON3 no pic/pie
+MULTILIB_REQUIRED += mcpu=leon3
+MULTILIB_REQUIRED += mcpu=leon3/msoft-float
diff -Naur gcc-9.3.0-orig/gcc/config.gcc gcc-9.3.0/gcc/config.gcc
--- 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
@@ -3028,6 +3028,10 @@
sparc-*-rtems*)
tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems"
;;
+sparc-*-phoenix*)
+ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h phoenix.h newlib-stdint.h"
+ tmake_file="${tmake_file} sparc/t-sparc sparc/t-phoenix"
+ ;;
sparc-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h"
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 2020-03-18 15:31:59.377075283 +0100
@@ -1312,7 +1312,11 @@
sparc-*-rtems*)
diff --git a/libgcc/config.host b/libgcc/config.host
index 213c07f106a..d4e893d918e 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1486,6 +1486,10 @@ sparc-*-rtems*)
tmake_file="$tmake_file sparc/t-elf sparc/t-softmul t-crtfm t-fdpbit"
extra_parts="$extra_parts crti.o crtn.o crtfastmath.o"
;;
Expand All @@ -45,3 +46,4 @@ diff -Naur gcc-9.3.0-orig/libgcc/config.host gcc-9.3.0/libgcc/config.host
sparc*-*-solaris2*)
tmake_file="$tmake_file t-crtfm"
extra_parts="$extra_parts crtfastmath.o"

Loading

0 comments on commit bb39f7d

Please sign in to comment.