Remove the notion of "sys*"

- This idea originates from very early in the project and was, at the
  time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
  occuring when there is a change in kernel, but not from builder-hex0
  to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
  more difficult to understand.
- This puts everything down into one folder and has a manifest file that
  is used to generate the build scripts on the fly rather than using
  coded scripts.
- This is created in the "seed" stage.

stage0-posix -- (calls) --> seed -- (generates) --> main steps

Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.

- Creating a rootfs has become much simpler and is defined as code in
  go.sh. The new structure, for an about-to-be booted system, is

/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*

- There is no longer such a thing as /usr/include/musl, this didn't
  really make any sense, as musl is the final libc used. Rather, to
  separate musl and mes, we have /usr/include/mes, which is much easier
  to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
  checksum-transcriber, simple-patch, kexec-fiwix have all been given
  fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
  but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
  etc. This avoids manual definition of passes.
  - Ditto with patches; default directory is patches, but then any patch
    series specific to a pass are named patches-passX.
This commit is contained in:
fosslinux 2023-11-07 10:51:23 +11:00
parent 0907cfd073
commit 6ed2e09f3a
546 changed files with 700 additions and 1299 deletions

152
steps/gcc-4.7.4/pass1.sh Executable file
View file

@ -0,0 +1,152 @@
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default
# Generated using gperf
rm gcc/cp/cfns.h
# Regenerating top level Makefile requires GNU Autogen and hence Guile,
# but it is not essential for building gcc.
rm configure Makefile.in fixincludes/fixincl.x
# Remove unused generated files
rm libgo/aclocal.m4 libgo/configure libgo/Makefile.in
# Regenerate aclocal.m4 files
# grep "generated automatically by aclocal" */aclocal.m4 -l | sed -e 's#/aclocal.m4##' | tr "\n" " " | sed -e 's/ $/\n/'
for dir in intl libcpp libdecnumber; do
cd $dir
rm aclocal.m4
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config
cd ..
done
cd gcc
rm aclocal.m4
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../config
cd ..
cd fixincludes
rm aclocal.m4
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11 --acdir=../gcc
cd ..
for dir in boehm-gc libffi libgfortran libgomp libitm libjava libmudflap libobjc libquadmath libssp lto-plugin zlib; do
cd $dir
rm aclocal.m4
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 aclocal-1.11
cd ..
done
cd libstdc++-v3
ACLOCAL=aclocal-1.11 AUTOMAKE=automake-1.11 AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 autoreconf-2.64 -fi
cd ..
# Regenerate configure scripts
# Find all folders with configure script and rebuild them. At the moment we exclude boehm-gc folder due to
# an error but we don't use that directory anyway (it's only needed for Objective C)
for dir in $(find . -mindepth 2 -maxdepth 2 -name configure.ac | sed 's#/configure.ac##' | grep -v -x './libgo' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do
pushd "$dir"
rm configure
autoconf-2.64 || autoconf-2.64
popd
done
# Regenerate Makefile.in
# Find all folders with Makefile.am and rebuild them. At the moment we exclude boehm-gc folder.
for dir in $(find . -mindepth 2 -maxdepth 2 -name Makefile.am | sed 's#/Makefile.am##' | grep -v -x './libgo' | tr "\n" " " | sed -e 's/ $/\n/' -e 's/^boehm-gc //'); do
pushd "$dir"
rm Makefile.in
AUTOCONF=autoconf-2.64 AUTOM4TE=autom4te-2.64 automake-1.11 --add-missing
popd
done
for dir in libdecnumber libcpp libiberty gcc; do
cd $dir
rm -f config.in
autoheader-2.64
cd ..
done
# Rebuild libtool files
rm config.guess config.sub ltmain.sh
libtoolize
cp "${PREFIX}/share/automake-1.15/config.sub" .
# Workaround for bison being too new
rm intl/plural.c
# Rebuild flex generated files
rm gcc/gengtype-lex.c
# Regenerate crc table in libiberty/crc32.c
pushd libiberty
sed -n -e '39,66p' crc32.c > crcgen.c
gcc -o crcgen crcgen.c
head -n 70 crc32.c > crc32.c.new
./crcgen >> crc32.c.new
tail -n +139 crc32.c >> crc32.c.new
mv crc32.c.new crc32.c
popd
# Remove translation catalogs
find . -name '*.gmo' -delete
# Pre-built texinfo files
find . -name '*.info' -delete
}
src_configure() {
mkdir build
cd build
for dir in libiberty libcpp libdecnumber gcc libgcc libstdc++-v3; do
mkdir $dir
cd $dir
../../$dir/configure \
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--build=i386-unknown-linux-musl \
--target=i386-unknown-linux-musl \
--host=i386-unknown-linux-musl \
--disable-shared \
--program-transform-name= \
--enable-languages=c,c++ \
--disable-sjlj-exceptions \
--with-system-zlib
cd ..
done
cd ..
}
src_compile() {
ln -s . build/build-i386-unknown-linux-musl
for dir in libiberty libcpp libdecnumber gcc; do
# We have makeinfo now but it is not happy with gcc .info files, so skip it
make "${MAKEJOBS}" -C build/$dir LIBGCC2_INCLUDES=-I"${PREFIX}/include" \
STMP_FIXINC= GMPLIBS="-lmpc -lmpfr -lgmp" MAKEINFO=true
done
# host_subdir is necessary because we have slightly different build directory layout
make "${MAKEJOBS}" -C build/libgcc PATH="${PATH}:../gcc" CC=../gcc/xgcc \
host_subdir=build CFLAGS="-I../gcc/include -I/${PREFIX}/include"
make "${MAKEJOBS}" -C build/libstdc++-v3 PATH="${PATH}:${PWD}/build/gcc" \
CXXFLAGS="-I${PWD}/build/gcc/include -I ${PREFIX}/include"
}
src_install() {
make -C build/gcc install STMP_FIXINC= DESTDIR="${DESTDIR}" MAKEINFO=true
make -C build/libgcc install DESTDIR="${DESTDIR}" host_subdir=build
make -C build/libstdc++-v3 install DESTDIR="${DESTDIR}"
ln -s gcc "${DESTDIR}${PREFIX}/bin/cc"
cp gcc/gsyslimits.h "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/include/syslimits.h"
# Very strange mis-versoning error
mkdir -p "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/include/"
mv "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.0.4/include/"* "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/include/"
rmdir "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.0.4/include"
mv "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.0.4/"* "${DESTDIR}${LIBDIR}/gcc/i386-unknown-linux-musl/4.7.4/"
}

