refactor(rootfs): reorganize file structure and remove unnecessary .gitkeep files

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
2025-03-24 15:33:07 +00:00
parent 8f88d9028e
commit d251d9d03f
55 changed files with 622 additions and 596 deletions

View File

@ -86,7 +86,6 @@ __patch_cross_gcc: __clone_gcc
$(info > TOOLS: Running autoconf for gcc/libstdc++-v3)
cd $(GCC_CLONE_PATH)/libstdc++-v3 && autoconf
__patch_cross_qemu: __clone_qemu
$(info > TOOLS: Patching qemu)
cd $(QEMU_CLONE_PATH) && git apply $(CURDIR)/qemu.patch
@ -166,6 +165,10 @@ __do_gcc:
--enable-static-link \
--disable-tls \
--disable-pie \
--enable-libada \
--enable-libgm2 \
--enable-libssp \
--enable-libstdcxx \
&& \
$(MAKE) --quiet all-gcc -j$(shell nproc) && \
$(MAKE) --quiet all-target-libgcc -j$(shell nproc) && \

View File

@ -44,7 +44,7 @@ index 6553aac1..39008568 100644
bpf-*-*)
echo "*** Configuration $targ is not fully supported." >&2
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 5d1cf9c3..2606967f 100644
index 5d1cf9c3..f09b448f 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -20909,6 +20909,30 @@ get_gnu_elf_note_type (unsigned e_type)
@ -144,8 +144,8 @@ index 5d1cf9c3..2606967f 100644
+
+ case NT_FNX_ARCH:
+ {
+ /* TODO */
+ printf (_(" Unimplemented NT_FNX_ARCH note\n"));
+ /* TODO */
+ printf (_(" Unimplemented NT_FNX_ARCH note\n"));
+ }
+ break;
+
@ -288,10 +288,18 @@ index 6a9833e5..bf4c134d 100644
eelf_x86_64_sol2.c \
ehppa64linux.c \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 8639e782..24738803 100644
index 8639e782..f82ec216 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -676,6 +676,7 @@ ALL_EMULATION_SOURCES = \
@@ -543,6 +543,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -676,6 +677,7 @@ ALL_EMULATION_SOURCES = \
earcv2elfx.c \
earm_wince_pe.c \
earmelf.c \
@ -299,7 +307,7 @@ index 8639e782..24738803 100644
earmelf_fbsd.c \
earmelf_fuchsia.c \
earmelf_haiku.c \
@@ -790,6 +791,7 @@ ALL_EMULATION_SOURCES = \
@@ -790,6 +792,7 @@ ALL_EMULATION_SOURCES = \
eelf_i386.c \
eelf_i386_be.c \
eelf_i386_fbsd.c \
@ -307,7 +315,7 @@ index 8639e782..24738803 100644
eelf_i386_haiku.c \
eelf_i386_ldso.c \
eelf_i386_sol2.c \
@@ -893,6 +895,7 @@ ALL_64_EMULATION_SOURCES = \
@@ -893,6 +896,7 @@ ALL_64_EMULATION_SOURCES = \
eaarch64elf32.c \
eaarch64elf32b.c \
eaarch64elfb.c \
@ -315,7 +323,7 @@ index 8639e782..24738803 100644
eaarch64fbsd.c \
eaarch64fbsdb.c \
eaarch64haiku.c \
@@ -973,6 +976,7 @@ ALL_64_EMULATION_SOURCES = \
@@ -973,6 +977,7 @@ ALL_64_EMULATION_SOURCES = \
eelf_x86_64.c \
eelf_x86_64_cloudabi.c \
eelf_x86_64_fbsd.c \
@ -323,7 +331,7 @@ index 8639e782..24738803 100644
eelf_x86_64_haiku.c \
eelf_x86_64_sol2.c \
ehppa64linux.c \
@@ -1279,6 +1283,7 @@ distclean-compile:
@@ -1279,6 +1284,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64fbsdb.Po@am__quote@
@ -331,7 +339,7 @@ index 8639e782..24738803 100644
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64haiku.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64linux32.Po@am__quote@
@@ -1301,6 +1306,7 @@ distclean-compile:
@@ -1301,6 +1307,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earm_wince_pe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_fbsd.Po@am__quote@
@ -339,7 +347,7 @@ index 8639e782..24738803 100644
@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_linux.Po@am__quote@
@@ -1480,6 +1486,7 @@ distclean-compile:
@@ -1480,6 +1487,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Po@am__quote@
@ -347,7 +355,7 @@ index 8639e782..24738803 100644
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_ldso.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Po@am__quote@
@@ -1490,6 +1497,7 @@ distclean-compile:
@@ -1490,6 +1498,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Po@am__quote@
@ -356,7 +364,7 @@ index 8639e782..24738803 100644
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eh8300elf.Po@am__quote@
diff --git a/ld/configure.tgt b/ld/configure.tgt
index f937f78b..3aa8c738 100644
index f937f78b..57858cc8 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -92,6 +92,9 @@ aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
@ -407,7 +415,7 @@ index f937f78b..3aa8c738 100644
;;
+*-*-fennix*)
+ NATIVE_LIB_DIRS='/lib /usr/lib'
+ NATIVE_LIB_DIRS='/sys/lib /usr/lib'
+ ;;
+
*-*-freebsd*)

