diff --git a/classes/autoconf.yaml b/classes/autoconf.yaml index ecfc1c29..230ce216 100644 --- a/classes/autoconf.yaml +++ b/classes/autoconf.yaml @@ -89,7 +89,7 @@ buildSetup: | autoconfSync () { mkdir -p $2 - rsync -aH --delete --exclude=".autoreconf.stamp" $1/ $2/ + rsync -aHu --exclude=".autoreconf.stamp" $1/ $2/ } # Moves the sources of $1 to $2 and calls autoconfReconfigure diff --git a/default.yaml b/default.yaml index 9579df70..5a9e4c98 100644 --- a/default.yaml +++ b/default.yaml @@ -6,7 +6,7 @@ environment: SOURCEWARE_MIRROR: "https://sourceware.org/pub" # default compile flags - BASEMENT_OPTIMIZE: "s" # compiler optimization level (0/1/2/s) + BASEMENT_OPTIMIZE: "2" # compiler optimization level (0/1/2/3/s/g) BASEMENT_DEBUG: "1" # generate debug symbols (0/1) ########################################################################## @@ -29,10 +29,10 @@ environment: # # Attention: keep in sync with devel::host-compat-toolchain! These flags # should be reset by the compat-toolchain exactly to their default values. - CPPFLAGS: "-Wdate-time" - CFLAGS: "-Os -pipe -fPIC" - CXXFLAGS: "-Os -pipe -fPIC" - LDFLAGS: "-Wl,-O1 -Wl,--hash-style=gnu" + CPPFLAGS: "" + CFLAGS: "-O2 -pipe -fPIC" + CXXFLAGS: "-O2 -pipe -fPIC" + LDFLAGS: "" archiveAppend: backend: http diff --git a/doc/usage.rst b/doc/usage.rst index 11f1af95..9a799fb1 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -103,8 +103,8 @@ supposed to be widely supported. To tweak the standard compile flags, the following variables may be optionally set when pulling in the toolchain. ``BASEMENT_OPTIMIZE`` - Compiler optimization level (``-O``). Defaults to ``s`` to optimize for - small binaries. + Compiler optimization level (``-O``). Defaults to ``2`` to optimize for + speed. ``BASEMENT_DEBUG`` May be ``0`` or ``1`` and controls the generation of debugging information. diff --git a/recipes/devel/binutils.yaml b/recipes/devel/binutils.yaml index d4cc524b..6d56ca86 100644 --- a/recipes/devel/binutils.yaml +++ b/recipes/devel/binutils.yaml @@ -1,13 +1,13 @@ inherit: [autotools, patch] metaEnvironment: - PKG_VERSION: "2.45" + PKG_VERSION: "2.45.1" PKG_LICENSE: "FSFAP AND GFDL-1.3 AND GPL-2.0-or-later AND LGPL-2.0-or-later" checkoutSCM: scm: url url: ${GNU_MIRROR}/binutils/binutils-${PKG_VERSION}.tar.xz - digestSHA1: "09fd8a50a95be4a94412fe3847d16280996679c5" + digestSHA1: "db1bb5b24bab487664380f4cbb498c8b2595e5a8" stripComponents: 1 checkoutDeterministic: True @@ -20,7 +20,25 @@ buildTools: [host-toolchain, bison] buildToolsWeak: [m4] multiPackage: "": - buildVars: [AUTOCONF_HOST, AUTOCONF_TARGET, BINUTILS_PREFIX] + Config: + BINUTILS_ZSTD: + type: bool + help: "Enable zstd compression support for debug sections" + default: False + BINUTILS_COMPRESS_DEBUG: + type: bool + help: "Compress debug sections by default in linker" + default: False + + depends: + - if: $BINUTILS_ZSTD + depends: + - libs::zstd-dev + - name: libs::zstd-tgt + use: [] + + buildVars: [AUTOCONF_HOST, AUTOCONF_TARGET, BINUTILS_PREFIX, + BINUTILS_ZSTD, BINUTILS_COMPRESS_DEBUG] buildScript: | export MAKEINFO=true autotoolsBuild -o MAKEINFO=true -O MAKEINFO=true $1 \ @@ -31,12 +49,16 @@ multiPackage: --disable-nls \ --disable-werror \ --enable-plugins \ - --enable-lto + --enable-lto \ + --enable-compressed-debug-sections=$([[ $BINUTILS_COMPRESS_DEBUG == 1 ]] && echo ld || echo none) \ + --enable-default-compressed-debug-sections-algorithm=$(\ + [[ $BINUTILS_ZSTD == 1 ]] && echo zstd || echo zlib) multiPackage: dev: packageScript: | autotoolsPackageDev + provideDeps: [ "*-dev" ] "": packageScript: | autotoolsPackageTgt @@ -51,6 +73,7 @@ multiPackage: popd fi + provideDeps: [ "*-tgt" ] provideTools: binutils: usr/bin @@ -67,5 +90,7 @@ multiPackage: multiPackage: dev: packageScript: autotoolsPackageDev + provideDeps: [ "*-dev" ] tgt: packageScript: autotoolsPackageTgt + provideDeps: [ "*-tgt" ] diff --git a/recipes/devel/binutils/0001-Add-L4Re-as-a-target.patch b/recipes/devel/binutils/0001-Add-L4Re-as-a-target.patch index 2b1a5f31..a2b721dc 100644 --- a/recipes/devel/binutils/0001-Add-L4Re-as-a-target.patch +++ b/recipes/devel/binutils/0001-Add-L4Re-as-a-target.patch @@ -1,22 +1,10 @@ -From 30844bbcdfda35af99cec00fabc828dcbe7202f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= Date: Mon, 19 May 2025 16:42:07 +0200 Subject: [PATCH] Add L4Re as a target ---- - bfd/config.bfd | 13 +++++++++++-- - gas/configure.tgt | 4 +++- - ld/Makefile.am | 1 + - ld/Makefile.in | 2 ++ - ld/configure.tgt | 10 ++++++++-- - ld/emulparams/armelf_l4re.sh | 3 +++ - 6 files changed, 28 insertions(+), 5 deletions(-) - create mode 100644 ld/emulparams/armelf_l4re.sh - -diff --git a/bfd/config.bfd b/bfd/config.bfd -index 6553aac1e99..1a2ebed62cb 100644 ---- a/bfd/config.bfd -+++ b/bfd/config.bfd +diff -Nurp a/bfd/config.bfd b/bfd/config.bfd +--- a/bfd/config.bfd 2025-11-10 01:00:00.000000000 +0100 ++++ b/bfd/config.bfd 2025-12-12 11:43:46.804841462 +0100 @@ -274,6 +274,11 @@ case "${targ}" in targ_selvecs="aarch64_elf64_be_vec arm_elf32_le_vec arm_elf32_be_vec" want64=true @@ -49,7 +37,7 @@ index 6553aac1e99..1a2ebed62cb 100644 targ_defvec=i386_elf32_vec targ_selvecs="iamcu_elf32_vec i386_coff_vec" ;; -@@ -681,7 +690,7 @@ case "${targ}" in +@@ -681,11 +690,11 @@ case "${targ}" in targ_selvecs="i386_elf32_vec iamcu_elf32_vec" want64=true ;; @@ -58,72 +46,119 @@ index 6553aac1e99..1a2ebed62cb 100644 targ_defvec=x86_64_elf64_vec targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec" case "${targ}" in -diff --git a/gas/configure.tgt b/gas/configure.tgt -index d58f21873a3..65f22474c7d 100644 ---- a/gas/configure.tgt -+++ b/gas/configure.tgt +- x86_64-*-rtems*) ++ x86_64-*-rtems* | x86_64-*-l4re*) + targ_selvecs="${targ_selvecs} x86_64_pe_vec x86_64_pei_vec" + esac + want64=true +diff -Nurp a/gas/config/tc-i386.c b/gas/config/tc-i386.c +--- a/gas/config/tc-i386.c 2025-11-10 01:00:00.000000000 +0100 ++++ b/gas/config/tc-i386.c 2025-12-11 14:19:35.383263645 +0100 +@@ -574,7 +574,8 @@ const char extra_symbol_chars[] = "*%-([ + && !defined (TE_Haiku) \ + && !defined (TE_FreeBSD) \ + && !defined (TE_DragonFly) \ +- && !defined (TE_NetBSD)) ++ && !defined (TE_NetBSD) \ ++ && !defined (TE_L4Re)) + /* This array holds the chars that always start a comment. If the + pre-processor is disabled, these aren't very useful. The option + --divide will remove '/' from this list. */ +diff -Nurp a/gas/config/te-arml4reeabi.h b/gas/config/te-arml4reeabi.h +--- a/gas/config/te-arml4reeabi.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/gas/config/te-arml4reeabi.h 2025-12-11 14:15:11.115733180 +0100 +@@ -0,0 +1,25 @@ ++/* Copyright (C) 2004-2025 Free Software Foundation, Inc. ++ ++ This file is part of GAS, the GNU Assembler. ++ ++ GAS is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as ++ published by the Free Software Foundation; either version 3, ++ or (at your option) any later version. ++ ++ GAS is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See ++ the GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with GAS; see the file COPYING. If not, write to the Free ++ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA ++ 02110-1301, USA. */ ++ ++#include "te-l4re.h" ++ ++/* The EABI requires the use of VFP. */ ++#define FPU_DEFAULT FPU_ARCH_SOFTVFP ++#define EABI_DEFAULT EF_ARM_EABI_VER5 ++ +diff -Nurp a/gas/config/te-l4re.h b/gas/config/te-l4re.h +--- a/gas/config/te-l4re.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/gas/config/te-l4re.h 2025-12-11 14:14:06.976941014 +0100 +@@ -0,0 +1,31 @@ ++/* te-l4re.h -- L4Re target environment declarations. ++ Copyright (C) 2000-2025 Free Software Foundation, Inc. ++ ++ This file is part of GAS, the GNU Assembler. ++ ++ GAS is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3, or (at your option) ++ any later version. ++ ++ GAS is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with GAS; see the file COPYING. If not, write to the Free ++ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA ++ 02110-1301, USA. */ ++ ++/* Target environment for L4Re. It is the same as the generic ++ target, except that it arranges via the TE_L4Re define to ++ suppress the use of "/" as a comment character. Some code in the ++ L4Re kernel uses "/" to mean division. (What a concept!) */ ++#define TE_L4Re 1 ++ ++#define LOCAL_LABELS_DOLLAR 1 ++#define LOCAL_LABELS_FB 1 ++ ++#include "obj-format.h" ++ +diff -Nurp a/gas/configure.tgt b/gas/configure.tgt +--- a/gas/configure.tgt 2025-11-10 01:00:00.000000000 +0100 ++++ b/gas/configure.tgt 2025-12-11 14:17:04.656682621 +0100 @@ -130,6 +130,7 @@ case ${generic_target} in aarch64*-*-fuchsia*) fmt=elf;; aarch64*-*-haiku*) fmt=elf em=haiku ;; aarch64*-*-genode*) fmt=elf;; -+ aarch64*-*-l4re*) fmt=elf;; ++ aarch64*-*-l4re*) fmt=elf em=l4re;; aarch64*-*-linux*) fmt=elf em=linux case ${cpu}-${os} in aarch64*-linux-gnu_ilp32) arch=aarch64:32 ;; -@@ -150,7 +151,7 @@ case ${generic_target} in +@@ -169,6 +170,7 @@ case ${generic_target} in + arm-*-pe) fmt=coff em=pe ;; + arm-*-fuchsia*) fmt=elf ;; + arm-*-haiku*) fmt=elf em=haiku ;; ++ arm-*-l4re*) fmt=elf em=arml4reeabi ;; - arm-*-phoenix*) fmt=elf ;; - arm-*-elf) fmt=elf ;; -- arm-*-eabi* | arm-*-rtems* | arm-*-genode*) fmt=elf em=armeabi ;; -+ arm-*-eabi* | arm-*-rtems* | arm-*-genode* | arm-*-l4re*) fmt=elf em=armeabi ;; - arm-*-kaos*) fmt=elf ;; - arm-*-conix*) fmt=elf ;; - arm-*-freebsd[89].* | armeb-*-freebsd[89].*) -@@ -232,6 +233,7 @@ case ${generic_target} in + avr-*-*) fmt=elf bfd_gas=yes ;; + +@@ -232,6 +234,7 @@ case ${generic_target} in i386-*-fuchsia*) fmt=elf ;; i386-*-haiku*) fmt=elf em=haiku ;; i386-*-genode*) fmt=elf ;; -+ i386-*-l4re*) fmt=elf ;; ++ i386-*-l4re*) fmt=elf em=l4re ;; i386-*-bsd*) fmt=aout em=386bsd ;; i386-*-netbsd*-gnu* | \ i386-*-knetbsd*-gnu | \ -diff --git a/ld/Makefile.am b/ld/Makefile.am -index 6a9833e5775..62db5a687b9 100644 ---- a/ld/Makefile.am -+++ b/ld/Makefile.am -@@ -168,6 +168,7 @@ ALL_EMULATION_SOURCES = \ - earmelf_fbsd.c \ - earmelf_fuchsia.c \ - earmelf_haiku.c \ -+ earmelf_l4re.c \ - earmelf_linux.c \ - earmelf_linux_eabi.c \ - earmelf_linux_fdpiceabi.c \ -diff --git a/ld/Makefile.in b/ld/Makefile.in -index 8639e782cdf..01bae52a9ba 100644 ---- a/ld/Makefile.in -+++ b/ld/Makefile.in -@@ -679,6 +679,7 @@ ALL_EMULATION_SOURCES = \ - earmelf_fbsd.c \ - earmelf_fuchsia.c \ - earmelf_haiku.c \ -+ earmelf_l4re.c \ - earmelf_linux.c \ - earmelf_linux_eabi.c \ - earmelf_linux_fdpiceabi.c \ -@@ -1303,6 +1304,7 @@ distclean-compile: - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fbsd.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fuchsia.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_haiku.Po@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_l4re.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_eabi.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_fdpiceabi.Po@am__quote@ -diff --git a/ld/configure.tgt b/ld/configure.tgt -index f937f78b876..ff858bb909b 100644 ---- a/ld/configure.tgt -+++ b/ld/configure.tgt -@@ -98,6 +98,9 @@ aarch64-*-freebsd*) targ_emul=aarch64fbsd +diff -Nurp a/ld/configure.tgt b/ld/configure.tgt +--- a/ld/configure.tgt 2025-11-10 01:00:00.000000000 +0100 ++++ b/ld/configure.tgt 2025-12-11 13:34:38.706376257 +0100 +@@ -98,6 +98,9 @@ aarch64-*-freebsd*) targ_emul=aarch64fbs aarch64-*-fuchsia*) targ_emul=aarch64elf targ_extra_emuls="aarch64elfb armelf armelfb" ;; @@ -133,7 +168,7 @@ index f937f78b876..ff858bb909b 100644 aarch64_be-*-linux-gnu_ilp32) targ_emul=aarch64linux32b targ_extra_libpath="aarch64linuxb aarch64linux aarch64linux32 armelfb_linux_eabi armelf_linux_eabi" -@@ -257,6 +260,9 @@ arm*-*-fuchsia*) targ_emul=armelf_fuchsia +@@ -257,6 +260,9 @@ arm*-*-fuchsia*) targ_emul=armelf_fuchsi arm*-*-haiku*) targ_emul=armelf_haiku targ_extra_emuls=armelf ;; @@ -152,7 +187,7 @@ index f937f78b876..ff858bb909b 100644 targ_emul=elf_i386 targ_extra_emuls=elf_iamcu ;; -@@ -1036,7 +1042,7 @@ x86_64-*-netbsd* | x86_64-*-openbsd*) +@@ -1032,7 +1038,7 @@ x86_64-*-netbsd* | x86_64-*-openbsd*) tdir_elf_i386=`echo ${targ_alias} | \ sed -e 's/x86_64/i386/' -e 's/aout//'` ;; @@ -161,15 +196,40 @@ index f937f78b876..ff858bb909b 100644 targ_emul=elf_x86_64 targ_extra_emuls="elf_i386 elf_iamcu elf32_x86_64" targ_extra_libpath="elf_i386 elf_iamcu elf32_x86_64" -diff --git a/ld/emulparams/armelf_l4re.sh b/ld/emulparams/armelf_l4re.sh -new file mode 100644 -index 00000000000..556c65af3a3 ---- /dev/null -+++ b/ld/emulparams/armelf_l4re.sh +diff -Nurp a/ld/emulparams/armelf_l4re.sh b/ld/emulparams/armelf_l4re.sh +--- a/ld/emulparams/armelf_l4re.sh 1970-01-01 01:00:00.000000000 +0100 ++++ b/ld/emulparams/armelf_l4re.sh 2025-12-11 13:34:38.706376257 +0100 @@ -0,0 +1,3 @@ +source_sh ${srcdir}/emulparams/armelf_linux_eabi.sh + +TEXT_START_ADDR=0x01000000 --- -2.39.5 - +diff -Nurp a/ld/Makefile.am b/ld/Makefile.am +--- a/ld/Makefile.am 2025-11-10 01:00:00.000000000 +0100 ++++ b/ld/Makefile.am 2025-12-11 13:34:38.706376257 +0100 +@@ -168,6 +168,7 @@ ALL_EMULATION_SOURCES = \ + earmelf_fbsd.c \ + earmelf_fuchsia.c \ + earmelf_haiku.c \ ++ earmelf_l4re.c \ + earmelf_linux.c \ + earmelf_linux_eabi.c \ + earmelf_linux_fdpiceabi.c \ +diff -Nurp a/ld/Makefile.in b/ld/Makefile.in +--- a/ld/Makefile.in 2025-11-10 01:00:00.000000000 +0100 ++++ b/ld/Makefile.in 2025-12-11 13:34:38.706376257 +0100 +@@ -679,6 +679,7 @@ ALL_EMULATION_SOURCES = \ + earmelf_fbsd.c \ + earmelf_fuchsia.c \ + earmelf_haiku.c \ ++ earmelf_l4re.c \ + earmelf_linux.c \ + earmelf_linux_eabi.c \ + earmelf_linux_fdpiceabi.c \ +@@ -1301,6 +1302,7 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fbsd.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fuchsia.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_haiku.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_l4re.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_eabi.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_fdpiceabi.Po@am__quote@ diff --git a/recipes/devel/compat/cross-toolchain.yaml b/recipes/devel/compat/cross-toolchain.yaml index c4662885..cf75c896 100644 --- a/recipes/devel/compat/cross-toolchain.yaml +++ b/recipes/devel/compat/cross-toolchain.yaml @@ -49,6 +49,6 @@ provideTools: provideVars: # Set some more constrained compiler flags CPPFLAGS: "" - CFLAGS: "-Os -pipe" - CXXFLAGS: "-Os -pipe" - LDFLAGS: "-Wl,-O1" + CFLAGS: "-O2 -pipe" + CXXFLAGS: "-O2 -pipe" + LDFLAGS: "" diff --git a/recipes/devel/compat/gcc.yaml b/recipes/devel/compat/gcc.yaml index cfd92b24..0a0c18e0 100644 --- a/recipes/devel/compat/gcc.yaml +++ b/recipes/devel/compat/gcc.yaml @@ -29,7 +29,8 @@ checkoutScript: | buildTools: [host-toolchain, target-toolchain] buildToolsWeak: [m4] buildVars: [AUTOCONF_BUILD, AUTOCONF_HOST, AUTOCONF_TARGET, - GCC_TARGET_ARCH, GCC_TARGET_FLOAT_ABI, GCC_TARGET_FPU] + GCC_TARGET_ARCH, GCC_TARGET_FLOAT_ABI, GCC_TARGET_FPU, + CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS] buildScript: | GCC_SRC=$1 @@ -150,10 +151,10 @@ multiPackage: TOOLCHAIN_FLAVOUR: gcc # Reset compiler flags - CPPFLAGS: "-Wdate-time" - CFLAGS: "-Os -pipe" - CXXFLAGS: "-Os -pipe" - LDFLAGS: "-Wl,-O1" + CPPFLAGS: "" + CFLAGS: "-O2 -pipe" + CXXFLAGS: "-O2 -pipe" + LDFLAGS: "" cross: depends: diff --git a/recipes/devel/compat/make.yaml b/recipes/devel/compat/make.yaml new file mode 100644 index 00000000..7315c9d4 --- /dev/null +++ b/recipes/devel/compat/make.yaml @@ -0,0 +1,40 @@ +inherit: [cpackage, libtool, install, "basement::update-config"] + +metaEnvironment: + PKG_VERSION: "4.3" + PKG_LICENSE: "GPL-3.0-only" + +checkoutSCM: + scm: url + url: ${GNU_MIRROR}/make/make-${PKG_VERSION}.tar.gz + digestSHA256: "e05fdde47c5f7ca45cb697e973894ff4f5d79e13b750ed57d7b66d8defc78e19" + stripComponents: 1 + +# We do not build make with make. Instead call the manual build script that is +# in the sources for this case after configuring the package. +buildVars: [AR] +buildScript: | + export ac_cv_prog_AR="$AR" + + mkdir -p build install + pushd build + $1/configure \ + ${AUTOCONF_BUILD:+--build=${AUTOCONF_BUILD}} \ + ${AUTOCONF_HOST:+--host=${AUTOCONF_HOST}} \ + ${AUTOCONF_TARGET:+--target=${AUTOCONF_TARGET}} \ + --prefix="/usr" \ + --sysconfdir="/etc" \ + --localstatedir="/var" \ + --libdir=/usr/lib \ + --disable-dependency-tracking \ + --without-guile + $1/build.sh + popd + + mkdir -p install/usr/bin + cp -a build/make install/usr/bin/ + +packageScript: | + installPackageTgt "$1/install/" +provideTools: + make: usr/bin diff --git a/recipes/devel/cross-toolchain.yaml b/recipes/devel/cross-toolchain.yaml index 159eb5b4..2c3f0682 100644 --- a/recipes/devel/cross-toolchain.yaml +++ b/recipes/devel/cross-toolchain.yaml @@ -13,22 +13,20 @@ depends: if: !expr | "$AUTOCONF_BUILD" != get-tool-env("target-toolchain", "AUTOCONF_HOST", "$AUTOCONF_BUILD") -buildVars: [AUTOCONF_TARGET, GCC_LIBC] -buildScript: | - rm -rf * +packageDepends: True +packageVars: [AUTOCONF_TARGET, GCC_LIBC] +packageScript: | cp -an $2/* . cp -an ${BOB_DEP_PATHS[devel::binutils]}/* . mkdir -p usr/sysroots/$AUTOCONF_TARGET/usr/lib if [[ ${GCC_LIBC:+true} ]] ; then - cp -an ${BOB_DEP_PATHS[libs::${GCC_LIBC}]}/* usr/sysroots/$AUTOCONF_TARGET - rsync -aHSK usr/$AUTOCONF_TARGET/lib/ \ - usr/sysroots/$AUTOCONF_TARGET/usr/lib/ \ - --include '*.so.*' \ - --exclude '*' + cp -an ${BOB_DEP_PATHS[libs::${GCC_LIBC}]}/* usr/sysroots/$AUTOCONF_TARGET + # Hard link shared libs to sysroot to save space. + if compgen -G "usr/$AUTOCONF_TARGET/lib/"*.so.* >/dev/null ; then + cp -dl "usr/$AUTOCONF_TARGET/lib/"*.so.* usr/sysroots/$AUTOCONF_TARGET/usr/lib/ + fi fi -packageScript: | - cp -a $1/* . # Remove debug symbols of host executables. We don't care if the toolchain # crashes. The target architecture symbols need to be retained, though... find usr/bin usr/libexec -type d -name .debug | xargs /bin/rm -rf @@ -38,8 +36,7 @@ packageScript: | # for these scripts... pushd usr/bin - GCC_INSTALL_DIR_REL=$(realpath --relative-to=.\ - "$("./${AUTOCONF_TARGET}-gcc" -print-search-dirs | sed -n -e 's/^install: \(.*\)/\1/p')") + GCC_INSTALL_DIR_REL=$(find .. -name libgcc.a -printf '%h') for i in clang clang-cpp clang++ ; do cat > "$AUTOCONF_TARGET-$i" << EOF @@ -179,6 +176,13 @@ multiPackage: GCC_LIBC: "glibc" GCC_ENABLE_LANGUAGES: "c,c++,ada" + x86_64-w64-mingw32: + environment: + AUTOCONF_TARGET: "x86_64-w64-mingw32" + ARCH: "x86_64" + GCC_LIBC: "mingw-w64" + GCC_EXTRA_OPTIONS: "--disable-sjlj-exceptions --enable-fully-dynamic-string" + # ARMv7 Linux CortexA toolchain with hard floating point arm-linux-gnueabihf: environment: @@ -195,6 +199,7 @@ multiPackage: ARCH: "arm" GCC_ENABLE_LANGUAGES: "c" GCC_LIBC: "newlib" + GCC_MULTILIB: "aprofile,rmprofile" aarch64-l4re: environment: diff --git a/recipes/devel/flex/0003-match-malloc-signature-to-its-use.patch b/recipes/devel/flex/0003-match-malloc-signature-to-its-use.patch new file mode 100644 index 00000000..b6083517 --- /dev/null +++ b/recipes/devel/flex/0003-match-malloc-signature-to-its-use.patch @@ -0,0 +1,22 @@ +From bf254c75b1e0d2641ebbd7fc85fb183f36a62ea7 Mon Sep 17 00:00:00 2001 +From: Richard Barnes +Date: Wed, 2 Oct 2024 10:35:09 -0700 +Subject: [PATCH] Match `malloc` signature to its use + +--- + lib/malloc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/malloc.c b/lib/malloc.c +index 75e8ef97c..701b9b39d 100755 +--- a/lib/malloc.c ++++ b/lib/malloc.c +@@ -3,7 +3,7 @@ + + #include + +- void *malloc (); ++ void *malloc (size_t n); + + /* Allocate an N-byte block of memory from the heap. + If N is zero, allocate a 1-byte block. */ diff --git a/recipes/devel/gcc.yaml b/recipes/devel/gcc.yaml index 31ac0327..f4fff68a 100644 --- a/recipes/devel/gcc.yaml +++ b/recipes/devel/gcc.yaml @@ -1,7 +1,7 @@ inherit: [autoconf, make, patch, install, "basement::update-config"] metaEnvironment: - PKG_VERSION: "13.4.0" + PKG_VERSION: "14.3.0" PKG_LICENSE: "GPL-3.0-with-GCC-exception" depends: @@ -55,8 +55,7 @@ Config: checkoutSCM: scm: url url: ${GNU_MIRROR}/gcc/gcc-${PKG_VERSION}/gcc-${PKG_VERSION}.tar.xz - digestSHA512: "9b4b83ecf51ef355b868608b8d257b2fa435c06d2719cb86657a7c2c2a0828f\ - f4ce04e9bac1055bbcad8ed5b4da524cafaef654785e23a50233d95d89201e35f" + digestSHA256: "e0dc77297625631ac8e50fa92fffefe899a4eb702592da5c32ef04e2293aca3a" stripComponents: 1 checkoutDeterministic: True @@ -65,7 +64,8 @@ checkoutScript: | buildVars: [AUTOCONF_BUILD, AUTOCONF_HOST, AUTOCONF_TARGET, GCC_TARGET_ABI, GCC_TARGET_ARCH, GCC_TARGET_FLOAT_ABI, GCC_TARGET_FPU, - GCC_MULTILIB, GCC_EXTRA_OPTIONS] + GCC_MULTILIB, GCC_EXTRA_OPTIONS, + CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS] buildToolsWeak: [m4] buildScript: | GCC_SRC=$(pwd)/src @@ -87,11 +87,12 @@ buildScript: | --host=${AUTOCONF_HOST:-${AUTOCONF_BUILD}} \ --target=${AUTOCONF_TARGET:-${AUTOCONF_HOST:-${AUTOCONF_BUILD}}} \ --prefix=/usr \ + --with-bugurl=https://github.com/BobBuildTool/basement/issues \ + --enable-checking=release \ ${GCC_TARGET_ABI:+--with-abi=$GCC_TARGET_ABI} \ ${GCC_TARGET_ARCH:+--with-arch=$GCC_TARGET_ARCH} \ ${GCC_TARGET_FPU:+--with-fpu=$GCC_TARGET_FPU} \ ${GCC_TARGET_FLOAT_ABI:+--with-float=$GCC_TARGET_FLOAT_ABI} \ - --enable-initfini-array \ ${GCC_EXTRA_OPTIONS:-} \ "${@}" \ --disable-gtk-doc \ @@ -116,6 +117,13 @@ buildScript: | popd } + buildBareGcc() + { + configureGcc "$@" + makeParallel -C build all-gcc all-target-libgcc + makeSequential -C build install-gcc install-target-libgcc DESTDIR="$PWD/install" + } + buildGcc() { configureGcc "$@" @@ -136,26 +144,39 @@ multiPackage: - name: devel::binutils use: [result, tools] - buildTools: [host-native-toolchain, binutils] + - name: libs::mingw-w64-headers + if: "$(eq,${GCC_LIBC},mingw-w64)" + buildTools: [target-toolchain, binutils] buildScript: | - buildGcc \ - --with-glibc-version=2.11 \ - --with-sysroot=/does/not/exist \ - --with-newlib \ - --without-headers \ - --disable-decimal-float \ - --disable-threads \ - --disable-libatomic \ - --disable-libgomp \ - --disable-libmpx \ - --disable-libquadmath \ - --disable-libssp \ - --disable-libvtv \ - --disable-libstdcxx \ - --disable-shared \ - --disable-bootstrap \ + OPTIONS=( + --with-sysroot=/usr/sysroots/${AUTOCONF_TARGET} + --disable-threads + --disable-shared --enable-languages=c,c++ + ${GCC_MULTILIB:+"--with-multilib-list=$GCC_MULTILIB"} + ) + + if [[ ${BOB_DEP_PATHS[libs::mingw-w64-headers]+set} ]] ; then + # Windows/mingw build + OPTIONS+=( + --with-build-sysroot="${BOB_DEP_PATHS[libs::mingw-w64-headers]}" + ) + else + # Linux build + OPTIONS+=( + --with-glibc-version=2.11 + --without-headers + --with-newlib + ) + fi + + buildBareGcc "${OPTIONS[@]}" + cp -a ${BOB_DEP_PATHS[devel::binutils]}/* install/ + if [[ ${BOB_DEP_PATHS[libs::mingw-w64-headers]+set} ]] ; then + mkdir -p install/usr/sysroots/${AUTOCONF_TARGET} + cp -a "${BOB_DEP_PATHS[libs::mingw-w64-headers]}"/* install/usr/sysroots/${AUTOCONF_TARGET}/ + fi packageScript: | installStripAll usr/bin @@ -192,33 +213,16 @@ multiPackage: ARCH: "${ARCH}" AUTOCONF_HOST: "${AUTOCONF_TARGET}" CROSS_COMPILE: "${AUTOCONF_TARGET}-" + TOOLCHAIN_SYSROOT: "../sysroots/${AUTOCONF_TARGET}" TOOLCHAIN_FLAVOUR: gcc # Reset compiler flags - CPPFLAGS: "-Wdate-time" - CFLAGS: "-Os -pipe" - CXXFLAGS: "-Os -pipe" - LDFLAGS: "-Wl,-O1" + CPPFLAGS: "" + CFLAGS: "-O2 -pipe" + CXXFLAGS: "-O2 -pipe" + LDFLAGS: "" cross: - depends: - - name: devel::binutils - use: [result, tools] - - name: devel::gcc-cross-bare - use: [tools] - forward: True - - tools: - target-toolchain: cross-target-toolchain - depends: - - name: libs::glibc - if: "$(eq,${GCC_LIBC},glibc)" - - name: libs::newlib - if: "$(eq,${GCC_LIBC},newlib)" - - name: libs::uclibc-ng - if: "$(eq,${GCC_LIBC},uclibc-ng)" - - name: libs::uclibc-l4re - if: "$(eq,${GCC_LIBC},uclibc-l4re)" - Config: GCC_LIBC: type: choice @@ -228,6 +232,7 @@ multiPackage: newlib: uclibc-ng: uclibc-l4re: + mingw-w64: GCC_ENABLE_LANGUAGES: help: > @@ -256,12 +261,18 @@ multiPackage: ;; esac - configureGcc \ - --with-sysroot=/usr/sysroots/${AUTOCONF_TARGET} \ - --with-build-sysroot=${BOB_DEP_PATHS[libs::${GCC_LIBC}]} \ - --enable-linker-build-id \ - "${OPTIONS[@]}" \ - --enable-languages="${GCC_ENABLE_LANGUAGES:-c,c++}" + # Provide absolute path to target binutils. The gcc configure would + # otherwise search them first at the installation prefix which is + # wrong for us. + export AR_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-ar)" + export AS_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-as)" + export LD_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-ld)" + export NM_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-nm)" + export OBJCOPY_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-objcopy)" + export OBJDUMP_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-objdump)" + export RANLIB_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-ranlib)" + export READELF_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-readelf)" + export STRIP_FOR_TARGET="$(type -p ${AUTOCONF_TARGET}-strip)" packageScript: | installStripAll usr/bin usr/libexec @@ -272,6 +283,7 @@ multiPackage: - libs::newlib - libs::uclibc-ng - libs::uclibc-l4re + - libs::mingw-w64 multiPackage: # Straightforward cross compiler. This is a regular cross compiler @@ -279,14 +291,63 @@ multiPackage: # intended to be used directly but to bootstrap the canadian cross # compiler below. host: - buildTools: [host-native-toolchain] - buildScript: | - makeParallel -C build - makeSequential -C build install DESTDIR="$PWD/install" - provideTools: - # Required by the canadian cross compiler to dump specs. - cross-ambient-toolchain: - path: usr/bin + depends: + - name: devel::binutils + use: [result, tools] + - name: devel::gcc-cross-bare + use: [tools] + forward: True + - &libc-builds + tools: + target-toolchain: cross-target-toolchain + depends: + - name: libs::glibc + if: "$(eq,${GCC_LIBC},glibc)" + - name: libs::newlib + if: "$(eq,${GCC_LIBC},newlib)" + - name: libs::uclibc-ng + if: "$(eq,${GCC_LIBC},uclibc-ng)" + - name: libs::uclibc-l4re + if: "$(eq,${GCC_LIBC},uclibc-l4re)" + - name: libs::mingw-w64 + if: "$(eq,${GCC_LIBC},mingw-w64)" + + buildTools: [target-toolchain] + + multiPackage: + "": + buildScript: | + buildGcc \ + --with-sysroot=/usr/sysroots/${AUTOCONF_TARGET} \ + --with-build-sysroot=${BOB_DEP_PATHS[libs::${GCC_LIBC}]} \ + --enable-linker-build-id \ + "${OPTIONS[@]}" \ + --enable-languages="${GCC_ENABLE_LANGUAGES:-c,c++}" + + toolchain: + buildScript: | + buildBareGcc \ + --with-sysroot=/usr/sysroots/${AUTOCONF_TARGET} \ + --with-build-sysroot=${BOB_DEP_PATHS[libs::${GCC_LIBC}]} \ + --enable-linker-build-id \ + "${OPTIONS[@]}" \ + --enable-languages="${GCC_ENABLE_LANGUAGES:-c,c++}" + + cp -a ${BOB_DEP_PATHS[devel::binutils]}/* install/ + if [[ ${GCC_LIBC:+true} ]] ; then + mkdir -p install/usr/sysroots/${AUTOCONF_TARGET} + cp -an ${BOB_DEP_PATHS[libs::${GCC_LIBC}]}/* install/usr/sysroots/$AUTOCONF_TARGET/ + fi + + packageScript: | + # Remove all debug symbols. It's just an intermediate helper + # toolchain for the final canadian cross compiler... + find -type d -name .debug | xargs /bin/rm -rf + + provideTools: + # Required by the canadian cross compiler to dump specs. + cross-ambient-toolchain: + path: usr/bin # A canadian cross compiler. This uses most of the result of the # native cross compiler above. Only the compiler itself is built as @@ -294,24 +355,28 @@ multiPackage: # compiler. canadian: depends: - - name: devel::gcc-cross-host - # This is very subtle. The devel::gcc-cross-host package - # is tainted and fingerprinted by the host libc version. - # We do now want to inherit this fingerprint but instead - # explicitly cut it because we replace all fingerprinted - # bineries with the canadian cross build. Hence do *not* - # use "result" but instead reference the first-stage - # through "tools" only. - use: [tools] + - name: devel::binutils + use: [] + - tools: + target-toolchain: host-native-toolchain + depends: + - name: devel::binutils + alias: devel::binutils-host-native + use: [tools] + - name: devel::gcc-cross-bare + use: [tools] + forward: True + - *libc-builds + - name: devel::gcc-cross-host-toolchain + use: [tools] buildTools: [host-toolchain, target-toolchain, cross-ambient-toolchain] buildScript: | - cp -a "${BOB_TOOL_PATHS[cross-ambient-toolchain]}/../.."/* install/ - if [[ ${GCC_ENABLE_LANGUAGES:-c,c+} == *"ada"* ]]; then - ADDITIONAL_MAKE=(all-gnattools) - ADDITIONAL_INSTALL=(install-gnattools) - fi - makeParallel -C build all-gcc ${ADDITIONAL_MAKE[@]} - makeSequential -C build install-gcc ${ADDITIONAL_INSTALL[@]} DESTDIR="$PWD/install" + buildGcc \ + --with-sysroot=/usr/sysroots/${AUTOCONF_TARGET} \ + --with-build-sysroot=$(${AUTOCONF_TARGET}-gcc -print-sysroot) \ + --enable-linker-build-id \ + "${OPTIONS[@]}" \ + --enable-languages="${GCC_ENABLE_LANGUAGES:-c,c++}" native: buildTools: [host-toolchain, target-toolchain] diff --git a/recipes/devel/gcc/0001-disable-split-stack-for-non-thread-builds.patch b/recipes/devel/gcc/0001-disable-split-stack-for-non-thread-builds.patch new file mode 100644 index 00000000..e801085d --- /dev/null +++ b/recipes/devel/gcc/0001-disable-split-stack-for-non-thread-builds.patch @@ -0,0 +1,26 @@ +From 4f67134e0b1404fef4ea72342be8fab4c37ca8c8 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb +Date: Mon, 25 Jul 2022 00:29:55 +0200 +Subject: [PATCH] disable split-stack for non-thread builds + +Signed-off-by: Waldemar Brodkorb +[Romain: convert to git format] +Signed-off-by: Romain Naour +--- + libgcc/config/t-stack | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libgcc/config/t-stack b/libgcc/config/t-stack +index cc0366b4cd8..f3f97e86d60 100644 +--- a/libgcc/config/t-stack ++++ b/libgcc/config/t-stack +@@ -1,4 +1,6 @@ + # Makefile fragment to provide generic support for -fsplit-stack. + # This should be used in config.host for any host which supports + # -fsplit-stack. ++ifeq ($(enable_threads),yes) + LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c ++endif +-- +2.34.3 + diff --git a/recipes/devel/gcc/0002-Remove-crypt-and-crypt_r-interceptors.patch b/recipes/devel/gcc/0002-Remove-crypt-and-crypt_r-interceptors.patch deleted file mode 100644 index 98bfed59..00000000 --- a/recipes/devel/gcc/0002-Remove-crypt-and-crypt_r-interceptors.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 3521d93c552a11640a959ee61d551c225981c448 Mon Sep 17 00:00:00 2001 -From: Fangrui Song -Date: Fri, 28 Apr 2023 09:59:17 -0700 -Subject: [PATCH] Remove crypt and crypt_r interceptors - -From Florian Weimer's D144073 - -> On GNU/Linux (glibc), the crypt and crypt_r functions are not part of the main shared object (libc.so.6), but libcrypt (with multiple possible sonames). The sanitizer libraries do not depend on libcrypt, so it can happen that during sanitizer library initialization, no real implementation will be found because the crypt, crypt_r functions are not present in the process image (yet). If its interceptors are called nevertheless, this results in a call through a null pointer when the sanitizer library attempts to forward the call to the real implementation. -> -> Many distributions have already switched to libxcrypt, a library that is separate from glibc and that can be build with sanitizers directly (avoiding the need for interceptors). This patch disables building the interceptor for glibc targets. - -Let's remove crypt and crypt_r interceptors (D68431) to fix issues with -newer glibc. - -For older glibc, msan will not know that an uninstrumented crypt_r call -initializes `data`, so there is a risk for false positives. However, with some -codebase survey, I think crypt_r uses are very few and the call sites typically -have a `memset(&data, 0, sizeof(data));` anyway. - -Fix https://github.com/google/sanitizers/issues/1365 -Related: https://bugzilla.redhat.com/show_bug.cgi?id=2169432 - -Reviewed By: #sanitizers, fweimer, thesamesam, vitalybuka - -Differential Revision: https://reviews.llvm.org/D149403 - -[Thomas: taken from Crosstool-NG] -Upstream: (llvm) https://github.com/llvm/llvm-project/commit/d7bead833631486e337e541e692d9b4a1ca14edd -Upstream: (gcc) https://github.com/gcc-mirror/gcc/commit/d96e14ceb9475f9bccbbc0325d5b11419fad9246 -Signed-off-by: Thomas Petazzoni ---- - .../sanitizer_common_interceptors.inc | 37 ------------------- - .../sanitizer_platform_interceptors.h | 2 - - .../sanitizer_platform_limits_posix.cpp | 8 ---- - .../sanitizer_platform_limits_posix.h | 1 - - 4 files changed, 48 deletions(-) - -diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc -index ba4b80081f0..662c4199742 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc -+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc -@@ -10187,41 +10187,6 @@ INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) { - #define INIT_GETRANDOM - #endif - --#if SANITIZER_INTERCEPT_CRYPT --INTERCEPTOR(char *, crypt, char *key, char *salt) { -- void *ctx; -- COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1); -- char *res = REAL(crypt)(key, salt); -- if (res != nullptr) -- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1); -- return res; --} --#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt); --#else --#define INIT_CRYPT --#endif -- --#if SANITIZER_INTERCEPT_CRYPT_R --INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) { -- void *ctx; -- COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1); -- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1); -- char *res = REAL(crypt_r)(key, salt, data); -- if (res != nullptr) { -- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, -- __sanitizer::struct_crypt_data_sz); -- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1); -- } -- return res; --} --#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r); --#else --#define INIT_CRYPT_R --#endif -- - #if SANITIZER_INTERCEPT_GETENTROPY - INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) { - void *ctx; -@@ -10772,8 +10737,6 @@ static void InitializeCommonInterceptors() { - INIT_GETUSERSHELL; - INIT_SL_INIT; - INIT_GETRANDOM; -- INIT_CRYPT; -- INIT_CRYPT_R; - INIT_GETENTROPY; - INIT_QSORT; - INIT_QSORT_R; -diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h -index 8307b1ec28b..d50166ee6ce 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h -+++ b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h -@@ -571,8 +571,6 @@ - #define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD - #define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID) - #define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD) --#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID) --#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID) - - #define SANITIZER_INTERCEPT_GETRANDOM \ - ((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD) -diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp -index c85cf1626a7..bcbd143d19d 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp -+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp -@@ -176,10 +176,6 @@ typedef struct user_fpregs elf_fpregset_t; - # include "sanitizer_platform_interceptors.h" - # include "sanitizer_platform_limits_posix.h" - --#if SANITIZER_INTERCEPT_CRYPT_R --#include --#endif -- - namespace __sanitizer { - unsigned struct_utsname_sz = sizeof(struct utsname); - unsigned struct_stat_sz = sizeof(struct stat); -@@ -283,10 +279,6 @@ namespace __sanitizer { - unsigned struct_statvfs64_sz = sizeof(struct statvfs64); - #endif // SANITIZER_LINUX && !SANITIZER_ANDROID - --#if SANITIZER_INTERCEPT_CRYPT_R -- unsigned struct_crypt_data_sz = sizeof(struct crypt_data); --#endif -- - #if SANITIZER_LINUX && !SANITIZER_ANDROID - unsigned struct_timex_sz = sizeof(struct timex); - unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds); -diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h -index 44dd3d9e22d..29ebb304a9b 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h -+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h -@@ -319,7 +319,6 @@ extern unsigned struct_msqid_ds_sz; - extern unsigned struct_mq_attr_sz; - extern unsigned struct_timex_sz; - extern unsigned struct_statvfs_sz; --extern unsigned struct_crypt_data_sz; - #endif // SANITIZER_LINUX && !SANITIZER_ANDROID - - struct __sanitizer_iovec { --- -2.43.0 - diff --git a/recipes/devel/gcc/0002-libsanitizer-also-undef-_TIME_BITS-in-sanitizer_proc.patch b/recipes/devel/gcc/0002-libsanitizer-also-undef-_TIME_BITS-in-sanitizer_proc.patch new file mode 100644 index 00000000..b9dfcd0d --- /dev/null +++ b/recipes/devel/gcc/0002-libsanitizer-also-undef-_TIME_BITS-in-sanitizer_proc.patch @@ -0,0 +1,53 @@ +From 71de45698f60f8feabc0e91336f1e2fb387902df Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Thu, 18 Jul 2024 23:13:41 +0200 +Subject: [PATCH] libsanitizer: also undef _TIME_BITS in + sanitizer_procmaps_solaris.cpp + +Upstream commit +https://github.com/llvm/llvm-project/commit/26800a2c7e7996dc773b4e990dd5cca41c45e1a9 +of LLVM added a #undef _TIME_BITS in +libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp to +fix the build on 32-bit Linux platforms that have enabled 64-bit +time_t using _TIME_BITS=64. + +Indeed, _TIME_BITS=64 can only be used when _FILE_OFFSET_BITS=64, but +sanitizer_platform_limits_posix.cpp undefines _FILE_OFFSET_BITS before +including any header file. To fix this, the upstream fix was to also +undef _TIME_BITS. + +This commit simply does the same in sanitizer_procmaps_solaris.cpp, +which also gets compiled under Linux (despite what the file name +says). In practice on Linux hosts (where _TIME_BITS=64 matters), +sanitizer_procmaps_solaris.cpp will expand to nothing, as pretty much +the rest of the file is inside a #ifdef SANITIZER_SOLARIS...#endif. So +the #undef _FILE_OFFSET_BITS and #undef _TIME_BITS are only here +before including sanitizer_platform.h, which will set the +SANITIZER_LINUX/SANITIZER_SOLARIS define depending on the platform. + +Fixes: + +armeb-buildroot-linux-gnueabi/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" + 26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" + +Upstream: https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657811.html +Signed-off-by: Thomas Petazzoni +--- + libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp +index eeb49e2afe3..1b23fd4d512 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp ++++ b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp +@@ -11,6 +11,7 @@ + + // Before Solaris 11.4, doesn't work in a largefile environment. + #undef _FILE_OFFSET_BITS ++#undef _TIME_BITS + #include "sanitizer_platform.h" + #if SANITIZER_SOLARIS + # include +-- +2.45.2 + diff --git a/recipes/devel/gcc/0003-microblaze-add-atomic-test-and-set-support.patch b/recipes/devel/gcc/0003-microblaze-add-atomic-test-and-set-support.patch new file mode 100644 index 00000000..db6aefae --- /dev/null +++ b/recipes/devel/gcc/0003-microblaze-add-atomic-test-and-set-support.patch @@ -0,0 +1,286 @@ +From cd01b277c4a9e03c83427290228e4b289a169431 Mon Sep 17 00:00:00 2001 +From: Gopi Kumar Bulusu +Date: Thu, 10 Jul 2025 12:44:44 +0530 +Subject: [PATCH] MicroBlaze : Enhance support for atomics. Fix PR118280 + +Atomic support enhanced to fix existing atomic_compare_and_swapsi pattern +to handle side effects; new patterns atomic_fetch_op and atomic_test_and_set +added. As MicroBlaze has no QImode test/set instruction, use shift magic +to implement atomic_test_and_set. This fixes PR118280. + +Files Changed + +* gcc/config/microblaze/iterators.md: New +* microblaze-protos.h/microblaze.cc : Add microblaze_subword_address +* gcc/config/microblaze/microblaze.md: constants: Add UNSPECV_CAS_BOOL, + UNSPECV_CAS_MEM, UNSPECV_CAS_VAL, UNSPECV_ATOMIC_FETCH_OP + type: add atomic +* gcc/config/microblaze/sync.md: Add atomic_fetch_si + atomic_test_and_set + +Fixes: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118280 +Upstream: https://patchwork.ozlabs.org/project/gcc/list/?series=466193 + +Signed-off-by: Kirk Meyer +Signed-off-by: David Holsgrove +Signed-off-by: Gopi Kumar Bulusu +--- + gcc/config/microblaze/iterators.md | 25 +++++ + gcc/config/microblaze/microblaze-protos.h | 1 + + gcc/config/microblaze/microblaze.cc | 28 ++++++ + gcc/config/microblaze/microblaze.h | 2 +- + gcc/config/microblaze/microblaze.md | 7 +- + gcc/config/microblaze/sync.md | 107 ++++++++++++++++++---- + 6 files changed, 150 insertions(+), 20 deletions(-) + create mode 100644 gcc/config/microblaze/iterators.md + +diff --git a/gcc/config/microblaze/iterators.md b/gcc/config/microblaze/iterators.md +new file mode 100644 +index 00000000000..2ffc2422a0a +--- /dev/null ++++ b/gcc/config/microblaze/iterators.md +@@ -0,0 +1,25 @@ ++;; Iterator definitions for GCC MicroBlaze machine description files. ++;; Copyright (C) 2012-2024 Free Software Foundation, Inc. ++;; ++;; This file is part of GCC. ++;; ++;; GCC is free software; you can redistribute it and/or modify ++;; it under the terms of the GNU General Public License as published by ++;; the Free Software Foundation; either version 3, or (at your option) ++;; any later version. ++;; ++;; GCC is distributed in the hope that it will be useful, ++;; but WITHOUT ANY WARRANTY; without even the implied warranty of ++;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++;; GNU General Public License for more details. ++;; ++;; You should have received a copy of the GNU General Public License ++;; along with GCC; see the file COPYING3. If not see ++;; . ++ ++; atomics code iterator ++(define_code_iterator any_atomic [plus ior xor and]) ++ ++; atomics code attribute ++(define_code_attr atomic_optab ++ [(plus "add") (ior "or") (xor "xor") (and "and")]) +diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h +index 90b79cfe716..1cee0b3096c 100644 +--- a/gcc/config/microblaze/microblaze-protos.h ++++ b/gcc/config/microblaze/microblaze-protos.h +@@ -62,6 +62,7 @@ extern int symbol_mentioned_p (rtx); + extern int label_mentioned_p (rtx); + extern bool microblaze_cannot_force_const_mem (machine_mode, rtx); + extern void microblaze_eh_return (rtx op0); ++extern void microblaze_subword_address (rtx, rtx *, rtx *); + #endif /* RTX_CODE */ + + /* Declare functions in microblaze-c.cc. */ +diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc +index 2ab5ada4ec9..80d10ab60e0 100644 +--- a/gcc/config/microblaze/microblaze.cc ++++ b/gcc/config/microblaze/microblaze.cc +@@ -1299,6 +1299,34 @@ microblaze_expand_block_move (rtx dest, rtx src, rtx length, rtx align_rtx) + return false; + } + ++/* Compute memory address *aligned_mem and corresponding shift value (*shift) ++ from a QImode memory reference MEM */ ++void ++microblaze_subword_address (rtx mem, rtx *aligned_mem, rtx *shift) ++{ ++ /* Align the memory address to a word. */ ++ rtx addr = force_reg (Pmode, XEXP (mem, 0)); ++ ++ rtx addr_mask = gen_int_mode (-4, Pmode); ++ ++ rtx aligned_addr = gen_reg_rtx (Pmode); ++ ++ emit_move_insn (aligned_addr, gen_rtx_AND (Pmode, addr, addr_mask)); ++ ++ *aligned_mem = change_address (mem, SImode, aligned_addr); ++ ++ /* Calculate the shift amount. */ ++ emit_move_insn (*shift, gen_rtx_AND (SImode, addr, gen_int_mode (3, SImode))); ++ ++ if (TARGET_LITTLE_ENDIAN == 0) { ++ emit_move_insn (*shift, ++ gen_rtx_MINUS (SImode, gen_int_mode (3, SImode), *shift)); ++ } ++ ++ emit_move_insn (*shift, gen_rtx_ASHIFT (SImode, *shift, ++ gen_int_mode (3, SImode))); ++} ++ + static bool + microblaze_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED, + int opno ATTRIBUTE_UNUSED, int *total, +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h +index 2390542434b..b2e9ccde363 100644 +--- a/gcc/config/microblaze/microblaze.h ++++ b/gcc/config/microblaze/microblaze.h +@@ -57,7 +57,7 @@ extern enum pipeline_type microblaze_pipe; + + /* Default target_flags if no switches are specified */ + #define TARGET_DEFAULT (MASK_SOFT_MUL | MASK_SOFT_DIV | MASK_SOFT_FLOAT \ +- | TARGET_ENDIAN_DEFAULT) ++ | TARGET_ENDIAN_DEFAULT) + + /* Do we have CLZ? */ + #define TARGET_HAS_CLZ (TARGET_PATTERN_COMPARE && microblaze_has_clz) +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md +index 45c48a71e8d..270df8da0c5 100644 +--- a/gcc/config/microblaze/microblaze.md ++++ b/gcc/config/microblaze/microblaze.md +@@ -21,6 +21,7 @@ + + (include "constraints.md") + (include "predicates.md") ++(include "iterators.md") + + ;;---------------------------------------------------- + ;; Constants +@@ -43,6 +44,10 @@ + (UNSPEC_TLS 106) ;; jump table + (UNSPEC_SET_TEXT 107) ;; set text start + (UNSPEC_TEXT 108) ;; data text relative ++ (UNSPECV_CAS_BOOL 201) ;; compare and swap (bool) ++ (UNSPECV_CAS_VAL 202) ;; compare and swap (val) ++ (UNSPECV_CAS_MEM 203) ;; compare and swap (mem) ++ (UNSPECV_ATOMIC_FETCH_OP 204) ;; atomic fetch op + ]) + + (define_c_enum "unspec" [ +@@ -79,7 +84,7 @@ + ;; bshift Shift operations + + (define_attr "type" +- "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap" ++ "unknown,branch,jump,call,load,store,move,arith,darith,imul,idiv,icmp,multi,nop,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,bshift,fadd,frsub,fmul,fdiv,fcmp,fsl,fsqrt,fcvt,trap,atomic" + (const_string "unknown")) + + ;; Main data type used by the insn +diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md +index db7b11e5379..6478ab6dcac 100644 +--- a/gcc/config/microblaze/sync.md ++++ b/gcc/config/microblaze/sync.md +@@ -18,26 +18,97 @@ + ;; . + + (define_insn "atomic_compare_and_swapsi" +- [(match_operand:SI 0 "register_operand" "=&d") ;; bool output +- (match_operand:SI 1 "register_operand" "=&d") ;; val output +- (match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory +- (match_operand:SI 3 "register_operand" "d") ;; expected value +- (match_operand:SI 4 "register_operand" "d") ;; desired value +- (match_operand:SI 5 "const_int_operand" "") ;; is_weak +- (match_operand:SI 6 "const_int_operand" "") ;; mod_s +- (match_operand:SI 7 "const_int_operand" "") ;; mod_f ++ [(set (match_operand:SI 0 "register_operand" "=&d") ;; bool output ++ (unspec_volatile:SI ++ [(match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory ++ (match_operand:SI 3 "register_operand" "d") ;; expected value ++ (match_operand:SI 4 "register_operand" "d")] ;; desired value ++ UNSPECV_CAS_BOOL)) ++ (set (match_operand:SI 1 "register_operand" "=&d") ;; val output ++ (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_VAL)) ++ (set (match_dup 2) ++ (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_MEM)) ++ (match_operand:SI 5 "const_int_operand" "") ;; is_weak ++ (match_operand:SI 6 "const_int_operand" "") ;; mod_s ++ (match_operand:SI 7 "const_int_operand" "") ;; mod_f + (clobber (match_scratch:SI 8 "=&d"))] + "" + { +- output_asm_insn ("addc \tr0,r0,r0", operands); +- output_asm_insn ("lwx \t%1,%y2,r0", operands); +- output_asm_insn ("addic\t%8,r0,0", operands); +- output_asm_insn ("bnei \t%8,.-8", operands); +- output_asm_insn ("cmp \t%0,%1,%3", operands); +- output_asm_insn ("bnei \t%0,.+16", operands); +- output_asm_insn ("swx \t%4,%y2,r0", operands); +- output_asm_insn ("addic\t%8,r0,0", operands); +- output_asm_insn ("bnei \t%8,.-28", operands); +- return ""; ++ return "add \t%0,r0,r0\n\t" ++ "lwx \t%1,%y2,r0\n\t" ++ "addic\t%8,r0,0\n\t" ++ "bnei \t%8,.-8\n\t" ++ "cmp \t%8,%1,%3\n\t" ++ "bnei \t%8,.+20\n\t" ++ "swx \t%4,%y2,r0\n\t" ++ "addic\t%8,r0,0\n\t" ++ "bnei \t%8,.-28\n\t" ++ "addi \t%0,r0,1"; + } ++ [(set_attr "type" "atomic") ++ (set_attr "mode" "SI") ++ (set_attr "length" "40")] + ) ++ ++;; ++;; ++;; ++;; ++(define_insn "atomic_fetch_si" ++ [(set (match_operand:SI 0 "register_operand" "=&d") ++ (match_operand:SI 1 "memory_operand" "+Q")) ++ (set (match_dup 1) ++ (unspec_volatile:SI ++ [(any_atomic:SI (match_dup 1) ++ (match_operand:SI 2 "register_operand" "d")) ++ (match_operand:SI 3 "const_int_operand")] ;; model ++ UNSPECV_ATOMIC_FETCH_OP)) ++ (clobber (match_scratch:SI 4 "=&d"))] ;; tmp_1 ++ "" ++ { ++ return ++ "lwx \t%0,%y1,r0\n\t" ++ "addic\t%4,r0,0\n\t" ++ "bnei \t%4,.-8\n\t" ++ "\t%4,%0,%2\n\t" ++ "swx \t%4,%y1,r0\n\t" ++ "addic\t%4,r0,0\n\t" ++ "bnei \t%4,.-24"; ++ } ++ [(set_attr "type" "atomic") ++ (set_attr "mode" "SI") ++ (set_attr "length" "28")]) ++ ++;; ++;; MicroBlaze only supports lx/sx instructions for word mode only ++;; ++;; Use shift|mask magic to implement atomic_test_and_set using lwx/swx ++;; ++(define_expand "atomic_test_and_set" ++ [(match_operand:QI 0 "register_operand" "") ;; bool output ++ (match_operand:QI 1 "memory_operand" "m") ;; memory ++ (match_operand:SI 2 "const_int_operand" "")] ;; model ++ "" ++{ ++ rtx old = gen_reg_rtx (SImode); ++ rtx mem = operands[1]; ++ rtx model = operands[2]; ++ rtx set = gen_reg_rtx (SImode); ++ rtx aligned_mem = gen_reg_rtx (SImode); ++ rtx shift = gen_reg_rtx (SImode); ++ ++ microblaze_subword_address (mem, &aligned_mem, &shift); ++ ++ emit_move_insn (set, GEN_INT (1)); ++ rtx shifted_set = gen_reg_rtx (SImode); ++ ++ emit_move_insn (shifted_set, gen_rtx_ASHIFT (SImode, set, shift)); ++ ++ emit_insn (gen_atomic_fetch_orsi (old, aligned_mem, shifted_set, model)); ++ ++ emit_move_insn (old, gen_rtx_ASHIFTRT (SImode, old, shift)); ++ ++ emit_move_insn (operands[0], gen_lowpart (QImode, old)); ++ ++ DONE; ++}) +-- +2.43.5 + diff --git a/recipes/devel/gcc/0004-libsanitizer-Fix-build-with-glibc-2.42.patch b/recipes/devel/gcc/0004-libsanitizer-Fix-build-with-glibc-2.42.patch new file mode 100644 index 00000000..13f7f469 --- /dev/null +++ b/recipes/devel/gcc/0004-libsanitizer-Fix-build-with-glibc-2.42.patch @@ -0,0 +1,81 @@ +From d32ece49d32b00448d967e7dbc6900fb25cbc775 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Fri, 2 May 2025 17:41:43 +0200 +Subject: [PATCH] libsanitizer: Fix build with glibc 2.42 + +The termio structure will be removed from glibc 2.42. It has +been deprecated since the late 80s/early 90s. + +Cherry-picked from LLVM commit 59978b21ad9c65276ee8e14f26759691b8a65763 +("[sanitizer_common] Remove interceptors for deprecated struct termio +(#137403)"). + +Co-Authored-By: Tom Stellard + +libsanitizer/ + + * sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry + picked from LLVM commit 59978b21ad9c65276ee8e14f26759691b8a65763. + * sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise. + * sanitizer_common/sanitizer_platform_limits_posix.h: Likewise. + +Upstream: 1789c57dc97ea2f9819ef89e28bf17208b6208e7 (gcc master branch) +Upstream: d32ece49d32b00448d967e7dbc6900fb25cbc775 (gcc 15.x branch) +Signed-off-by: Thomas Petazzoni +--- + .../sanitizer_common_interceptors_ioctl.inc | 8 -------- + .../sanitizer_common/sanitizer_platform_limits_posix.cpp | 3 --- + .../sanitizer_common/sanitizer_platform_limits_posix.h | 1 - + 3 files changed, 12 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +index 49ec4097c90..dda11daa77f 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc ++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +@@ -338,17 +338,9 @@ static void ioctl_table_fill() { + _(SOUND_PCM_WRITE_CHANNELS, WRITE, sizeof(int)); + _(SOUND_PCM_WRITE_FILTER, WRITE, sizeof(int)); + _(TCFLSH, NONE, 0); +-#if SANITIZER_GLIBC +- _(TCGETA, WRITE, struct_termio_sz); +-#endif + _(TCGETS, WRITE, struct_termios_sz); + _(TCSBRK, NONE, 0); + _(TCSBRKP, NONE, 0); +-#if SANITIZER_GLIBC +- _(TCSETA, READ, struct_termio_sz); +- _(TCSETAF, READ, struct_termio_sz); +- _(TCSETAW, READ, struct_termio_sz); +-#endif + _(TCSETS, READ, struct_termios_sz); + _(TCSETSF, READ, struct_termios_sz); + _(TCSETSW, READ, struct_termios_sz); +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +index c87d5ef42c9..7bbc6f2edac 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -485,9 +485,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned struct_input_id_sz = sizeof(struct input_id); + unsigned struct_mtpos_sz = sizeof(struct mtpos); + unsigned struct_rtentry_sz = sizeof(struct rtentry); +-#if SANITIZER_GLIBC || SANITIZER_ANDROID +- unsigned struct_termio_sz = sizeof(struct termio); +-#endif + unsigned struct_vt_consize_sz = sizeof(struct vt_consize); + unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes); + unsigned struct_vt_stat_sz = sizeof(struct vt_stat); +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index c07f7cd0b0d..a80df656826 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -1029,7 +1029,6 @@ extern unsigned struct_hd_geometry_sz; + extern unsigned struct_input_absinfo_sz; + extern unsigned struct_input_id_sz; + extern unsigned struct_mtpos_sz; +-extern unsigned struct_termio_sz; + extern unsigned struct_vt_consize_sz; + extern unsigned struct_vt_sizes_sz; + extern unsigned struct_vt_stat_sz; +-- +2.50.1 + diff --git a/recipes/devel/gcc/0001-squash-multilib-libdir-suffix.patch b/recipes/devel/gcc/0100-squash-multilib-libdir-suffix.patch similarity index 100% rename from recipes/devel/gcc/0001-squash-multilib-libdir-suffix.patch rename to recipes/devel/gcc/0100-squash-multilib-libdir-suffix.patch diff --git a/recipes/devel/gcc/0003-libtool-add-support-for-L4Re.patch b/recipes/devel/gcc/0101-libtool-add-support-for-L4Re.patch similarity index 100% rename from recipes/devel/gcc/0003-libtool-add-support-for-L4Re.patch rename to recipes/devel/gcc/0101-libtool-add-support-for-L4Re.patch diff --git a/recipes/devel/gcc/0004-gcc-add-arch-specific-system-header-dir.patch b/recipes/devel/gcc/0102-gcc-add-arch-specific-system-header-dir.patch similarity index 100% rename from recipes/devel/gcc/0004-gcc-add-arch-specific-system-header-dir.patch rename to recipes/devel/gcc/0102-gcc-add-arch-specific-system-header-dir.patch diff --git a/recipes/devel/gcc/0005-Add-L4Re-support.patch b/recipes/devel/gcc/0103-Add-L4Re-support.patch similarity index 71% rename from recipes/devel/gcc/0005-Add-L4Re-support.patch rename to recipes/devel/gcc/0103-Add-L4Re-support.patch index c50f32e2..08dcbd83 100644 --- a/recipes/devel/gcc/0005-Add-L4Re-support.patch +++ b/recipes/devel/gcc/0103-Add-L4Re-support.patch @@ -1,129 +1,37 @@ -From 10325d65d1422c53b6eebf842cb5aedd91194c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= Date: Mon, 12 May 2025 17:01:30 +0200 Subject: [PATCH 5/5] Add L4Re support -So far for Arm, AArch64, i386 and x86_64. ---- - gcc/config.gcc | 31 ++++++++++++++- - gcc/config.host | 5 ++- - gcc/config/l4re.h | 69 ++++++++++++++++++++++++++++++++++ - gcc/config/l4re.opt | 32 ++++++++++++++++ - gcc/configure.ac | 2 +- - libgcc/config.host | 29 ++++++++++++++ - libgcc/config/arm/unwind-arm.h | 2 +- - libstdc++-v3/configure.host | 3 ++ - libstdc++-v3/crossconfig.m4 | 9 +++++ - 9 files changed, 176 insertions(+), 6 deletions(-) - create mode 100644 gcc/config/l4re.h - create mode 100644 gcc/config/l4re.opt - -diff --git a/gcc/config.gcc b/gcc/config.gcc -index ae332a88768..49c4b96f986 100644 ---- a/gcc/config.gcc -+++ b/gcc/config.gcc -@@ -843,6 +843,21 @@ case ${target} in - *-*-fuchsia*) - native_system_header_dir=/include - ;; -+*-*-l4re*) -+ extra_options="$extra_options l4re.opt" -+ gas=yes -+ gnu_ld=yes -+ default_use_cxa_atexit=yes -+ tmake_file="t-slibgcc" -+ case ${enable_threads} in -+ "" | yes | posix) thread_file='posix' ;; -+ no) ;; -+ *) -+ echo 'Unknown thread configuration for L4Re' -+ exit 1 -+ ;; -+ esac -+ ;; - *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) - extra_options="$extra_options gnu-user.opt" - gas=yes -@@ -1126,7 +1141,7 @@ case ${target} in - esac - - case ${target} in --aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) -+aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems* | aarch64*-*-l4re*) - tm_file="${tm_file} elfos.h newlib-stdint.h" - tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" - tmake_file="${tmake_file} aarch64/t-aarch64" -@@ -1137,6 +1152,9 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) - aarch64-*-fuchsia*) - tm_file="${tm_file} fuchsia.h" - ;; -+ aarch64-*-l4re*) -+ tm_file="${tm_file} l4re.h" -+ ;; - aarch64-*-rtems*) - tm_file="${tm_file} aarch64/rtems.h rtems.h" - tmake_file="${tmake_file} aarch64/t-aarch64-rtems" -@@ -1399,7 +1417,7 @@ arm*-*-phoenix*) - tmake_file="${tmake_file} arm/t-arm arm/t-bpabi arm/t-phoenix" - target_cpu_cname="arm7tdmi" - ;; --arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*) -+arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia* | arm*-*-l4re*) - case ${target} in - arm*eb-*-eabi*) - tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" -@@ -1419,6 +1437,11 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*) - tmake_file="${tmake_file} arm/t-bpabi arm/t-fuchsia" - target_cpu_cname="generic-armv7-a" - ;; -+ arm*-*-l4re*) -+ tm_file="${tm_file} l4re.h glibc-stdint.h" -+ tmake_file="${tmake_file} arm/t-bpabi" -+ target_cpu_cname="generic-armv7-a" -+ ;; - arm*-*-rtems*) - tm_file="${tm_file} arm/rtems.h rtems.h newlib-stdint.h" - tmake_file="${tmake_file} arm/t-bpabi arm/t-rtems" -@@ -2219,6 +2242,10 @@ x86_64-*-fuchsia*) - tmake_file="${tmake_file} i386/t-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 fuchsia.h" - ;; -+x86_64-*-l4re*) -+ tmake_file="${tmake_file} i386/t-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 l4re.h" -+ ;; - ia64*-*-elf*) - tm_file="${tm_file} elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h" - tmake_file="ia64/t-ia64" -diff --git a/gcc/config.host b/gcc/config.host -index 21a988e6376..2ee81a0b9a4 100644 ---- a/gcc/config.host -+++ b/gcc/config.host -@@ -100,7 +100,7 @@ esac - - case ${host} in - aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\ -- aarch64*-*-darwin*) -+ aarch64*-*-darwin* | aarch64*-*-l4re*) - case ${target} in - aarch64*-*-*) - host_extra_gcc_objs="driver-aarch64.o" -@@ -108,7 +108,8 @@ case ${host} in - ;; - esac - ;; -- arm*-*-freebsd* | arm*-*-netbsd* | arm*-*-linux* | arm*-*-fuchsia*) -+ arm*-*-freebsd* | arm*-*-netbsd* | arm*-*-linux* | arm*-*-fuchsia* |\ -+ arm*-*-l4re*) - case ${target} in - arm*-*-*) - host_extra_gcc_objs="driver-arm.o" -diff --git a/gcc/config/l4re.h b/gcc/config/l4re.h -new file mode 100644 -index 00000000000..e1dc638a9be ---- /dev/null -+++ b/gcc/config/l4re.h -@@ -0,0 +1,69 @@ +diff -Nurp a/gcc/config/i386/l4re64.h b/gcc/config/i386/l4re64.h +--- a/gcc/config/i386/l4re64.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/gcc/config/i386/l4re64.h 2025-12-12 10:56:34.558135410 +0100 +@@ -0,0 +1,22 @@ ++#ifdef TARGET_LIBC_PROVIDES_SSP ++/* i386 uclibc provides __stack_chk_guard in %gs:0x14, ++ x86_64 uclibc provides it in %fs:0x28. */ ++#define TARGET_THREAD_SSP_OFFSET \ ++ (TARGET_64BIT ? 0x28 : 0x14) ++#endif ++ ++// The same as in gcc/config/l4re.h but with emulation overrides... ++#undef LINK_SPEC ++#define LINK_SPEC "\ ++ %{m32:-m elf_i386}%{m64:-m elf_x86_64} \ ++ %{shared:-shared} \ ++ %{!shared: \ ++ %{!static: \ ++ %{!static-pie: \ ++ %{rdynamic:-export-dynamic} \ ++ -dynamic-linker=/rom/libld-l4.so.1}} \ ++ %{static:-static} \ ++ %{static-pie:-static -pie --no-dynamic-linker -z text}}" ++ ++#undef MULTILIB_DEFAULTS ++#define MULTILIB_DEFAULTS { "m64" } +diff -Nurp a/gcc/config/l4re.h b/gcc/config/l4re.h +--- a/gcc/config/l4re.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/gcc/config/l4re.h 2025-12-12 10:58:45.131911725 +0100 +@@ -0,0 +1,70 @@ +/* The GNU C++ standard library requires that these macros be defined. */ +#undef CPLUSPLUS_CPP_SPEC +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" @@ -155,14 +63,15 @@ index 00000000000..e1dc638a9be +#endif + +#undef LINK_SPEC -+#define LINK_SPEC \ -+ "%{static:-Bstatic} " \ -+ "%{shared:-shared} " \ -+ "%{symbolic:-Bsymbolic} " \ -+ "%{!static:%{!static-pie: \ -+ %{rdynamic:-export-dynamic} \ -+ %{!shared:-dynamic-linker=rom/libld-l4.so.1}}} " \ -+ "%{static-pie:-Bstatic -pie --no-dynamic-linker -z text}" ++#define LINK_SPEC "\ ++ %{shared:-shared} \ ++ %{!shared: \ ++ %{!static: \ ++ %{!static-pie: \ ++ %{rdynamic:-export-dynamic} \ ++ -dynamic-linker=/rom/libld-l4.so.1}} \ ++ %{static:-static} \ ++ %{static-pie:-static -pie --no-dynamic-linker -z text}}" + +#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \ + "%{static|static-pie:--start-group} %G %{!nolibc:%L} \ @@ -193,11 +102,9 @@ index 00000000000..e1dc638a9be + +/* Add .note.GNU-stack special section */ +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack -diff --git a/gcc/config/l4re.opt b/gcc/config/l4re.opt -new file mode 100644 -index 00000000000..efbbeea4e58 ---- /dev/null -+++ b/gcc/config/l4re.opt +diff -Nurp a/gcc/config/l4re.opt b/gcc/config/l4re.opt +--- a/gcc/config/l4re.opt 1970-01-01 01:00:00.000000000 +0100 ++++ b/gcc/config/l4re.opt 2025-12-10 10:20:21.698610717 +0100 @@ -0,0 +1,32 @@ +; Options for systems using l4re.h. + @@ -231,11 +138,113 @@ index 00000000000..efbbeea4e58 +Driver + +; This comment is to ensure we retain the blank line above. -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 4fd323483d2..22d3f617408 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -6863,7 +6863,7 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library, +diff -Nurp a/gcc/config/l4re.opt.urls b/gcc/config/l4re.opt.urls +--- a/gcc/config/l4re.opt.urls 1970-01-01 01:00:00.000000000 +0100 ++++ b/gcc/config/l4re.opt.urls 2025-12-10 10:20:21.698610717 +0100 +@@ -0,0 +1 @@ ++; TODO +diff -Nurp a/gcc/config.gcc b/gcc/config.gcc +--- a/gcc/config.gcc 2025-05-23 13:02:04.272197204 +0200 ++++ b/gcc/config.gcc 2025-12-11 15:47:47.242270520 +0100 +@@ -884,6 +884,21 @@ case ${target} in + rust_target_objs="${rust_target_objs} fuchsia-rust.o" + target_has_targetrustm=yes + ;; ++*-*-l4re*) ++ extra_options="$extra_options l4re.opt" ++ gas=yes ++ gnu_ld=yes ++ default_use_cxa_atexit=yes ++ tmake_file="t-slibgcc" ++ case ${enable_threads} in ++ "" | yes | posix) thread_file='posix' ;; ++ no) ;; ++ *) ++ echo 'Unknown thread configuration for L4Re' ++ exit 1 ++ ;; ++ esac ++ ;; + *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) + extra_options="$extra_options gnu-user.opt" + gas=yes +@@ -1189,7 +1204,7 @@ case ${target} in + esac + + case ${target} in +-aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) ++aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems* | aarch64*-*-l4re*) + tm_file="${tm_file} elfos.h newlib-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" + tmake_file="${tmake_file} aarch64/t-aarch64" +@@ -1200,6 +1215,9 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | a + aarch64-*-fuchsia*) + tm_file="${tm_file} fuchsia.h" + ;; ++ aarch64-*-l4re*) ++ tm_file="${tm_file} l4re.h" ++ ;; + aarch64-*-rtems*) + tm_file="${tm_file} aarch64/rtems.h rtems.h" + tmake_file="${tmake_file} aarch64/t-aarch64-rtems" +@@ -1468,7 +1486,7 @@ arm*-*-phoenix*) + tmake_file="${tmake_file} arm/t-arm arm/t-bpabi arm/t-phoenix" + target_cpu_cname="arm7tdmi" + ;; +-arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*) ++arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia* | arm*-*-l4re*) + case ${target} in + arm*eb-*-eabi*) + tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" +@@ -1488,6 +1506,11 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm* + tmake_file="${tmake_file} arm/t-bpabi arm/t-fuchsia" + target_cpu_cname="generic-armv7-a" + ;; ++ arm*-*-l4re*) ++ tm_file="${tm_file} l4re.h glibc-stdint.h" ++ tmake_file="${tmake_file} arm/t-bpabi" ++ target_cpu_cname="generic-armv7-a" ++ ;; + arm*-*-rtems*) + tm_file="${tm_file} arm/rtems.h rtems.h newlib-stdint.h" + tmake_file="${tmake_file} arm/t-bpabi arm/t-rtems" +@@ -2288,6 +2311,10 @@ x86_64-*-fuchsia*) + tmake_file="${tmake_file} i386/t-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 fuchsia.h" + ;; ++x86_64-*-l4re*) ++ tmake_file="${tmake_file} i386/t-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 l4re.h i386/l4re64.h" ++ ;; + ia64*-*-elf*) + tm_file="${tm_file} elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h" + tmake_file="ia64/t-ia64" +diff -Nurp a/gcc/config.host b/gcc/config.host +--- a/gcc/config.host 2025-05-23 13:02:04.272197204 +0200 ++++ b/gcc/config.host 2025-12-10 10:20:21.698610717 +0100 +@@ -100,7 +100,7 @@ esac + + case ${host} in + aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\ +- aarch64*-*-darwin*) ++ aarch64*-*-darwin* | aarch64*-*-l4re*) + case ${target} in + aarch64*-*-*) + host_extra_gcc_objs="driver-aarch64.o" +@@ -108,7 +108,8 @@ case ${host} in + ;; + esac + ;; +- arm*-*-freebsd* | arm*-*-netbsd* | arm*-*-linux* | arm*-*-fuchsia*) ++ arm*-*-freebsd* | arm*-*-netbsd* | arm*-*-linux* | arm*-*-fuchsia* |\ ++ arm*-*-l4re*) + case ${target} in + arm*-*-*) + host_extra_gcc_objs="driver-arm.o" +diff -Nurp a/gcc/configure.ac b/gcc/configure.ac +--- a/gcc/configure.ac 2025-05-23 13:02:04.504200864 +0200 ++++ b/gcc/configure.ac 2025-12-10 10:20:21.698610717 +0100 +@@ -7032,7 +7032,7 @@ AC_CACHE_CHECK(__stack_chk_fail in targe # realistically usable GNU/Hurd configurations. # All supported versions of musl provide it as well gcc_cv_libc_provides_ssp=yes;; @@ -244,11 +253,22 @@ index 4fd323483d2..22d3f617408 100644 AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], [echo "no __stack_chk_fail on this target"]) ;; -diff --git a/libgcc/config.host b/libgcc/config.host -index 8621de4f638..b776aa5e50b 100644 ---- a/libgcc/config.host -+++ b/libgcc/config.host -@@ -281,6 +281,10 @@ case ${host} in +diff -Nurp a/libgcc/config/arm/unwind-arm.h b/libgcc/config/arm/unwind-arm.h +--- a/libgcc/config/arm/unwind-arm.h 2025-05-23 13:02:08.176258788 +0200 ++++ b/libgcc/config/arm/unwind-arm.h 2025-12-10 10:20:21.698610717 +0100 +@@ -74,7 +74,7 @@ static inline _Unwind_Ptr _Unwind_gnu_Fi + tmp += _Unwind_gnu_Find_got (ptr); + tmp = *(_Unwind_Word *) tmp; + #elif (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \ +- || defined(__FreeBSD__) || defined(__fuchsia__) ++ || defined(__FreeBSD__) || defined(__fuchsia__) || defined(__l4re__) + /* Pc-relative indirect. */ + #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect) + tmp += ptr; +diff -Nurp a/libgcc/config.host b/libgcc/config.host +--- a/libgcc/config.host 2025-05-23 13:02:08.168258662 +0200 ++++ b/libgcc/config.host 2025-12-10 10:20:21.698610717 +0100 +@@ -310,6 +310,10 @@ case ${host} in tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia" extra_parts="crtbegin.o crtend.o" ;; @@ -259,7 +279,7 @@ index 8621de4f638..b776aa5e50b 100644 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux" extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" -@@ -416,6 +420,13 @@ aarch64*-*-fuchsia*) +@@ -445,6 +449,13 @@ aarch64*-*-fuchsia*) tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" tmake_file="${tmake_file} t-dfprules" ;; @@ -273,7 +293,7 @@ index 8621de4f638..b776aa5e50b 100644 aarch64*-*-linux*) extra_parts="$extra_parts crtfastmath.o" md_unwind_header=aarch64/linux-unwind.h -@@ -492,6 +503,12 @@ arm*-*-fuchsia*) +@@ -531,6 +542,12 @@ arm*-*-fuchsia*) tm_file="${tm_file} arm/bpabi-lib.h" unwind_header=config/arm/unwind-arm.h ;; @@ -286,7 +306,7 @@ index 8621de4f638..b776aa5e50b 100644 arm*-*-netbsdelf*) tmake_file="$tmake_file arm/t-arm" case ${host} in -@@ -715,6 +732,12 @@ x86_64-*-elf* | x86_64-*-rtems*) +@@ -758,6 +775,12 @@ x86_64-*-elf* | x86_64-*-rtems*) x86_64-*-fuchsia*) tmake_file="$tmake_file t-libgcc-pic" ;; @@ -299,9 +319,9 @@ index 8621de4f638..b776aa5e50b 100644 i[34567]86-*-dragonfly*) tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff" md_unwind_header=i386/dragonfly-unwind.h -@@ -747,6 +770,12 @@ i[34567]86-*-linux*) - tm_file="${tm_file} i386/elf-lib.h" +@@ -791,6 +814,12 @@ i[34567]86-*-linux*) md_unwind_header=i386/linux-unwind.h + tmake_file="${tmake_file} i386/t-heap-trampoline" ;; +i[34567]86-*-l4re*) + extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o" @@ -312,23 +332,9 @@ index 8621de4f638..b776aa5e50b 100644 i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-kopensolaris*-gnu) extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules" -diff --git a/libgcc/config/arm/unwind-arm.h b/libgcc/config/arm/unwind-arm.h -index b5b27fb85c4..f8c74c8a0e8 100644 ---- a/libgcc/config/arm/unwind-arm.h -+++ b/libgcc/config/arm/unwind-arm.h -@@ -74,7 +74,7 @@ static inline _Unwind_Ptr _Unwind_gnu_Find_got (_Unwind_Ptr ptr) - tmp += _Unwind_gnu_Find_got (ptr); - tmp = *(_Unwind_Word *) tmp; - #elif (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \ -- || defined(__FreeBSD__) || defined(__fuchsia__) -+ || defined(__FreeBSD__) || defined(__fuchsia__) || defined(__l4re__) - /* Pc-relative indirect. */ - #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect) - tmp += ptr; -diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host -index 9e7c7f02dfd..d78b5ce6436 100644 ---- a/libstdc++-v3/configure.host -+++ b/libstdc++-v3/configure.host +diff -Nurp a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host +--- a/libstdc++-v3/configure.host 2025-05-23 13:02:08.928270651 +0200 ++++ b/libstdc++-v3/configure.host 2025-12-10 10:20:21.698610717 +0100 @@ -255,6 +255,9 @@ case "${host_os}" in freebsd*) os_include_dir="os/bsd/freebsd" @@ -339,10 +345,9 @@ index 9e7c7f02dfd..d78b5ce6436 100644 linux-musl*) os_include_dir="os/generic" ;; -diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 -index b3269cb88e0..0be2eee5757 100644 ---- a/libstdc++-v3/crossconfig.m4 -+++ b/libstdc++-v3/crossconfig.m4 +diff -Nurp a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 +--- a/libstdc++-v3/crossconfig.m4 2025-05-23 13:02:08.928270651 +0200 ++++ b/libstdc++-v3/crossconfig.m4 2025-12-10 10:20:21.698610717 +0100 @@ -174,6 +174,15 @@ case "${host}" in GCC_CHECK_TLS @@ -359,6 +364,3 @@ index b3269cb88e0..0be2eee5757 100644 *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-cygwin* | *-solaris*) GLIBCXX_CHECK_COMPILER_FEATURES GLIBCXX_CHECK_LINKER_FEATURES --- -2.39.5 - diff --git a/recipes/devel/gcc/0104-fix-canadian-cross-includes.patch b/recipes/devel/gcc/0104-fix-canadian-cross-includes.patch new file mode 100644 index 00000000..012e9def --- /dev/null +++ b/recipes/devel/gcc/0104-fix-canadian-cross-includes.patch @@ -0,0 +1,25 @@ +Fix libstdc++ include paths for candian cross builds + +In a true canadian cross build, libstdc++ is built with the "target" compiler. +This is a cross compiler and it is therefore harmful to use the build machine +standard include paths. Instead, we can rely on the fact that the C and libc +header files are found naturally by the cross-compiler in its sysroot. + +Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71212 + +Signed-off-by: Jan Klötzke + +--- a/libstdc++-v3/acinclude.m4 2018-08-13 21:16:02.093382000 +0200 ++++ b/libstdc++-v3/acinclude.m4 2024-01-05 22:03:47.161321488 +0100 +@@ -673,11 +673,6 @@ + -I$glibcxx_builddir/include \ + -I$glibcxx_srcdir/libsupc++" + +- # For Canadian crosses, pick this up too. +- if test $CANADIAN = yes; then +- GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}" +- fi +- + # Stuff in the actual top level. Currently only used by libsupc++ to + # get unwind* headers from the libgcc dir. + #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc -I$(toplevel_srcdir)/include' diff --git a/recipes/devel/gcc/0105-fix-build-sysroot-includes.patch b/recipes/devel/gcc/0105-fix-build-sysroot-includes.patch new file mode 100644 index 00000000..7f4a3631 --- /dev/null +++ b/recipes/devel/gcc/0105-fix-build-sysroot-includes.patch @@ -0,0 +1,30 @@ +From: Jan Kloetzke +Subject: Fix build sysroot includes + +If a build sysroot was passed to configure (--with-build-sysroot=), we must not +pick up libraries or headers from the installation destination. These locations +will potentially contain incompatible files. Instead, the build sysroot is +already passed to the compiler and will find the correct libs/headers there. + +diff -Nurp a/configure b/configure +--- a/configure 2026-01-23 22:28:17.414392851 +0100 ++++ b/configure 2026-01-25 20:43:06.932742199 +0100 +@@ -10264,7 +10264,9 @@ case "$target" in + x86_64-*mingw* | *-w64-mingw*) + # MinGW-w64 does not use newlib, nor does it use winsup. It may, + # however, use a symlink named 'mingw' in ${prefix} . ++ if test -z "$SYSROOT_CFLAGS_FOR_TARGET"; then + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include' ++ fi + ;; + *-mingw*) + # MinGW can't be handled as Cygwin above since it does not use newlib. +@@ -10285,7 +10287,7 @@ fi + # the previously-installed cross compiler, so don't bother to add + # flags for directories within the install tree of the compiler + # being built; programs in there won't even run. +-if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then ++if test "${build}" = "${host}" && test -d ${srcdir}/gcc && test -z "$SYSROOT_CFLAGS_FOR_TARGET"; then + # Search for pre-installed headers if nothing else fits. + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include' + fi diff --git a/recipes/devel/host-compat-toolchain.yaml b/recipes/devel/host-compat-toolchain.yaml index ad965403..78d2ded2 100644 --- a/recipes/devel/host-compat-toolchain.yaml +++ b/recipes/devel/host-compat-toolchain.yaml @@ -190,7 +190,7 @@ provideTools: # # Attention: keep in sync with default.yaml! These flags should be # reset exactly to their default values. - CPPFLAGS: "-Wdate-time" - CFLAGS: "-Os -pipe -fPIC" - CXXFLAGS: "-Os -pipe -fPIC" - LDFLAGS: "-Wl,-O1 -Wl,--hash-style=gnu" + CPPFLAGS: "" + CFLAGS: "-O2 -pipe -fPIC" + CXXFLAGS: "-O2 -pipe -fPIC" + LDFLAGS: "" diff --git a/recipes/libs/compat/glibc.yaml b/recipes/libs/compat/glibc.yaml index 9df3ce95..3eb2f38c 100644 --- a/recipes/libs/compat/glibc.yaml +++ b/recipes/libs/compat/glibc.yaml @@ -1,11 +1,21 @@ inherit: [make, patch, strip] depends: + # This version of glibc apparently creates an endless loop with GNU make + # 4.4. See https://sourceware.org/pipermail/libc-help/2023-September/006486.html + # for one of the bug reports. Because we want to have this old glibc + # version, downgrading make seems to be the only viable option. + - name: devel::compat::make + use: [tools] + - kernel::linux-libc-headers - name: devel::compat::gcc-cross-bare use: [tools] +# Make 4.3 only supports pipes. +jobServer: "pipe" + metaEnvironment: PKG_LICENSE: "GPL-2.0-or-later AND LGPL-2.1-or-later" PKG_VERSION: "2.31" diff --git a/recipes/libs/glibc.yaml b/recipes/libs/glibc.yaml index 23922a58..579aedfd 100644 --- a/recipes/libs/glibc.yaml +++ b/recipes/libs/glibc.yaml @@ -6,7 +6,7 @@ depends: metaEnvironment: PKG_LICENSE: "GPL-2.0-or-later AND LGPL-2.1-or-later" - PKG_VERSION: "2.39" + PKG_VERSION: "2.42" privateEnvironment: GLIBC_ENABLE_KERNEL: "${GLIBC_ENABLE_KERNEL:-$KERNEL_LINUX_VERSION}" @@ -14,7 +14,7 @@ privateEnvironment: checkoutSCM: scm: url url: ${GNU_MIRROR}/glibc/glibc-${PKG_VERSION}.tar.xz - digestSHA256: "f77bd47cf8170c57365ae7bf86696c118adb3b120d3259c64c502d3dc1e2d926" + digestSHA256: "d1775e32e4628e64ef930f435b67bb63af7599acb6be2b335b9f19f16509f17f" stripComponents: 1 buildVars: [AS, CC, CXX, LD, AUTOCONF_HOST, GCC_MULTILIB, GLIBC_ENABLE_KERNEL] diff --git a/recipes/libs/mingw-w64.yaml b/recipes/libs/mingw-w64.yaml new file mode 100644 index 00000000..67f1e435 --- /dev/null +++ b/recipes/libs/mingw-w64.yaml @@ -0,0 +1,34 @@ +inherit: [autotools] + +metaEnvironment: + PKG_VERSION: "13.0.0" + PKG_LICENSE: "LicenseRef-mingw-w64" + PKG_LICENSE_PATH: | + mingw-w64:COPYING.MinGW-w64-runtime/COPYING.MinGW-w64-runtime.txt + +checkoutSCM: + scm: url + url: $SOURCEFORGE_MIRROR/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PKG_VERSION}.tar.bz2 + digestSHA256: 5afe822af5c4edbf67daaf45eec61d538f49eef6b19524de64897c6b95828caf + stripComponents: 1 + +multiPackage: + "": + buildVars: [TOOLCHAIN_SYSROOT] + buildScript: | + autotoolsBuild "$1" \ + --prefix=/mingw \ + --disable-lib32 \ + --enable-lib64 \ + --with-sysroot="${BOB_TOOL_PATHS[target-toolchain]}/$TOOLCHAIN_SYSROOT" + + packageScript: | + rsync -aH "$1/install/" . + + headers: + buildScript: | + autotoolsBuild "$1/mingw-w64-headers" \ + --prefix=/mingw + + packageScript: | + rsync -aH "$1/install/" . diff --git a/recipes/libs/newlib.yaml b/recipes/libs/newlib.yaml index 90d8919d..8c8160ca 100644 --- a/recipes/libs/newlib.yaml +++ b/recipes/libs/newlib.yaml @@ -1,7 +1,7 @@ inherit: [make, strip] metaEnvironment: - PKG_VERSION: "4.1.0" + PKG_VERSION: "4.5.0.20241231" PKG_LICENSE: "LicenseRef-newlib" PKG_LICENSE_PATH: | newlib:COPYING.NEWLIB @@ -9,30 +9,99 @@ metaEnvironment: checkoutSCM: scm: url url: ${SOURCEWARE_MIRROR}/newlib/newlib-${PKG_VERSION}.tar.gz - digestSHA1: "3f2536b591598e8e5c36f20f4d969266f81ab1ed" + digestSHA1: "2f170b41e2a6cd456ef01445168dd7268ef87b20" stripComponents: 1 +checkoutDeterministic: True +checkoutScript: | + # Work around Makefile bug creating files in the source + touch libgloss/doc/porting.info + +# Inspired by https://gitlab.arm.com/tooling/gnu-devtools-for-arm buildTools: [host-toolchain, target-toolchain] buildVars: [AUTOCONF_HOST] buildScript: | - rm -rf install - mkdir -p build install - pushd build - $1/configure \ - --prefix=/usr \ - --target=${AUTOCONF_HOST} \ - --libdir=/usr/lib \ - --disable-newlib-supplied-syscalls \ - --enable-lite-exit \ - --enable-target-optspace - makeParallel - makeSequential install DESTDIR=${PWD}/../install - popd - pushd install - mv usr/$AUTOCONF_HOST/* usr/ - rmdir usr/$AUTOCONF_HOST + SRC="$1" + + buildNewlib() + { + rm -rf install + mkdir -p build install + pushd build + $SRC/configure \ + --prefix=/usr \ + --target=${AUTOCONF_HOST} \ + --libdir=/usr/lib \ + --disable-newlib-supplied-syscalls \ + --enable-newlib-retargetable-locking \ + --enable-newlib-reent-check-verify \ + --enable-newlib-io-long-long \ + --enable-newlib-io-c99-formats \ + --enable-newlib-register-fini \ + --enable-newlib-mb \ + "$@" + makeParallel + makeSequential install DESTDIR=${PWD}/../install + popd + pushd install + mv usr/$AUTOCONF_HOST/* usr/ + rmdir usr/$AUTOCONF_HOST + popd + } + + mkdir -p std + pushd std + buildNewlib popd + case "$AUTOCONF_HOST" in + arm*-*-eabi | arm*-eabi) + BUILD_NANO=1 + ;; + *) + BUILD_NANO=0 + ;; + esac + + if [[ $BUILD_NANO -eq 1 ]] ; then + mkdir -p nano + pushd nano + buildNewlib \ + --enable-newlib-nano-malloc \ + --disable-newlib-unbuf-stream-opt \ + --enable-newlib-reent-small \ + --disable-newlib-fseek-optimization \ + --enable-newlib-nano-formatted-io \ + --disable-newlib-fvwrite-in-streamio \ + --disable-newlib-wide-orient \ + --enable-lite-exit \ + --enable-newlib-global-atexit + popd + + mkdir -p std/install/usr/include/newlib-nano + cp -f nano/install/usr/include/newlib.h \ + std/install/usr/include/newlib-nano + + for multilib in $(${AUTOCONF_HOST}-gcc -print-multi-lib); do + multi_dir="${multilib%%;*}" + src_dir="nano/install/usr/lib/$multi_dir" + dst_dir="std/install/usr/lib/$multi_dir" + cp -f "${src_dir}/libc.a" "${dst_dir}/libc_nano.a" + cp -f "${src_dir}/libg.a" "${dst_dir}/libg_nano.a" + cp -f "${src_dir}/librdimon.a" "${dst_dir}/librdimon_nano.a" + cp -f "${src_dir}/nano.specs" "${dst_dir}/" + cp -f "${src_dir}/rdimon.specs" "${dst_dir}/" + cp -f "${src_dir}/nosys.specs" "${dst_dir}/" + # Here it is safe to replace non-nano *crt0.o with the nano version + # because the the only difference in startup is that atexit is made + # a weak reference in nano. With lite exit libs, a program not + # explicitly calling atexit or on_exit will escape from the burden + # of cleaning up code. A program with atexit or on_exit will work + # consistently to normal libs. + cp -f "${src_dir}/"*crt0.o "${dst_dir}/" + done + fi + packageScript: | - cp -a $1/install/* . + cp -a $1/std/install/* . stripAll . diff --git a/recipes/libs/readline/0003-l4re-install-lib.patch b/recipes/libs/readline/0003-l4re-install-lib.patch index 1e67167b..7eb6191d 100644 --- a/recipes/libs/readline/0003-l4re-install-lib.patch +++ b/recipes/libs/readline/0003-l4re-install-lib.patch @@ -1,7 +1,12 @@ -diff -urN a/support/shlib-install b/support/shlib-install ---- a/support/shlib-install 2019-12-13 15:46:13.000000000 +0100 -+++ b/support/shlib-install 2024-09-05 09:08:38.318538692 +0200 -@@ -71,7 +71,7 @@ +From: Jan Kloetzke +Subject: Add L4Re support + +We follow the Linux way of doing things... + +diff -Nurp 1/support/shlib-install 2/support/shlib-install +--- 1/support/shlib-install 2019-12-13 15:46:13.000000000 +0100 ++++ 2/support/shlib-install 2025-11-27 11:58:34.165139844 +0100 +@@ -71,7 +71,7 @@ fi # Cygwin installs both a dll (which must go in $BINDIR) and an implicit # link library (in $libdir) case "$host_os" in @@ -10,12 +15,24 @@ diff -urN a/support/shlib-install b/support/shlib-install if [ -z "$uninstall" ]; then chmod 755 ${INSTALLDIR}/${LIBNAME} fi ;; -@@ -146,7 +146,7 @@ - fi +@@ -118,7 +118,7 @@ INSTALL_LINK2='${echo} cd $INSTALLDIR && + # Create symlinks to the installed library. This section is incomplete. + # + case "$host_os-$host_vendor" in +-*linux*|freebsd*|dragonfly*) ++*linux*|freebsd*|dragonfly*|l4re*) + # libname.so.M -> libname.so.M.N + ${echo} ${RM} ${INSTALLDIR}/$LINK2 + if [ -z "$uninstall" ]; then +diff -Nurp 1/support/shobj-conf 2/support/shobj-conf +--- 1/support/shobj-conf 2025-11-27 11:54:58.099741522 +0100 ++++ 2/support/shobj-conf 2025-11-27 11:58:49.073738127 +0100 +@@ -123,7 +123,7 @@ sunos5*|solaris2*) ;; --solaris2*|aix4.[2-9]*|aix[5-9]*|osf*|irix[56]*|sysv[45]*|dgux*|interix*) -+solaris2*|aix4.[2-9]*|aix[5-9]*|osf*|irix[56]*|sysv[45]*|dgux*|interix*|l4re*) - # libname.so -> libname.so.M - ${echo} ${RM} ${INSTALLDIR}/$LINK1 - if [ -z "$uninstall" ]; then + # All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd. +-linux*-*|gnu*-*|k*bsd*-gnu-*|midnightbsd*|freebsd*|dragonfly*) ++linux*-*|gnu*-*|k*bsd*-gnu-*|midnightbsd*|freebsd*|dragonfly*|l4re*) + SHOBJ_CFLAGS=-fPIC + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' diff --git a/recipes/libs/uclibc-l4re.yaml b/recipes/libs/uclibc-l4re.yaml index 79cad9a9..1478c6c0 100644 --- a/recipes/libs/uclibc-l4re.yaml +++ b/recipes/libs/uclibc-l4re.yaml @@ -1,21 +1,21 @@ -inherit: [make, strip, patch] +inherit: [make, strip] + +metaEnvironment: + PKG_VERSION: "r-2025-W50" + PKG_LICENSE: "MIT AND GPL-3.0-only with GCC-exception-3.1 AND GPL-3.0-or-later AND GPL-2.0-only" checkoutSCM: - scm: url dir: . - url: https://github.com/kernkonzept/mk/archive/bd33b157a8b160967340f56c37f548b07c983417.tar.gz - digestSHA1: 4e329a85cb50511df2360cb041421dcf0229ff55 + url: $GITHUB_MIRROR/L4Re/mk/archive/refs/tags/${PKG_VERSION}.tar.gz + digestSHA1: 63828669ccdbe441c567965894938237c64ebb20 stripComponents: 1 - scm: url dir: pkg/l4re-core - url: https://github.com/kernkonzept/l4re-core/archive/3e8d8f8c9a527d8680b463d58ea016954348774d.tar.gz - digestSHA1: 81e908bc24b90bd481fe48309d34cbb36a43197d + url: $GITHUB_MIRROR/L4Re/l4re-core/archive/refs/tags/${PKG_VERSION}.tar.gz + digestSHA1: 05265684049f9ba9c62a0d4a1fe06ff79494a8d5 stripComponents: 1 -checkoutDeterministic: True -checkoutScript: | - patchApplySeries $<@uclibc-l4re/*.patch@> - buildTools: [host-toolchain, target-toolchain, flex, bison] buildToolsWeak: [m4, perl] buildVars: [ARCH, CROSS_COMPILE] diff --git a/recipes/libs/uclibc-l4re/0001-fix-nostrip-install.patch b/recipes/libs/uclibc-l4re/0001-fix-nostrip-install.patch deleted file mode 100644 index 4a564c09..00000000 --- a/recipes/libs/uclibc-l4re/0001-fix-nostrip-install.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Jan Kloetzke -Subject: Fix sysroot if stripping is disabled - -When disabling CONFIG_BID_STRIP_BINARIES, BID will just use symlinks when -"installing" libraries. This does not work with the sysroot target when a -SOVERSION is set for the library. To fix that, fall back to a copy. - ---- a/mk/lib.mk 2025-05-23 07:50:43.989786347 +0200 -+++ b/mk/lib.mk 2025-05-23 07:50:49.230019144 +0200 -@@ -44,7 +44,9 @@ - $(INSTALL) -m 644 $(1) $(2))$(SOLINK) - INSTALLFILE_LIB_LOCAL ?= $(if $(call do_strip,$(1)), \ - $(call copy_stripped_binary,$(1),$(2),644), \ -- $(LN) -sf $(abspath $(1)) $(2))$(SOLINK) -+ $(if $(SOVERSION_FULL), \ -+ $(INSTALL) -m 644 $(1) $(2), \ -+ $(LN) -sf $(abspath $(1)) $(2)))$(SOLINK) - - INSTALLFILE = $(INSTALLFILE_LIB) - INSTALLDIR = $(INSTALLDIR_LIB) diff --git a/recipes/libs/uclibc-l4re/0002-remove-libmount.patch b/recipes/libs/uclibc-l4re/0002-remove-libmount.patch deleted file mode 100644 index 1c5ae54e..00000000 --- a/recipes/libs/uclibc-l4re/0002-remove-libmount.patch +++ /dev/null @@ -1,17 +0,0 @@ -From: Jan Kloetzke -Subject: Remove libmount from sysroot - -Gcc won't pick up this library. If needed, it will need to be folded into libc -on the L4Re side. - ---- a/Makefile 2025-05-23 08:04:52.199460490 +0200 -+++ b/Makefile 2025-05-23 08:04:57.567698895 +0200 -@@ -289,7 +289,7 @@ - - # Build a typical sysroot for use with external tooling such as a - # L4Re-specific cross-compiler --SYSROOT_LIBS = libgcc libgcc_eh libgcc_s libc libpthread librt libdl libld-l4 libm libc_nonshared.p libmount -+SYSROOT_LIBS = libgcc libgcc_eh libgcc_s libc libpthread librt libdl libld-l4 libm libc_nonshared.p - OUTPUT_FORMAT = $(CC) $(CFLAGS) -Wl,--verbose 2>&1 | $(SED) -n '/OUTPUT_FORMAT/,/)/p' - sysroot: $(foreach p,ldso libc_backends uclibc,pkg/l4re-core/$(p)) - $(GEN_MESSAGE) diff --git a/recipes/libs/uclibc-l4re/0003-remove-libgcc.patch b/recipes/libs/uclibc-l4re/0003-remove-libgcc.patch deleted file mode 100644 index 52bf6238..00000000 --- a/recipes/libs/uclibc-l4re/0003-remove-libgcc.patch +++ /dev/null @@ -1,16 +0,0 @@ -From: Jan Klötzke -Subject: Remove libgcc from sysroot - -This library is part of gcc. - ---- a/Makefile 2025-05-23 08:11:41.797650488 +0200 -+++ b/Makefile 2025-05-23 08:12:00.774493222 +0200 -@@ -289,7 +289,7 @@ - - # Build a typical sysroot for use with external tooling such as a - # L4Re-specific cross-compiler --SYSROOT_LIBS = libgcc libgcc_eh libgcc_s libc libpthread librt libdl libld-l4 libm libc_nonshared.p -+SYSROOT_LIBS = libc libpthread librt libdl libld-l4 libm libc_nonshared.p - OUTPUT_FORMAT = $(CC) $(CFLAGS) -Wl,--verbose 2>&1 | $(SED) -n '/OUTPUT_FORMAT/,/)/p' - sysroot: $(foreach p,ldso libc_backends uclibc,pkg/l4re-core/$(p)) - $(GEN_MESSAGE) diff --git a/tests/linux/recipes/buildall.yaml b/tests/linux/recipes/buildall.yaml index a1f5d462..8f7ce1cc 100644 --- a/tests/linux/recipes/buildall.yaml +++ b/tests/linux/recipes/buildall.yaml @@ -12,6 +12,8 @@ depends: - devel::cross-toolchain-aarch64-linux-gnu - devel::cross-toolchain-aarch64-none-elf - devel::cross-toolchain-riscv64-linux-gnu + - devel::cross-toolchain-x86_64-w64-mingw32 + - devel::ocaml - devel::llvm-libs-dev