View file

@ -0,0 +1,58 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Gregor Richards <gregor.richards@uwaterloo.ca>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit 96ce40cbce449cb5f434425d148a9bcf02270c96
libitm fixes for musl support
2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
* config/arm/hwcap.cc: Use fcntl.h instead of sys/fcntl.h.
* config/linux/x86/tls.h: Only use __GLIBC_PREREQ if defined.
From-SVN: r222325
--- libitm/config/arm/hwcap.cc
+++ libitm/config/arm/hwcap.cc
@@ -40,7 +40,7 @@ int GTM_hwcap HIDDEN = 0
#ifdef __linux__
#include <unistd.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <elf.h>
static void __attribute__((constructor))
--- libitm/config/linux/x86/tls.h
+++ libitm/config/linux/x86/tls.h
@@ -25,16 +25,19 @@
#ifndef LIBITM_X86_TLS_H
#define LIBITM_X86_TLS_H 1
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
+#if defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 10)
/* Use slots in the TCB head rather than __thread lookups.
GLIBC has reserved words 10 through 13 for TM. */
#define HAVE_ARCH_GTM_THREAD 1
#define HAVE_ARCH_GTM_THREAD_DISP 1
#endif
+#endif
#include "config/generic/tls.h"
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
+#if defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 10)
namespace GTM HIDDEN {
#ifdef __x86_64__
@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct abi_dispatch *x)
} // namespace GTM
#endif /* >= GLIBC 2.10 */
+#endif
#endif // LIBITM_X86_TLS_H

View file