View File

@ -21,25 +21,26 @@ index 38f3d037a..e15a98ae9 100755
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 95c91ee02..cbcaac06b 100644
index 95c91ee02..c887980e0 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -825,6 +825,14 @@ case ${target} in
@@ -825,6 +825,15 @@ case ${target} in
rust_target_objs="${rust_target_objs} dragonfly-rust.o"
target_has_targetrustm=yes
;;
+*-*-fennix*)
+ extra_options="$extra_options gnu-user.opt"
+ tmake_file="t-fennix "
+ gas=yes
+ gnu_ld=yes
+ default_use_cxa_atexit=yes
+ use_gcc_stdint=provide
+ native_system_header_dir=/include
+ native_system_header_dir=/usr/include
+ ;;
*-*-freebsd*)
# This is the generic ELF configuration of FreeBSD. Later
# machine-specific sections may refine and add to this
@@ -1227,6 +1235,16 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
@@ -1227,6 +1236,16 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
done
TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
;;
@ -56,7 +57,7 @@ index 95c91ee02..cbcaac06b 100644
aarch64*-*-freebsd*)
tm_file="${tm_file} elfos.h ${fbsd_tm_file}"
tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-freebsd.h"
@@ -1358,6 +1376,30 @@ arm-wrs-vxworks7*)
@@ -1358,6 +1377,30 @@ arm-wrs-vxworks7*)
target_cpu_cname="generic-armv7-a"
need_64bit_hwint=yes
;;
@ -87,7 +88,7 @@ index 95c91ee02..cbcaac06b 100644
arm*-*-freebsd*) # ARM FreeBSD EABI
tm_file="elfos.h ${fbsd_tm_file} arm/elf.h"
case $target in
@@ -1953,6 +1995,14 @@ x86_64-*-dragonfly*)
@@ -1953,6 +1996,14 @@ x86_64-*-dragonfly*)
tm_file="${tm_file} i386/unix.h i386/att.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h"
tmake_file="${tmake_file} i386/t-crtstuff"
;;
@ -183,10 +184,10 @@ index 000000000..f93866693
+# <http://www.gnu.org/licenses/>.
diff --git a/gcc/config/fennix.h b/gcc/config/fennix.h
new file mode 100644
index 000000000..4cd35f5a0
index 000000000..136b89d25
--- /dev/null
+++ b/gcc/config/fennix.h
@@ -0,0 +1,77 @@
@@ -0,0 +1,83 @@
+/* Base configuration file for all Fennix targets.
+ Copyright (C) 2016-2024 Free Software Foundation, Inc.
+
@ -235,8 +236,14 @@ index 000000000..4cd35f5a0
+ } \
+ %{static:crtend.o%s}"
+
+#undef STANDARD_STARTFILE_PREFIX
+#define STANDARD_STARTFILE_PREFIX "/lib/"
+// #undef STANDARD_STARTFILE_PREFIX
+// #define STANDARD_STARTFILE_PREFIX "/lib/"
+
+#undef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "/sys/lib/"
+
+#undef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
+
+#undef LINK_SPEC
+#define LINK_SPEC \
@ -249,7 +256,7 @@ index 000000000..4cd35f5a0
+ } \
+ %{!static: \
+ %{!dynamic-linker: \
+ -dynamic-linker=/lib/ld.so \
+ -dynamic-linker=/sys/lib/ld.so \
+ } \
+ } \
+ -z max-page-size=4096"
@ -342,220 +349,198 @@ index e75a7af64..10d8017b0 100644
tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
md_unwind_header=i386/freebsd-unwind.h
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 21abaeb07..8dcc519be 100755
index 21abaeb07..fdafb5656 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -38122,6 +38122,3224 @@ done
@@ -893,6 +893,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1027,6 +1028,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1279,6 +1281,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1416,7 +1427,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1569,6 +1580,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -5080,7 +5092,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -5126,7 +5138,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -5150,7 +5162,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -5195,7 +5207,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -5219,7 +5231,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -12280,7 +12292,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12283 "configure"
+#line 12295 "configure"
#include "confdefs.h"
+ *-fennix*)
#if HAVE_DLFCN_H
@@ -12386,7 +12398,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12389 "configure"
+#line 12401 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16182,7 +16194,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16185 "configure"
+#line 16197 "configure"
int main()
{
typedef bool atomic_type;
@@ -16217,7 +16229,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16220 "configure"
+#line 16232 "configure"
int main()
{
typedef short atomic_type;
@@ -16252,7 +16264,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16255 "configure"
+#line 16267 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -16288,7 +16300,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16291 "configure"
+#line 16303 "configure"
int main()
{
typedef long long atomic_type;
@@ -16444,7 +16456,7 @@ $as_echo "mutex" >&6; }
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16447 "configure"
+#line 16459 "configure"
int main()
{
_Decimal32 d1;
@@ -16486,7 +16498,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16489 "configure"
+#line 16501 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -35067,24 +35079,3268 @@ done
CXXFLAGS="$ac_save_CXXFLAGS"
- $as_echo "#define _GLIBCXX_USE_DEV_RANDOM 1" >>confdefs.h
+ $as_echo "#define _GLIBCXX_USE_DEV_RANDOM 1" >>confdefs.h
+
+ # All these tests are for C++; save the language and the compiler flags.
+ # The CXXFLAGS thing is suspicious, but based on similar bits previously
+ # found in GLIBCXX_CONFIGURE.
+ $as_echo "#define _GLIBCXX_USE_RANDOM_TR1 1" >>confdefs.h
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+
+ # Check for -ffunction-sections -fdata-sections
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for g++ that supports -ffunction-sections -fdata-sections" >&5
+$as_echo_n "checking for g++ that supports -ffunction-sections -fdata-sections... " >&6; }
+ CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections'
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo; void bar() { };
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_fdsections=yes
+else
+ ac_fdsections=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ else
+ # this is the suspicious part
+ CXXFLAGS=''
+ fi
+ if test x"$ac_fdsections" = x"yes"; then
+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_fdsections" >&5
+$as_echo "$ac_fdsections" >&6; }
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ # We don't yet support AIX's TLS ABI.
+ #GCC_CHECK_TLS
+
+
+ $as_echo "#define HAVE_USELOCALE 1" >>confdefs.h
+
+ ;;
+
+ # If we're not using GNU ld, then there's no point in even trying these
+ # tests. Check for that first. We should have already tested for gld
+ # by now (in libtool), but require it now just to be safe...
+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+
+
+
+ # The name set by libtool depends on the version of libtool. Shame on us
+ # for depending on an impl detail, but c'est la vie. Older versions used
+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
+ # set (hence we're using an older libtool), then set it.
+ if test x${with_gnu_ld+set} != xset; then
+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
+ with_gnu_ld=no
+ else
+ with_gnu_ld=$ac_cv_prog_gnu_ld
+ fi
+ fi
+
+ # Start by getting the version number. I think the libtool test already
+ # does some of this, but throws away the result.
+ glibcxx_ld_is_gold=no
+ glibcxx_ld_is_mold=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >&5
+$as_echo_n "checking for ld version... " >&6; }
+
+ if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then
+ glibcxx_ld_is_gold=yes
+ elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then
+ glibcxx_ld_is_mold=yes
+ fi
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'`
+
+ glibcxx_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_gnu_ld_version" >&5
+$as_echo "$glibcxx_gnu_ld_version" >&6; }
+ fi
+
+ # Set --gc-sections.
+ glibcxx_have_gc_sections=no
+ if test "$glibcxx_ld_is_gold" = "yes" || test "$glibcxx_ld_is_mold" = "yes" ; then
+ if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then
+ glibcxx_have_gc_sections=yes
+ fi
+ else
+ glibcxx_gcsections_min_ld=21602
+ if test x"$with_gnu_ld" = x"yes" &&
+ test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then
+ glibcxx_have_gc_sections=yes
+ fi
+ fi
+ if test "$glibcxx_have_gc_sections" = "yes"; then
+ # Sufficiently young GNU ld it is! Joy and bunny rabbits!
+ # NB: This flag only works reliably after 2.16.1. Configure tests
+ # for this are difficult, so hard wire a value that should work.
+
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS='-Wl,--gc-sections'
+
+ # Check for -Wl,--gc-sections
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,--gc-sections" >&5
+$as_echo_n "checking for ld that supports -Wl,--gc-sections... " >&6; }
+ if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+ int one(void) { return 1; }
+ int two(void) { return 2; }
+
+int
+main ()
+{
+ two();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_gcsections=yes
+else
+ ac_gcsections=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$ac_gcsections" = "yes"; then
+ rm -f conftest.c
+ touch conftest.c
+ if $CC -c conftest.c; then
+ if $LD --gc-sections -o conftest conftest.o 2>&1 | \
+ grep "Warning: gc-sections option ignored" > /dev/null; then
+ ac_gcsections=no
+ fi
+ fi
+ rm -f conftest.c conftest.o conftest
+ fi
+ if test "$ac_gcsections" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_gcsections" >&5
+$as_echo "$ac_gcsections" >&6; }
+
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ else
+ # this is the suspicious part
+ CFLAGS=''
+ fi
+ fi
+
+ # Set -z,relro.
+ # Note this is only for shared objects.
+ ac_ld_relro=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ # cygwin and mingw uses PE, which has no ELF relro support,
+ # multi target ld may confuse configure machinery
+ case "$host" in
+ *-*-cygwin*)
+ ;;
+ *-*-mingw*)
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5
+$as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; }
+ cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
+ if test -n "$cxx_z_relo"; then
+ OPT_LDFLAGS="-Wl,-z,relro"
+ ac_ld_relro=yes
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5
+$as_echo "$ac_ld_relro" >&6; }
+ esac
+ fi
+
+ # Set linker optimization flags.
+ if test x"$with_gnu_ld" = x"yes"; then
+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+ fi
+
+
+
+ *-darwin*)
+ # Darwin versions vary, but the linker should work in a cross environment,
+ # so we just check for all the features here.
+ # Check for available headers.
+
+ # Don't call GLIBCXX_CHECK_LINKER_FEATURES, Darwin doesn't have a GNU ld
+
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
@ -3565,11 +3550,286 @@ index 21abaeb07..8dcc519be 100755
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+
+ ;;
+
*-freebsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
- $as_echo "#define _GLIBCXX_USE_RANDOM_TR1 1" >>confdefs.h
+ for ac_func in uselocale
+do :
+ ac_fn_c_check_func "$LINENO" "uselocale" "ac_cv_func_uselocale"
+if test "x$ac_cv_func_uselocale" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_USELOCALE 1
+_ACEOF
- # We don't yet support AIX's TLS ABI.
- #GCC_CHECK_TLS
+fi
+done
+ ;;
- $as_echo "#define HAVE_USELOCALE 1" >>confdefs.h
+ *djgpp)
+ # GLIBCXX_CHECK_MATH_SUPPORT
+ $as_echo "#define HAVE_ISINF 1" >>confdefs.h
+
+ $as_echo "#define HAVE_ISNAN 1" >>confdefs.h
+
+ $as_echo "#define HAVE_FINITE 1" >>confdefs.h
+
+ $as_echo "#define HAVE_SINCOS 1" >>confdefs.h
+
+ $as_echo "#define HAVE_HYPOT 1" >>confdefs.h
;;
- *-darwin*)
- # Darwin versions vary, but the linker should work in a cross environment,
- # so we just check for all the features here.
- # Check for available headers.
+ *-fennix*)
+
+ # All these tests are for C++; save the language and the compiler flags.
+ # The CXXFLAGS thing is suspicious, but based on similar bits previously
+ # found in GLIBCXX_CONFIGURE.
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+
+ # Check for -ffunction-sections -fdata-sections
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for g++ that supports -ffunction-sections -fdata-sections" >&5
+$as_echo_n "checking for g++ that supports -ffunction-sections -fdata-sections... " >&6; }
+ CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections'
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo; void bar() { };
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_fdsections=yes
+else
+ ac_fdsections=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ else
+ # this is the suspicious part
+ CXXFLAGS=''
+ fi
+ if test x"$ac_fdsections" = x"yes"; then
+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_fdsections" >&5
+$as_echo "$ac_fdsections" >&6; }
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+ # If we're not using GNU ld, then there's no point in even trying these
+ # tests. Check for that first. We should have already tested for gld
+ # by now (in libtool), but require it now just to be safe...
+ test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
+ test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
+
+
+
+ # The name set by libtool depends on the version of libtool. Shame on us
+ # for depending on an impl detail, but c'est la vie. Older versions used
+ # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
+ # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
+ # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
+ # set (hence we're using an older libtool), then set it.
+ if test x${with_gnu_ld+set} != xset; then
+ if test x${ac_cv_prog_gnu_ld+set} != xset; then
+ # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
+ with_gnu_ld=no
+ else
+ with_gnu_ld=$ac_cv_prog_gnu_ld
+ fi
+ fi
+
+ # Start by getting the version number. I think the libtool test already
+ # does some of this, but throws away the result.
+ glibcxx_ld_is_gold=no
+ glibcxx_ld_is_mold=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld version" >&5
+$as_echo_n "checking for ld version... " >&6; }
+
+ if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then
+ glibcxx_ld_is_gold=yes
+ elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then
+ glibcxx_ld_is_mold=yes
+ fi
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'`
+
+ glibcxx_gnu_ld_version=`echo $ldver | \
+ $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_gnu_ld_version" >&5
+$as_echo "$glibcxx_gnu_ld_version" >&6; }
+ fi
+
+ # Set --gc-sections.
+ glibcxx_have_gc_sections=no
+ if test "$glibcxx_ld_is_gold" = "yes" || test "$glibcxx_ld_is_mold" = "yes" ; then
+ if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then
+ glibcxx_have_gc_sections=yes
+ fi
+ else
+ glibcxx_gcsections_min_ld=21602
+ if test x"$with_gnu_ld" = x"yes" &&
+ test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then
+ glibcxx_have_gc_sections=yes
+ fi
+ fi
+ if test "$glibcxx_have_gc_sections" = "yes"; then
+ # Sufficiently young GNU ld it is! Joy and bunny rabbits!
+ # NB: This flag only works reliably after 2.16.1. Configure tests
+ # for this are difficult, so hard wire a value that should work.
+
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS='-Wl,--gc-sections'
+
+ # Check for -Wl,--gc-sections
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,--gc-sections" >&5
+$as_echo_n "checking for ld that supports -Wl,--gc-sections... " >&6; }
+ if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+ int one(void) { return 1; }
+ int two(void) { return 2; }
+
+int
+main ()
+{
+ two();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_gcsections=yes
+else
+ ac_gcsections=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test "$ac_gcsections" = "yes"; then
+ rm -f conftest.c
+ touch conftest.c
+ if $CC -c conftest.c; then
+ if $LD --gc-sections -o conftest conftest.o 2>&1 | \
+ grep "Warning: gc-sections option ignored" > /dev/null; then
+ ac_gcsections=no
+ fi
+ fi
+ rm -f conftest.c conftest.o conftest
+ fi
+ if test "$ac_gcsections" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_gcsections" >&5
+$as_echo "$ac_gcsections" >&6; }
+
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ else
+ # this is the suspicious part
+ CFLAGS=''
+ fi
+ fi
+
+ # Set -z,relro.
+ # Note this is only for shared objects.
+ ac_ld_relro=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ # cygwin and mingw uses PE, which has no ELF relro support,
+ # multi target ld may confuse configure machinery
+ case "$host" in
+ *-*-cygwin*)
+ ;;
+ *-*-mingw*)
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5
+$as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; }
+ cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
+ if test -n "$cxx_z_relo"; then
+ OPT_LDFLAGS="-Wl,-z,relro"
+ ac_ld_relro=yes
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5
+$as_echo "$ac_ld_relro" >&6; }
+ esac
+ fi
+
+ # Set linker optimization flags.
+ if test x"$with_gnu_ld" = x"yes"; then
+ OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
+ fi
+
+
+
- # Don't call GLIBCXX_CHECK_LINKER_FEATURES, Darwin doesn't have a GNU ld
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
@@ -38094,32 +41350,6 @@ done
CXXFLAGS="$ac_save_CXXFLAGS"
-
- for ac_func in uselocale
-do :
- ac_fn_c_check_func "$LINENO" "uselocale" "ac_cv_func_uselocale"
-if test "x$ac_cv_func_uselocale" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_USELOCALE 1
-_ACEOF
-
-fi
-done
-
- ;;
-
- *djgpp)
- # GLIBCXX_CHECK_MATH_SUPPORT
- $as_echo "#define HAVE_ISINF 1" >>confdefs.h
-
- $as_echo "#define HAVE_ISNAN 1" >>confdefs.h
-
- $as_echo "#define HAVE_FINITE 1" >>confdefs.h
-
- $as_echo "#define HAVE_SINCOS 1" >>confdefs.h
-
- $as_echo "#define HAVE_HYPOT 1" >>confdefs.h
-
;;
*-freebsd*)
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index b3269cb88..de1f886b9 100644
--- a/libstdc++-v3/crossconfig.m4