From 6e0ec4b5bc6fc670bbe7914ce69e428995680263 Mon Sep 17 00:00:00 2001 From: Jeremy Andrews Date: Sun, 5 Nov 2023 20:04:55 -0600 Subject: Issue #2373 - Remove all remaining traces of CHECK_STDCXX. As far as I can tell, all this code is unused in our platform. GCC older than 7 didn't have the macro _GLIBC_RELEASE. As far as I can tell, using newer GCC means you don't have to check for incompatible symbol versions in the build system, not even if you are compiling with clang against GCC's libc. --- build/clang-plugin/Makefile.in | 7 --- build/templates.mozbuild | 18 ------ build/unix/moz.build | 3 - build/unix/mozconfig.stdcxx | 15 ----- build/unix/mozconfig.tsan | 2 - build/unix/stdc++compat/Makefile.in | 7 --- build/unix/stdc++compat/moz.build | 23 ------- build/unix/stdc++compat/stdc++compat.cpp | 78 ------------------------ config/rules.mk | 6 -- js/src/devtools/automation/variants/arm-sim | 2 +- js/src/devtools/automation/variants/arm-sim-osx | 2 +- js/src/devtools/automation/variants/arm64-sim | 2 +- js/src/devtools/automation/variants/compacting | 2 +- js/src/devtools/automation/variants/rootanalysis | 2 +- 14 files changed, 5 insertions(+), 164 deletions(-) delete mode 100644 build/unix/mozconfig.stdcxx delete mode 100644 build/unix/stdc++compat/Makefile.in delete mode 100644 build/unix/stdc++compat/moz.build delete mode 100644 build/unix/stdc++compat/stdc++compat.cpp diff --git a/build/clang-plugin/Makefile.in b/build/clang-plugin/Makefile.in index ff1e39d1b7..f8bdeca4cd 100644 --- a/build/clang-plugin/Makefile.in +++ b/build/clang-plugin/Makefile.in @@ -33,10 +33,3 @@ endif # correctly. Note that the binary produced here is a host tool and doesn't need # to be distributed. MACOSX_DEPLOYMENT_TARGET := - -# Temporarily relax the requirements for libstdc++ symbol versions on static -# analysis plugin in order to use a recent clang by accepting libstdc++ from -# gcc 4.4.0 (GLIBCXX_3.4.11). -ifdef CHECK_STDCXX -CHECK_STDCXX = $(call CHECK_SYMBOLS,$(1),GLIBCXX,libstdc++,v[1] > 3 || (v[1] == 3 && v[2] == 4 && v[3] > 11)) -endif diff --git a/build/templates.mozbuild b/build/templates.mozbuild index f059820d0d..1392a6655b 100644 --- a/build/templates.mozbuild +++ b/build/templates.mozbuild @@ -74,27 +74,11 @@ def Framework(name): IS_FRAMEWORK = True -@template -def HostStdCppCompat(): - '''Template for libstdc++ compatibility for host binaries.''' - - if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']: - HOST_USE_LIBS += ['host_stdc++compat'] - - @template def HostProgram(name, c_only=False): '''Template for build tools executables.''' HOST_PROGRAM = name - # With context-based templates, this won't be needed anymore, and will - # work better than relying on the caller setting it, but at the moment, - # this is the best we have. And it doesn't matter /that/ much, so there's - # really only one place using this, where it does matter to avoid the - # extra dependency (because it creates a circular one). - if not c_only: - HostStdCppCompat() - @template def HostSimplePrograms(names, ext='.cpp'): @@ -106,8 +90,6 @@ def HostSimplePrograms(names, ext='.cpp'): HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext) for name in names] - HostStdCppCompat() - @template def HostLibrary(name): diff --git a/build/unix/moz.build b/build/unix/moz.build index cd455b7a4d..84c7045a4a 100644 --- a/build/unix/moz.build +++ b/build/unix/moz.build @@ -3,9 +3,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'] or CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']: - DIRS += ['stdc++compat'] - if CONFIG['USE_ELF_HACK']: DIRS += ['elfhack'] diff --git a/build/unix/mozconfig.stdcxx b/build/unix/mozconfig.stdcxx deleted file mode 100644 index 787e9b4439..0000000000 --- a/build/unix/mozconfig.stdcxx +++ /dev/null @@ -1,15 +0,0 @@ -# Avoid dependency on libstdc++ 4.7 -ac_add_options --enable-stdcxx-compat - -TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir} - -if [ -f "$TOOLTOOL_DIR/clang/lib/libstdc++.so" ]; then - LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/clang/lib -elif [ -f "$TOOLTOOL_DIR/gcc/lib/libstdc++.so" ]; then - # We put both 32-bits and 64-bits library path in LD_LIBRARY_PATH: ld.so - # will prefer the files in the 32-bits path when loading 32-bits executables, - # and the files in the 64-bits path when loading 64-bits executables. - LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/gcc/lib64:$TOOLTOOL_DIR/gcc/lib -fi - -mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" diff --git a/build/unix/mozconfig.tsan b/build/unix/mozconfig.tsan index f78c1071f1..b8eb266ebb 100644 --- a/build/unix/mozconfig.tsan +++ b/build/unix/mozconfig.tsan @@ -30,5 +30,3 @@ ac_add_options --enable-pie ac_add_options --disable-install-strip # -gline-tables-only results in significantly smaller binaries. ac_add_options --enable-debug-symbols="-gline-tables-only" - -. "$topsrcdir/build/unix/mozconfig.stdcxx" diff --git a/build/unix/stdc++compat/Makefile.in b/build/unix/stdc++compat/Makefile.in deleted file mode 100644 index 054c1c023e..0000000000 --- a/build/unix/stdc++compat/Makefile.in +++ /dev/null @@ -1,7 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. - -ENABLE_CLANG_PLUGIN := - -include $(topsrcdir)/config/rules.mk diff --git a/build/unix/stdc++compat/moz.build b/build/unix/stdc++compat/moz.build deleted file mode 100644 index 12bd8644b0..0000000000 --- a/build/unix/stdc++compat/moz.build +++ /dev/null @@ -1,23 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']: - Library('stdc++compat') - SOURCES += ['stdc++compat.cpp'] - -if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']: - HostLibrary('host_stdc++compat') - HOST_SOURCES += [ - 'stdc++compat.cpp', - ] - -FORCE_STATIC_LIB = True - -NO_PGO = True - -DISABLE_STL_WRAPPING = True - -DEFINES['MOZ_LIBSTDCXX_VERSION'] = CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'] -HOST_DEFINES['MOZ_LIBSTDCXX_VERSION'] = CONFIG['MOZ_LIBSTDCXX_HOST_VERSION'] diff --git a/build/unix/stdc++compat/stdc++compat.cpp b/build/unix/stdc++compat/stdc++compat.cpp deleted file mode 100644 index 95a7a9afef..0000000000 --- a/build/unix/stdc++compat/stdc++compat.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include -#include -#include -#include -#include -#include - -/* GLIBCXX_3.4.8 is from gcc 4.1.1 (111691) - GLIBCXX_3.4.9 is from gcc 4.2.0 (111690) - GLIBCXX_3.4.10 is from gcc 4.3.0 (126287) - GLIBCXX_3.4.11 is from gcc 4.4.0 (133006) - GLIBCXX_3.4.12 is from gcc 4.4.1 (147138) - GLIBCXX_3.4.13 is from gcc 4.4.2 (151127) - GLIBCXX_3.4.14 is from gcc 4.5.0 (151126) - GLIBCXX_3.4.15 is from gcc 4.6.0 (160071) - GLIBCXX_3.4.16 is from gcc 4.6.1 (172240) - GLIBCXX_3.4.17 is from gcc 4.7.0 (174383) - GLIBCXX_3.4.18 is from gcc 4.8.0 (190787) - GLIBCXX_3.4.19 is from gcc 4.8.1 (199309) - GLIBCXX_3.4.20 is from gcc 4.9.0 (199307) - GLIBCXX_3.4.21 is from gcc 5.0 (210290) - -This file adds the necessary compatibility tricks to avoid symbols with -version GLIBCXX_3.4.16 and bigger, keeping binary compatibility with -libstdc++ 4.6.1. - -*/ - -#define GLIBCXX_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c)) - -#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 20) -namespace std { - - /* We shouldn't be throwing exceptions at all, but it sadly turns out - we call STL (inline) functions that do. */ - void __throw_out_of_range_fmt(char const* fmt, ...) - { - va_list ap; - char buf[1024]; // That should be big enough. - - va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); - buf[sizeof(buf) - 1] = 0; - va_end(ap); - - __throw_range_error(buf); - } - -} -#endif - -#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 20) -/* Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8, - but that's equivalent, version-wise. Those calls are added by the compiler - itself on `new Class[n]` calls. */ -extern "C" void -__cxa_throw_bad_array_new_length() -{ - MOZ_CRASH(); -} -#endif - -#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 21) -/* While we generally don't build with exceptions, we have some host tools - * that do use them. libstdc++ from GCC 5.0 added exception constructors with - * char const* argument. Older versions only have a constructor with - * std::string. */ -namespace std { - runtime_error::runtime_error(char const* s) - : runtime_error(std::string(s)) - { - } -} -#endif diff --git a/config/rules.mk b/config/rules.mk index b774063699..37b347c00a 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -671,9 +671,6 @@ else $(EXPAND_LIBS_EXEC) -- $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) endif # HOST_CPP_PROG_LINK endif -ifndef CROSS_COMPILE - $(call CHECK_STDCXX,$@) -endif # # This is an attempt to support generation of multiple binaries @@ -716,9 +713,6 @@ else $(EXPAND_LIBS_EXEC) -- $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS) endif endif -ifndef CROSS_COMPILE - $(call CHECK_STDCXX,$@) -endif ifdef DTRACE_PROBE_OBJ EXTRA_DEPS += $(DTRACE_PROBE_OBJ) diff --git a/js/src/devtools/automation/variants/arm-sim b/js/src/devtools/automation/variants/arm-sim index 20963b235a..f6d2d5acd7 100644 --- a/js/src/devtools/automation/variants/arm-sim +++ b/js/src/devtools/automation/variants/arm-sim @@ -1,5 +1,5 @@ { - "configure-args": "--enable-stdcxx-compat --enable-simulator=arm --target=i686-pc-linux --host=i686-pc-linux", + "configure-args": "--enable-simulator=arm --target=i686-pc-linux --host=i686-pc-linux", "optimize": true, "debug": true, "bits": 32 diff --git a/js/src/devtools/automation/variants/arm-sim-osx b/js/src/devtools/automation/variants/arm-sim-osx index af193fc16f..cf8bdcb3dc 100644 --- a/js/src/devtools/automation/variants/arm-sim-osx +++ b/js/src/devtools/automation/variants/arm-sim-osx @@ -1,5 +1,5 @@ { - "configure-args": "--enable-stdcxx-compat --enable-simulator=arm --target=i686-apple-darwin10.0.0 --host=i686-apple-darwin10.0.0", + "configure-args": "--enable-simulator=arm --target=i686-apple-darwin10.0.0 --host=i686-apple-darwin10.0.0", "optimize": true, "debug": true, "bits": 32 diff --git a/js/src/devtools/automation/variants/arm64-sim b/js/src/devtools/automation/variants/arm64-sim index 6874f441cf..4a10121a33 100644 --- a/js/src/devtools/automation/variants/arm64-sim +++ b/js/src/devtools/automation/variants/arm64-sim @@ -1,5 +1,5 @@ { - "configure-args": "--enable-stdcxx-compat --enable-simulator=arm64", + "configure-args": "--enable-simulator=arm64", "optimize": true, "debug": true, "env": { diff --git a/js/src/devtools/automation/variants/compacting b/js/src/devtools/automation/variants/compacting index 2ffade6acd..a343c7e2be 100644 --- a/js/src/devtools/automation/variants/compacting +++ b/js/src/devtools/automation/variants/compacting @@ -1,5 +1,5 @@ { - "configure-args": "--enable-stdcxx-compat --enable-ctypes", + "configure-args": "--enable-ctypes", "optimize": true, "debug": true, "env": { diff --git a/js/src/devtools/automation/variants/rootanalysis b/js/src/devtools/automation/variants/rootanalysis index 508e1e2db2..6d0873493d 100644 --- a/js/src/devtools/automation/variants/rootanalysis +++ b/js/src/devtools/automation/variants/rootanalysis @@ -1,5 +1,5 @@ { - "configure-args": "--enable-stdcxx-compat --enable-ctypes", + "configure-args": "--enable-ctypes", "optimize": true, "debug": true, "env": { -- cgit v1.2.3