@ -0,0 +1,27 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Gregor Richards <gregor.richards@uwaterloo.ca>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit 218213dfd01e22b7c9f1be3119e32d970fa348bf
fixincludes update for musl support
2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
* mkfixinc.sh: Add *-musl* with no fixes.
From-SVN: r222327
--- fixincludes/mkfixinc.sh
+++ fixincludes/mkfixinc.sh
@@ -20,7 +20,8 @@ case $machine in
powerpc-*-eabi* | \
powerpc-*-rtems* | \
powerpcle-*-eabisim* | \
- powerpcle-*-eabi* )
+ powerpcle-*-eabi* | \
+ *-musl* )
# IF there is no include fixing,
# THEN create a no-op fixer and exit
(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}

View file

@ -0,0 +1,35 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Gregor Richards <gregor.richards@uwaterloo.ca>
SPDX-FileCopyrightText: 2015 Szabolcs Nagy <szabolcs.nagy@arm.com>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit 15aa7b447218e45da835472bbf4740ae00db9982
unwind fix for musl
2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* unwind-dw2-fde-dip.c (USE_PT_GNU_EH_FRAME): Define it on
Linux if target provides dl_iterate_phdr.
Co-Authored-By: Szabolcs Nagy <szabolcs.nagy@arm.com>
From-SVN: r222328
--- libgcc/unwind-dw2-fde-dip.c
+++ libgcc/unwind-dw2-fde-dip.c
@@ -53,6 +53,12 @@
# define USE_PT_GNU_EH_FRAME
#endif
+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+ && defined(TARGET_DL_ITERATE_PHDR) \
+ && defined(__linux__)
+# define USE_PT_GNU_EH_FRAME
+#endif
+
#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
&& defined(__FreeBSD__) && __FreeBSD__ >= 7
# define ElfW __ElfN

View file

@ -0,0 +1,41 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Szabolcs Nagy <szabolcs.nagy@arm.com>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit 85da5c3024f731e719c4093314da8edcd1056527
libstdc++ gthr workaround for musl
[libstdc++-v3/]
2015-04-22 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define.
* configure.host (os_include_dir): Set to "os/generic" for linux-musl*.
From-SVN: r222329
--- libstdc++-v3/config/os/generic/os_defines.h
+++ libstdc++-v3/config/os/generic/os_defines.h
@@ -33,4 +33,9 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
+// Disable the weak reference logic in gthr.h for os/generic because it
+// is broken on every platform unless there is implementation specific
+// workaround in gthr-posix.h and at link-time for static linking.
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+
#endif
--- libstdc++-v3/configure.host
+++ libstdc++-v3/configure.host
@@ -242,6 +242,9 @@ case "${host_os}" in
freebsd*)
os_include_dir="os/bsd/freebsd"
;;
+ linux-musl*)
+ os_include_dir="os/generic"
+ ;;
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
if [ "$uclibc" = "yes" ]; then
os_include_dir="os/uclibc"

View file

