Add a load of ABI compat workarounds for older libstdc++ versions

This commit is contained in:
Asher Baker 2019-04-28 19:09:35 +00:00
parent b302f0067a
commit d1786070c4
4 changed files with 62 additions and 6 deletions

View File

@ -99,6 +99,7 @@ class SM:
self.compiler.AddToListVar('CXXFLAGS', '-Wno-implicit-exception-spec-mismatch')
self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
self.compiler.AddToListVar('CDEFINES', 'GNUC')
self.compiler.AddToListVar('CDEFINES', '_GLIBCXX_USE_CXX11_ABI=0')
if self.vendor == 'gcc':
self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
elif isinstance(cxx, Cpp.MSVC):

View File

@ -30,7 +30,7 @@ fi
cd build
../src/configure --enable-m32
../src/configure --enable-m32 CXXFLAGS="-g -O2 -D_GLIBCXX_USE_CXX11_ABI=0"
make src/tools/linux/dump_syms/dump_syms
make src/client/linux/libbreakpad_client.a

View File

@ -54,6 +54,36 @@ public:
}
};
// Taken from https://hg.mozilla.org/mozilla-central/file/3eb7623b5e63b37823d5e9c562d56e586604c823/build/unix/stdc%2B%2Bcompat/stdc%2B%2Bcompat.cpp
extern "C" void __attribute__((weak)) __cxa_throw_bad_array_new_length() {
abort();
}
namespace std {
/* We shouldn't be throwing exceptions at all, but it sadly turns out
we call STL (inline) functions that do. */
void __attribute__((weak)) __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);
}
} // namespace std
// Updated versions of the SM ones for C++14
void operator delete(void *ptr, size_t sz) {
free(ptr);
}
void operator delete[](void *ptr, size_t sz) {
free(ptr);
}
#elif defined _WINDOWS
#define _STDINT // ~.~
#include "client/windows/handler/exception_handler.h"
@ -71,7 +101,6 @@ public:
#include <sstream>
#include <streambuf>
#include <random>
Accelerator g_accelerator;
SMEXT_LINK(&g_accelerator);
@ -390,11 +419,9 @@ class UploadThread: public IThread
if (!serverId[0]) {
serverIdFile = fopen(path, "w");
if (serverIdFile) {
std::random_device rd;
std::uniform_int_distribution<int> dist(0, 255);
g_pSM->Format(serverId, sizeof(serverId), "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
dist(rd), dist(rd), dist(rd), dist(rd), dist(rd), dist(rd), 0x40 | (dist(rd) & 0x0F), dist(rd),
0x80 | (dist(rd) & 0x3F), dist(rd), dist(rd), dist(rd), dist(rd), dist(rd), dist(rd), dist(rd));
rand() % 255, rand() % 255, rand() % 255, rand() % 255, rand() % 255, rand() % 255, 0x40 | ((rand() % 255) & 0x0F), rand() % 255,
0x80 | ((rand() % 255) & 0x3F), rand() % 255, rand() % 255, rand() % 255, rand() % 255, rand() % 255, rand() % 255, rand() % 255);
fputs(serverId, serverIdFile);
fclose(serverIdFile);
}

View File

@ -0,0 +1,28 @@
From dbfb9811ef8d9f4f2b19f50c0534c865ab3698c9 Mon Sep 17 00:00:00 2001
From: patches <patches@localhost>
Date: Sun, 28 Apr 2019 18:45:57 +0000
Subject: [PATCH 3/3] Avoid using _ZNSsC1ERKSsjRKSaIcE GLIBCXX symbol due to
version compat issues
---
src/common/dwarf/elf_reader.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/common/dwarf/elf_reader.cc b/src/common/dwarf/elf_reader.cc
index 4135a51a..bfaaeefe 100644
--- a/src/common/dwarf/elf_reader.cc
+++ b/src/common/dwarf/elf_reader.cc
@@ -1202,8 +1202,8 @@ const char *ElfReader::GetSectionInfoByName(const string &section_name,
bool ElfReader::SectionNamesMatch(const string &name, const string &sh_name) {
if ((name.find(".debug_", 0) == 0) && (sh_name.find(".zdebug_", 0) == 0)) {
- const string name_suffix(name, strlen(".debug_"));
- const string sh_name_suffix(sh_name, strlen(".zdebug_"));
+ const string name_suffix(&name.c_str()[strlen(".debug_")]);
+ const string sh_name_suffix(&sh_name.c_str()[strlen(".zdebug_")]);
return name_suffix == sh_name_suffix;
}
return name == sh_name;
--
2.17.2