summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-11-09 12:52:52 +0000
committerMoonchild <moonchild@palemoon.org>2023-11-09 12:52:52 +0000
commitad134c48d60e81f6a04bfbcd990d38b2dd9ba389 (patch)
tree2b0e4d5d4d3f3c5fc67ad4dc4e63150cd2336ec6
parente4643f5bed2cdc600fc29900fe3b4d22e25763bc (diff)
parent6e0ec4b5bc6fc670bbe7914ce69e428995680263 (diff)
downloaduxp-ad134c48d60e81f6a04bfbcd990d38b2dd9ba389.tar.gz
Merge pull request 'Remove --enable-stdcxx-compat option.' (#2374) from athenian200/UXP:old-stdcxx-compat-cleanup into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2374
-rw-r--r--build/clang-plugin/Makefile.in7
-rw-r--r--build/moz.configure/old.configure1
-rw-r--r--build/templates.mozbuild21
-rw-r--r--build/unix/moz.build3
-rw-r--r--build/unix/mozconfig.stdcxx15
-rw-r--r--build/unix/mozconfig.tsan2
-rw-r--r--build/unix/stdc++compat/Makefile.in7
-rw-r--r--build/unix/stdc++compat/moz.build23
-rw-r--r--build/unix/stdc++compat/stdc++compat.cpp78
-rw-r--r--config/config.mk34
-rw-r--r--config/rules.mk6
-rw-r--r--js/src/devtools/automation/variants/arm-sim2
-rw-r--r--js/src/devtools/automation/variants/arm-sim-osx2
-rw-r--r--js/src/devtools/automation/variants/arm64-sim2
-rw-r--r--js/src/devtools/automation/variants/compacting2
-rw-r--r--js/src/devtools/automation/variants/rootanalysis2
-rw-r--r--old-configure.in17
-rw-r--r--python/mozbuild/mozbuild/configure/libstdcxx.py81
18 files changed, 5 insertions, 300 deletions
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/moz.configure/old.configure b/build/moz.configure/old.configure
index 492bb94d66..f1fe273c3b 100644
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -235,7 +235,6 @@ def old_configure_options(*options):
'--enable-small-chunk-size',
'--enable-startup-notification',
'--enable-startupcache',
- '--enable-stdcxx-compat',
'--enable-strip',
'--enable-synth-pico',
'--enable-system-cairo',
diff --git a/build/templates.mozbuild b/build/templates.mozbuild
index 4bf63cfc53..1392a6655b 100644
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -8,9 +8,6 @@ def Binary():
'''Generic template for target binaries. Meant to be used by other
templates.'''
- if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
- USE_LIBS += ['stdc++compat']
-
# Ideally, we'd support not adding this to the LIB_IS_C_ONLY case,
# but that variable is actually only set in db/sqlite/src, which
# doesn't build a shared library on the relevant platforms anyways.
@@ -78,26 +75,10 @@ def Framework(name):
@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'):
@@ -109,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 <ostream>
-#include <istream>
-#include <string>
-#include <stdarg.h>
-#include <stdio.h>
-#include <mozilla/Assertions.h>
-
-/* 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/config.mk b/config/config.mk
index 2d1ff365b1..2029889728 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -526,45 +526,11 @@ EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
endif
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
-# $(call CHECK_SYMBOLS,lib,PREFIX,dep_name,test)
-# Checks that the given `lib` doesn't contain dependency on symbols with a
-# version starting with `PREFIX`_ and matching the `test`. `dep_name` is only
-# used for the error message.
-# `test` is an awk expression using the information in the variable `v` which
-# contains a list of version items ([major, minor, ...]).
-define CHECK_SYMBOLS
-@$(TOOLCHAIN_PREFIX)readelf -sW $(1) | \
-awk '$$8 ~ /@$(2)_/ { \
- split($$8,a,"@"); \
- split(a[2],b,"_"); \
- split(b[2],v,"."); \
- if ($(4)) { \
- if (!found) { \
- print "TEST-UNEXPECTED-FAIL | check_stdcxx | We do not want these $(3) symbol versions to be used:" \
- } \
- print " ",$$8; \
- found=1 \
- } \
-} \
-END { \
- if (found) { \
- exit(1) \
- } \
-}'
-endef
-
-ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION)$(MOZ_LIBSTDCXX_HOST_VERSION))
-CHECK_STDCXX = $(call CHECK_SYMBOLS,$(1),GLIBCXX,libstdc++,v[1] > 3 || (v[1] == 3 && v[2] == 4 && v[3] > 16))
-CHECK_GLIBC = $(call CHECK_SYMBOLS,$(1),GLIBC,libc,v[1] > 2 || (v[1] == 2 && v[2] > 12))
-endif
-
ifeq (,$(filter $(OS_TARGET),WINNT Darwin))
CHECK_TEXTREL = @$(TOOLCHAIN_PREFIX)readelf -d $(1) | grep TEXTREL > /dev/null && echo 'TEST-UNEXPECTED-FAIL | check_textrel | We do not want text relocations in libraries and programs' || true
endif
define CHECK_BINARY
-$(call CHECK_GLIBC,$(1))
-$(call CHECK_STDCXX,$(1))
$(call CHECK_TEXTREL,$(1))
$(call LOCAL_CHECKS,$(1))
$(call CHECK_MOZGLUE_ORDER,$(1))
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": {
diff --git a/old-configure.in b/old-configure.in
index 41f0941164..8785bc9467 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -3857,23 +3857,6 @@ if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
fi # COMPILE_ENVIRONMENT and others.
dnl ========================================================
-dnl = libstdc++ compatibility hacks
-dnl ========================================================
-
-STDCXX_COMPAT=
-MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
-[ --enable-stdcxx-compat Enable compatibility with older libstdc++],
- STDCXX_COMPAT=1)
-
-if test -n "$STDCXX_COMPAT"; then
- eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
- AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
- AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
- CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
- HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
-fi
-
-dnl ========================================================
dnl = frontend JS debug mode
dnl ========================================================
diff --git a/python/mozbuild/mozbuild/configure/libstdcxx.py b/python/mozbuild/mozbuild/configure/libstdcxx.py
deleted file mode 100644
index cab0ccb11d..0000000000
--- a/python/mozbuild/mozbuild/configure/libstdcxx.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/python
-# 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/.
-
-
-# This script find the version of libstdc++ and prints it as single number
-# with 8 bits per element. For example, GLIBCXX_3.4.10 becomes
-# 3 << 16 | 4 << 8 | 10 = 197642. This format is easy to use
-# in the C preprocessor.
-
-# We find out both the host and target versions. Since the output
-# will be used from shell, we just print the two assignments and evaluate
-# them from shell.
-
-from __future__ import absolute_import
-
-import os
-import subprocess
-import re
-
-re_for_ld = re.compile('.*\((.*)\).*')
-
-def parse_readelf_line(x):
- """Return the version from a readelf line that looks like:
- 0x00ec: Rev: 1 Flags: none Index: 8 Cnt: 2 Name: GLIBCXX_3.4.6
- """
- return x.split(':')[-1].split('_')[-1].strip()
-
-def parse_ld_line(x):
- """Parse a line from the output of ld -t. The output of gold is just
- the full path, gnu ld prints "-lstdc++ (path)".
- """
- t = re_for_ld.match(x)
- if t:
- return t.groups()[0].strip()
- return x.strip()
-
-def split_ver(v):
- """Covert the string '1.2.3' into the list [1,2,3]
- """
- return [int(x) for x in v.split('.')]
-
-def cmp_ver(a, b):
- """Compare versions in the form 'a.b.c'
- """
- for (i, j) in zip(split_ver(a), split_ver(b)):
- if i != j:
- return i - j
- return 0
-
-def encode_ver(v):
- """Encode the version as a single number.
- """
- t = split_ver(v)
- return t[0] << 16 | t[1] << 8 | t[2]
-
-def find_version(e):
- """Given the value of environment variable CXX or HOST_CXX, find the
- version of the libstdc++ it uses.
- """
- args = e.split()
- args += ['-shared', '-Wl,-t']
- p = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
- candidates = [x for x in p.stdout if 'libstdc++.so' in x]
- if not candidates:
- return ''
- assert len(candidates) == 1
- libstdcxx = parse_ld_line(candidates[-1])
-
- p = subprocess.Popen(['readelf', '-V', libstdcxx], stdout=subprocess.PIPE)
- versions = [parse_readelf_line(x)
- for x in p.stdout.readlines() if 'Name: GLIBCXX' in x]
- last_version = sorted(versions, cmp = cmp_ver)[-1]
- return encode_ver(last_version)
-
-if __name__ == '__main__':
- cxx_env = os.environ['CXX']
- print 'MOZ_LIBSTDCXX_TARGET_VERSION=%s' % find_version(cxx_env)
- host_cxx_env = os.environ.get('HOST_CXX', cxx_env)
- print 'MOZ_LIBSTDCXX_HOST_VERSION=%s' % find_version(host_cxx_env)