@ -0,0 +1,281 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Gregor Richards <gregor.richards@uwaterloo.ca>
SPDX-FileCopyrightText: 2015 Szabolcs Nagy <szabolcs.nagy@arm.com>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit 755658a56b57beca14b5fb70afdf1e588a058f7f
musl libc config
2015-05-08 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* config.gcc (LIBC_MUSL): New tm_defines macro.
* config/linux.h (OPTION_MUSL): Define.
(MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER32,)
(MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32,)
(INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,)
(INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,)
(INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define.
* config/linux.opt (mmusl): New option.
* doc/invoke.texi (GNU/Linux Options): Document -mmusl.
* configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*.
(gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*.
* configure: Regenerate.
Co-Authored-By: Szabolcs Nagy <szabolcs.nagy@arm.com>
From-SVN: r222904
--- gcc/config.gcc
+++ gcc/config.gcc
@@ -522,7 +522,7 @@ case ${target} in
esac
# Common C libraries.
-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
# Common parts for widely ported systems.
case ${target} in
@@ -625,6 +625,9 @@ case ${target} in
*-*-*uclibc*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
;;
+ *-*-*musl*)
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
+ ;;
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
--- gcc/config/linux.h
+++ gcc/config/linux.h
@@ -33,10 +33,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
#else
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
#endif
#define GNU_USER_TARGET_OS_CPP_BUILTINS() \
@@ -51,21 +53,25 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
} while (0)
/* Determine which dynamic linker to use depending on whether GLIBC or
- uClibc or Bionic is the default C library and whether
- -muclibc or -mglibc or -mbionic has been passed to change the default. */
+ uClibc or Bionic or musl is the default C library and whether
+ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
+ the default. */
-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
#if DEFAULT_LIBC == LIBC_GLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
#elif DEFAULT_LIBC == LIBC_UCLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
#elif DEFAULT_LIBC == LIBC_BIONIC
-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
+#elif DEFAULT_LIBC == LIBC_MUSL
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
@@ -82,19 +88,24 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
#define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
+/* Should be redefined for each target that supports musl. */
+#define MUSL_DYNAMIC_LINKER "/dev/null"
+#define MUSL_DYNAMIC_LINKER32 "/dev/null"
+#define MUSL_DYNAMIC_LINKER64 "/dev/null"
+#define MUSL_DYNAMIC_LINKERX32 "/dev/null"
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
- BIONIC_DYNAMIC_LINKER)
+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
#define GNU_USER_DYNAMIC_LINKER32 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
- BIONIC_DYNAMIC_LINKER32)
+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
#define GNU_USER_DYNAMIC_LINKER64 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
- BIONIC_DYNAMIC_LINKER64)
+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
#define GNU_USER_DYNAMIC_LINKERX32 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
- BIONIC_DYNAMIC_LINKERX32)
+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
/* Determine whether the entire c99 runtime
is present in the runtime library. */
@@ -108,3 +119,74 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Whether we have Bionic libc runtime */
#undef TARGET_HAS_BIONIC
#define TARGET_HAS_BIONIC (OPTION_BIONIC)
+
+/* musl avoids problematic includes by rearranging the include directories.
+ * Unfortunately, this is mostly duplicated from cppdefault.c */
+#if DEFAULT_LIBC == LIBC_MUSL
+#define INCLUDE_DEFAULTS_MUSL_GPP \
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+
+#ifdef LOCAL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_LOCAL
+#endif
+
+#ifdef PREFIX_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_PREFIX
+#endif
+
+#ifdef CROSS_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_CROSS \
+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#ifdef TOOL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_TOOL \
+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_TOOL
+#endif
+
+#ifdef NATIVE_SYSTEM_HEADER_DIR
+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_NATIVE
+#endif
+
+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
+# define INCLUDE_DEFAULTS_MUSL_LOCAL
+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
+# define INCLUDE_DEFAULTS_MUSL_NATIVE
+#else
+# undef INCLUDE_DEFAULTS_MUSL_CROSS
+# define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS \
+ { \
+ INCLUDE_DEFAULTS_MUSL_GPP \
+ INCLUDE_DEFAULTS_MUSL_PREFIX \
+ INCLUDE_DEFAULTS_MUSL_CROSS \
+ INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+ { 0, 0, 0, 0, 0, 0 } \
+ }
+#endif
--- gcc/config/linux.opt
+++ gcc/config/linux.opt
@@ -28,5 +28,9 @@ Target Report RejectNegative Var(linux_libc,LIBC_GLIBC) Negative(muclibc)
Use GNU C library
muclibc
-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl)
Use uClibc C library
+
+mmusl
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic)
+Use musl C library
--- gcc/configure.ac
+++ gcc/configure.ac
@@ -4669,6 +4669,9 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
gcc_cv_libc_provides_ssp,
[gcc_cv_libc_provides_ssp=no
case "$target" in
+ *-*-musl*)
+ # All versions of musl provide stack protector
+ gcc_cv_libc_provides_ssp=yes;;
*-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
[# glibc 2.4 and later provides __stack_chk_fail and
# either __stack_chk_guard, or TLS access to stack guard canary.
@@ -4702,6 +4705,7 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library,
# <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
# simply assert that glibc does provide this, which is true for all
# realistically usable GNU/Hurd configurations.
+ # All supported versions of musl provide it as well
gcc_cv_libc_provides_ssp=yes;;
*-*-darwin* | *-*-freebsd*)
AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
@@ -4767,6 +4771,9 @@ case "$target" in
gcc_cv_target_dl_iterate_phdr=no
fi
;;
+ *-linux-musl*)
+ gcc_cv_target_dl_iterate_phdr=yes
+ ;;
esac
GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
--- gcc/doc/invoke.texi
+++ gcc/doc/invoke.texi
@@ -595,7 +595,7 @@ Objective-C and Objective-C++ Dialects}.
-mcpu=@var{cpu}}
@emph{GNU/Linux Options}
-@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
+@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
-tno-android-cc -tno-android-ld}
@emph{H8/300 Options}
@@ -12879,13 +12879,19 @@ These @samp{-m} options are defined for GNU/Linux targets:
@item -mglibc
@opindex mglibc
Use the GNU C library. This is the default except
-on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
+on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
+@samp{*-*-linux-*android*} targets.
@item -muclibc
@opindex muclibc
Use uClibc C library. This is the default on
@samp{*-*-linux-*uclibc*} targets.
+@item -mmusl
+@opindex mmusl
+Use the musl C library. This is the default on
+@samp{*-*-linux-*musl*} targets.
+
@item -mbionic
@opindex mbionic
Use Bionic C library. This is the default on

View file

@ -0,0 +1,69 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Szabolcs Nagy <szabolcs.nagy@arm.com>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit 07ad804bfdbe0fa3406c5f2ff51d7c4c29a783c8
Add musl support to GCC
2015-05-08 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/glibc-stdint.h (OPTION_MUSL): Define.
(INT_FAST16_TYPE, INT_FAST32_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE):
Change the definition based on OPTION_MUSL for 64 bit targets.
* config/linux.h (OPTION_MUSL): Redefine.
* config/alpha/linux.h (OPTION_MUSL): Redefine.
* config/rs6000/linux.h (OPTION_MUSL): Redefine.
* config/rs6000/linux64.h (OPTION_MUSL): Redefine.
From-SVN: r222905
--- gcc/config/glibc-stdint.h
+++ gcc/config/glibc-stdint.h
@@ -22,6 +22,12 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+/* Systems using musl libc should use this header and make sure
+ OPTION_MUSL is defined correctly before using the TYPE macros. */
+#ifndef OPTION_MUSL
+#define OPTION_MUSL 0
+#endif
+
#define SIG_ATOMIC_TYPE "int"
#define INT8_TYPE "signed char"
@@ -43,12 +49,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
#define INT_FAST8_TYPE "signed char"
-#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
-#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
+#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
+#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
#define UINT_FAST8_TYPE "unsigned char"
-#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
-#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
+#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
+#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
--- gcc/config/linux.h
+++ gcc/config/linux.h
@@ -33,11 +33,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+#undef OPTION_MUSL
#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
#else
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+#undef OPTION_MUSL
#define OPTION_MUSL (linux_libc == LIBC_MUSL)
#endif

View file

@ -0,0 +1,39 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Gregor Richards <gregor.richards@uwaterloo.ca>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit cf57e99350d0b44876979c71986d8ca29c361f83
x86 musl support
2015-05-15 Gregor Richards <gregor.richards@uwaterloo.ca>
* config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define.
* config/i386/linux64.h (MUSL_DYNAMIC_LINKER32): Define.
(MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32): Define.
From-SVN: r223218
--- gcc/config/i386/linux.h
+++ gcc/config/i386/linux.h
@@ -22,3 +22,6 @@ along with GCC; see the file COPYING3. If not see
#define GNU_USER_LINK_EMULATION "elf_i386"
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
--- gcc/config/i386/linux64.h
+++ gcc/config/i386/linux64.h
@@ -31,3 +31,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
+
+#undef MUSL_DYNAMIC_LINKER32
+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
+#undef MUSL_DYNAMIC_LINKER64
+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
+#undef MUSL_DYNAMIC_LINKERX32
+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"

View file

@ -0,0 +1,21 @@
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
SPDX-FileCopyrightText: 2015 Doug Evans <dje@google.com>
SPDX-License-Identifier: GPL-2.0-or-later
Backported from upstream commit 755658a56b57beca14b5fb70afdf1e588a058f7f
config/linux.h (INCLUDE_DEFAULTS): Add INCLUDE_DEFAULTS_MUSL_LOCAL.
From-SVN: r229392
--- gcc/config/linux.h
+++ gcc/config/linux.h
@@ -184,6 +184,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define INCLUDE_DEFAULTS \
{ \
INCLUDE_DEFAULTS_MUSL_GPP \
+ INCLUDE_DEFAULTS_MUSL_LOCAL \
INCLUDE_DEFAULTS_MUSL_PREFIX \
INCLUDE_DEFAULTS_MUSL_CROSS \
INCLUDE_DEFAULTS_MUSL_TOOL \

View file

@ -0,0 +1,21 @@
SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
SPDX-License-Identifier: GPL-3.0-or-later
In GCC 10, fself-test is run on every GCC used in the
build process to ensure correctness. However this is not
yet introduced in GCC 4.7, so we no-op it.
--- gcc/common.opt 2023-01-23 21:22:23.630919284 +1100
+++ gcc/common.opt 2023-01-23 21:23:33.030143958 +1100
@@ -1701,6 +1701,10 @@
Common Report Var(flag_selective_scheduling2) Optimization
Run selective scheduling after reload
+fself-test=
+Common Undocumented Joined Var(flag_self_test)
+Run no-op self-tests.
+
fsel-sched-pipelining
Common Report Var(flag_sel_sched_pipelining) Init(0) Optimization
Perform software pipelining of inner loops during selective scheduling

View file

@ -0,0 +1,45 @@
SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
SPDX-FileCopyrightText: 2014 Joseph Myers <joseph@codesourcery.com>
SPDX-License-Identifier: GPL-3.0-or-later
GCC 10 uses a variety of compiler builtin macros in libgcc.
These macros do not exist in GCC 4.7, so we add them in.
(Taken straight from GCC 10).
(We could -D them in GCC 10, but this is a simpler unobtrusive
solution, and is arguably more correct).
--- gcc/c-family/c-cppbuiltin.c 2023-01-25 16:56:44.122222376 +1100
+++ gcc/c-family/c-cppbuiltin.c 2023-01-25 17:01:52.500855016 +1100
@@ -850,6 +850,30 @@
builtin_define_with_int_value ("__LIBGCC_TRAMPOLINE_SIZE__",
TRAMPOLINE_SIZE);
+ /* For libgcc unwinder code. */
+#ifdef DONT_USE_BUILTIN_SETJMP
+ cpp_define (pfile, "__LIBGCC_DONT_USE_BUILTIN_SETJMP__");
+#endif
+#ifdef DWARF_ALT_FRAME_RETURN_COLUMN
+ builtin_define_with_int_value ("__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__",
+ DWARF_ALT_FRAME_RETURN_COLUMN);
+#endif
+ builtin_define_with_int_value ("__LIBGCC_DWARF_FRAME_REGISTERS__",
+ DWARF_FRAME_REGISTERS);
+#ifdef EH_RETURN_STACKADJ_RTX
+ cpp_define (pfile, "__LIBGCC_EH_RETURN_STACKADJ_RTX__");
+#endif
+#ifdef JMP_BUF_SIZE
+ builtin_define_with_int_value ("__LIBGCC_JMP_BUF_SIZE__",
+ JMP_BUF_SIZE);
+#endif
+ builtin_define_with_int_value ("__LIBGCC_STACK_POINTER_REGNUM__",
+ STACK_POINTER_REGNUM);
+
+ /* For libgcov. */
+ builtin_define_with_int_value ("__LIBGCC_VTABLE_USES_DESCRIPTORS__",
+ TARGET_VTABLE_USES_DESCRIPTORS);
+
/* For use in assembly language. */
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);

View file

@ -0,0 +1,286 @@
SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
SPDX-FileCopyrightText: 2012 H.J. Lu <hongjiu.lu@intel.com>
SPDX-License-Identifier: GPL-3.0-or-later
Backport of the commit:
[PATCH] Add -mlong-double-64/-mlong-double-80 to i386
to GCC 4.7.
GCC 10 uses this argument to ensure some files are compiled with long
double length = 80. This is almost universally true for i386, so it
could be patched out; but the use of this flag is rather extensive,
and if removed will break future added architectures anyway, so it
makes more sense to simply add in support to GCC 4.7.
diff --git gcc/config/i386/i386-c.c gcc/config/i386/i386-c.c
index d00e0ba54b939..edd64ff7ae388 100644
--- gcc/config/i386/i386-c.c
+++ gcc/config/i386/i386-c.c
@@ -418,6 +418,9 @@
builtin_define_std ("i386");
}
+ if (TARGET_LONG_DOUBLE_64)
+ cpp_define (parse_in, "__LONG_DOUBLE_64__");
+
ix86_target_macros_internal (ix86_isa_flags,
ix86_arch,
ix86_tune,
diff --git gcc/config/i386/i386.c gcc/config/i386/i386.c
index a6fc45b047a94..da931ee153745 100644
--- gcc/config/i386/i386.c
+++ gcc/config/i386/i386.c
@@ -2786,6 +2786,7 @@ ix86_target_string (HOST_WIDE_INT isa, int flags, const char *arch,
static struct ix86_target_opts flag_opts[] =
{
{ "-m128bit-long-double", MASK_128BIT_LONG_DOUBLE },
+ { "-mlong-double-64", MASK_LONG_DOUBLE_64 },
{ "-m80387", MASK_80387 },
{ "-maccumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS },
{ "-malign-double", MASK_ALIGN_DOUBLE },
@@ -4084,6 +4085,11 @@ ix86_option_override_internal (bool main_args_p)
else if (target_flags_explicit & MASK_RECIP)
recip_mask &= ~(RECIP_MASK_ALL & ~recip_mask_explicit);
+ /* Default long double to 64-bit for Bionic. */
+ if (TARGET_HAS_BIONIC
+ && !(target_flags_explicit & MASK_LONG_DOUBLE_64))
+ target_flags |= MASK_LONG_DOUBLE_64;
+
/* Save the initial options in case the user does function specific
options. */
if (main_args_p)
diff --git gcc/config/i386/i386.h gcc/config/i386/i386.h
index 11f79e3f670af..3a41a43e308bf 100644
--- gcc/config/i386/i386.h
+++ gcc/config/i386/i386.h
@@ -671,9 +671,17 @@ enum target_cpu_default
#define LONG_LONG_TYPE_SIZE 64
#define FLOAT_TYPE_SIZE 32
#define DOUBLE_TYPE_SIZE 64
-#define LONG_DOUBLE_TYPE_SIZE 80
+#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_64 ? 64 : 80)
-#define WIDEST_HARDWARE_FP_SIZE LONG_DOUBLE_TYPE_SIZE
+/* Define this to set long double type size to use in libgcc2.c, which can
+ not depend on target_flags. */
+#ifdef __LONG_DOUBLE_64__
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
+#else
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
+#endif
+
+#define WIDEST_HARDWARE_FP_SIZE 80
#if defined (TARGET_BI_ARCH) || TARGET_64BIT_DEFAULT
#define MAX_BITS_PER_WORD 64
diff --git gcc/config/i386/i386.opt gcc/config/i386/i386.opt
index e4f78f3ce50f3..6a389947d904e 100644
--- gcc/config/i386/i386.opt
+++ gcc/config/i386/i386.opt
@@ -86,6 +86,14 @@ m96bit-long-double
Target RejectNegative Report InverseMask(128BIT_LONG_DOUBLE) Save
sizeof(long double) is 12
+mlong-double-80
+Target Report RejectNegative InverseMask(LONG_DOUBLE_64) Save
+Use 80-bit long double
+
+mlong-double-64
+Target Report RejectNegative Mask(LONG_DOUBLE_64) Save
+Use 64-bit long double
+
maccumulate-outgoing-args
Target Report Mask(ACCUMULATE_OUTGOING_ARGS) Save
Reserve space for outgoing arguments in the function prologue
diff --git gcc/testsuite/gcc.target/i386/long-double-64-1.c gcc/testsuite/gcc.target/i386/long-double-64-1.c
new file mode 100644
index 0000000000000..cf933796f8aea
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-64-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-64" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-64-2.c gcc/testsuite/gcc.target/i386/long-double-64-2.c
new file mode 100644
index 0000000000000..ddf4fe656d099
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-64-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mbionic" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-64-3.c gcc/testsuite/gcc.target/i386/long-double-64-3.c
new file mode 100644
index 0000000000000..e748fab2edd3c
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-64-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mandroid" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-64-4.c gcc/testsuite/gcc.target/i386/long-double-64-4.c
new file mode 100644
index 0000000000000..d9c25aaec080c
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-64-4.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-80 -mlong-double-64" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler-not "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-80-1.c gcc/testsuite/gcc.target/i386/long-double-80-1.c
new file mode 100644
index 0000000000000..d3b75a0be21de
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-80-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-80" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-80-2.c gcc/testsuite/gcc.target/i386/long-double-80-2.c
new file mode 100644
index 0000000000000..954dfd15d4271
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-80-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mlong-double-80 -mbionic" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-80-3.c gcc/testsuite/gcc.target/i386/long-double-80-3.c
new file mode 100644
index 0000000000000..e0e8365e32c4a
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-80-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mlong-double-80 -mandroid" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-80-4.c gcc/testsuite/gcc.target/i386/long-double-80-4.c
new file mode 100644
index 0000000000000..cac2d55bc166c
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-80-4.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-64 -mlong-double-80" } */
+
+long double
+foo (long double x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-80-5.c gcc/testsuite/gcc.target/i386/long-double-80-5.c
new file mode 100644
index 0000000000000..4aa606fd1ba05
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-80-5.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-64" } */
+
+__float80
+foo (__float80 x)
+{
+ return x * x;
+}
+
+/* { dg-final { scan-assembler "fldt" } } */
diff --git gcc/testsuite/gcc.target/i386/long-double-80-6.c gcc/testsuite/gcc.target/i386/long-double-80-6.c
new file mode 100644
index 0000000000000..a395a265942c1
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-80-6.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-options "-O0 -mlong-double-64 -mfpmath=387" } */
+
+int
+main ()
+{
+ __float80 a = -0.23456789;
+ if ((double) a >= 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git gcc/testsuite/gcc.target/i386/long-double-80-7.c gcc/testsuite/gcc.target/i386/long-double-80-7.c
new file mode 100644
index 0000000000000..9b30fe8856786
--- /dev/null
+++ gcc/testsuite/gcc.target/i386/long-double-80-7.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-O0 -mlong-double-64 -mfpmath=sse" } */
+/* { dg-require-effective-target sse2 } */
+
+#include "sse2-check.h"
+
+static void
+sse2_test (void)
+{
+ __float80 a = -0.23456789;
+ if ((double) a >= 0)
+ __builtin_abort ();
+}
diff --git libgcc/config/i386/t-linux libgcc/config/i386/t-linux
index 29b4c22398346..4f47f7bfa59cf 100644
--- libgcc/config/i386/t-linux
+++ libgcc/config/i386/t-linux
@@ -2,3 +2,5 @@
# Need to support TImode for x86. Override the settings from
# t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
+
+HOST_LIBGCC2_CFLAGS += -mlong-double-80

View file

@ -0,0 +1,36 @@
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
SPDX-License-Identifier: GPL-3.0-or-later
Remove dependency on gperf.
--- gcc/cp/except.c 2021-07-07 18:24:36.561530121 +0100
+++ gcc/cp/except.c 2021-07-07 18:27:18.035681929 +0100
@@ -987,8 +987,6 @@
exception, unless it calls a program-supplied function that
throws an exception. */
-#include "cfns.h"
-
int
nothrow_libfn_p (const_tree fn)
{
@@ -1007,7 +1005,7 @@
unless the system headers are playing rename tricks, and if
they are, we don't want to be confused by them. */
id = DECL_NAME (fn);
- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
+ return 0;
}
/* Returns nonzero if an exception of type FROM will be caught by a
--- gcc/cp/Make-lang.in 2021-07-07 18:24:36.571530380 +0100
+++ gcc/cp/Make-lang.in 2021-07-07 18:26:47.154887799 +0100
@@ -313,7 +313,7 @@
cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) convert.h \
$(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h intl.h
cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- cp/cfns.h $(TREE_INLINE_H) $(TARGET_H) gt-cp-except.h
+ $(TREE_INLINE_H) $(TARGET_H) gt-cp-except.h
cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(TM_P_H)
cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/cp-objcp-common.h \
toplev.h $(TREE_INLINE_H) pointer-set.h gt-cp-pt.h vecprim.h intl.h \

1
steps/gcc-4.7.4/sources Normal file
View file

@ -0,0 +1 @@
https://mirrors.kernel.org/gnu/gcc/gcc-4.7.4/gcc-4.7.4.tar.bz2 92e61c6dc3a0a449e62d72a38185fda550168a86702dea07125ebd3ec3996282