svn commit: r261645 - in stable/9: contrib/libcxxrt lib/libcxxrt
Dimitry Andric
dim at FreeBSD.org
Sun Feb 9 00:37:18 UTC 2014
Author: dim
Date: Sun Feb 9 00:37:16 2014
New Revision: 261645
URL: http://svnweb.freebsd.org/changeset/base/261645
Log:
MFC r255093 (by theraven):
Don't use _Unwind_Backtrace() on ARM as it's currently missing from
our libgcc_s. andrew@ has patches to add it, so this can be reverted
and sync'd with upstream later.
MFC r255815 (by theraven):
Import a new libcxxrt. This fixes some potential crashing in the
demangler.
MFC r260553 (by theraven):
Add missing C++11 typeinfos to the libcxxrt version script.
PR: 185663
Modified:
stable/9/contrib/libcxxrt/exception.cc
stable/9/contrib/libcxxrt/libelftc_dem_gnu3.c
stable/9/contrib/libcxxrt/typeinfo.cc
stable/9/contrib/libcxxrt/unwind-itanium.h
stable/9/lib/libcxxrt/Version.map
Directory Properties:
stable/9/contrib/libcxxrt/ (props changed)
stable/9/lib/libcxxrt/ (props changed)
Modified: stable/9/contrib/libcxxrt/exception.cc
==============================================================================
--- stable/9/contrib/libcxxrt/exception.cc Sun Feb 9 00:34:21 2014 (r261644)
+++ stable/9/contrib/libcxxrt/exception.cc Sun Feb 9 00:37:16 2014 (r261645)
@@ -715,7 +715,9 @@ static void report_failure(_Unwind_Reaso
if (status == 0) { free(demangled); }
// Print a back trace if no handler is found.
// TODO: Make this optional
+#ifndef __arm__
_Unwind_Backtrace(trace, 0);
+#endif
break;
}
std::terminate();
Modified: stable/9/contrib/libcxxrt/libelftc_dem_gnu3.c
==============================================================================
--- stable/9/contrib/libcxxrt/libelftc_dem_gnu3.c Sun Feb 9 00:34:21 2014 (r261644)
+++ stable/9/contrib/libcxxrt/libelftc_dem_gnu3.c Sun Feb 9 00:37:16 2014 (r261645)
@@ -405,6 +405,7 @@ static int cpp_demangle_read_expression_
const char *, size_t, const char *, size_t);
static int cpp_demangle_read_function(struct cpp_demangle_data *, int *,
struct vector_type_qualifier *);
+static int cpp_demangle_local_source_name(struct cpp_demangle_data *ddata);
static int cpp_demangle_read_local_name(struct cpp_demangle_data *);
static int cpp_demangle_read_name(struct cpp_demangle_data *);
static int cpp_demangle_read_nested_name(struct cpp_demangle_data *);
@@ -453,13 +454,22 @@ __cxa_demangle_gnu3(const char *org)
struct cpp_demangle_data ddata;
ssize_t org_len;
unsigned int limit;
- char *rtn;
+ char *rtn = NULL;
if (org == NULL)
return (NULL);
+ org_len = strlen(org);
+ if (org_len > 11 && !strncmp(org, "_GLOBAL__I_", 11)) {
+ if ((rtn = malloc(org_len + 19)) == NULL)
+ return (NULL);
+ snprintf(rtn, org_len + 19,
+ "global constructors keyed to %s", org + 11);
+ return (rtn);
+ }
+
// Try demangling as a type for short encodings
- if (((org_len = strlen(org)) < 2) || (org[0] != '_' || org[1] != 'Z' )) {
+ if ((org_len < 2) || (org[0] != '_' || org[1] != 'Z' )) {
if (!cpp_demangle_data_init(&ddata, org))
return (NULL);
if (!cpp_demangle_read_type(&ddata, 0))
@@ -467,13 +477,6 @@ __cxa_demangle_gnu3(const char *org)
rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL);
goto clean;
}
- if (org_len > 11 && !strncmp(org, "_GLOBAL__I_", 11)) {
- if ((rtn = malloc(org_len + 19)) == NULL)
- return (NULL);
- snprintf(rtn, org_len + 19,
- "global constructors keyed to %s", org + 11);
- return (rtn);
- }
if (!cpp_demangle_data_init(&ddata, org + 2))
@@ -604,13 +607,12 @@ cpp_demangle_push_fp(struct cpp_demangle
return (0);
rtn = 0;
- if ((len = strlen(f)) > 0 &&
- cpp_demangle_push_str(ddata, f, len))
- rtn = 1;
+ if ((len = strlen(f)) > 0)
+ rtn = cpp_demangle_push_str(ddata, f, len);
free(f);
- return (0);
+ return (rtn);
}
static int
@@ -655,6 +657,7 @@ cpp_demangle_push_subst_v(struct cpp_dem
return (0);
rtn = cpp_demangle_push_subst(ddata, str, str_len);
+
free(str);
return (rtn);
@@ -1868,9 +1871,18 @@ static int
cpp_demangle_read_sname(struct cpp_demangle_data *ddata)
{
long len;
+ int err;
if (ddata == NULL || cpp_demangle_read_number(ddata, &len) == 0 ||
- len <= 0 || cpp_demangle_push_str(ddata, ddata->cur, len) == 0)
+ len <= 0)
+ return (0);
+
+ if (len == 12 && (memcmp("_GLOBAL__N_1", ddata->cur, 12) == 0))
+ err = cpp_demangle_push_str(ddata, "(anonymous namespace)", 21);
+ else
+ err = cpp_demangle_push_str(ddata, ddata->cur, len);
+
+ if (err == 0)
return (0);
assert(ddata->output.size > 0);
@@ -2054,7 +2066,7 @@ clean:
free(subst_str);
vector_str_dest(&v);
- return (1);
+ return (rtn);
}
static int
@@ -2996,6 +3008,40 @@ cpp_demangle_read_uqname(struct cpp_dema
if (ELFTC_ISDIGIT(*ddata->cur) != 0)
return (cpp_demangle_read_sname(ddata));
+
+ /* local source name */
+ if (*ddata->cur == 'L')
+ return (cpp_demangle_local_source_name(ddata));
+
+ return (1);
+}
+
+/*
+ * Read local source name.
+ *
+ * References:
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31775
+ * http://gcc.gnu.org/viewcvs?view=rev&revision=124467
+ */
+static int
+cpp_demangle_local_source_name(struct cpp_demangle_data *ddata)
+{
+ /* L */
+ if (ddata == NULL || *ddata->cur != 'L')
+ return (0);
+ ++ddata->cur;
+
+ /* source name */
+ if (!cpp_demangle_read_sname(ddata))
+ return (0);
+
+ /* discriminator */
+ if (*ddata->cur == '_') {
+ ++ddata->cur;
+ while (ELFTC_ISDIGIT(*ddata->cur) != 0)
+ ++ddata->cur;
+ }
+
return (1);
}
Modified: stable/9/contrib/libcxxrt/typeinfo.cc
==============================================================================
--- stable/9/contrib/libcxxrt/typeinfo.cc Sun Feb 9 00:34:21 2014 (r261644)
+++ stable/9/contrib/libcxxrt/typeinfo.cc Sun Feb 9 00:37:16 2014 (r261645)
@@ -86,7 +86,18 @@ extern "C" char* __cxa_demangle(const ch
if (NULL != demangled)
{
size_t len = strlen(demangled);
- buf = (char*)realloc(buf, len+1);
+ if (buf == NULL)
+ {
+ if (n)
+ {
+ *n = len;
+ }
+ return demangled;
+ }
+ if (*n < len+1)
+ {
+ buf = (char*)realloc(buf, len+1);
+ }
if (0 != buf)
{
memcpy(buf, demangled, len);
Modified: stable/9/contrib/libcxxrt/unwind-itanium.h
==============================================================================
--- stable/9/contrib/libcxxrt/unwind-itanium.h Sun Feb 9 00:34:21 2014 (r261644)
+++ stable/9/contrib/libcxxrt/unwind-itanium.h Sun Feb 9 00:37:16 2014 (r261645)
@@ -80,7 +80,7 @@ struct _Unwind_Exception
_Unwind_Exception_Cleanup_Fn exception_cleanup;
unsigned long private_1;
unsigned long private_2;
- };
+ } ;
extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,
Modified: stable/9/lib/libcxxrt/Version.map
==============================================================================
--- stable/9/lib/libcxxrt/Version.map Sun Feb 9 00:34:21 2014 (r261644)
+++ stable/9/lib/libcxxrt/Version.map Sun Feb 9 00:37:16 2014 (r261645)
@@ -111,6 +111,19 @@ CXXABI_1.3 {
"typeinfo for void";
"typeinfo for wchar_t const*";
"typeinfo for wchar_t";
+ # C++11 typeinfo not understood by our linker
+ # std::nullptr_t
+ _ZTIDn;_ZTIPDn;_ZTIPKDn;
+ # char16_t
+ _ZTIDi;_ZTIPDi;_ZTIPKDi;
+ # char32_t
+ _ZTIDs;_ZTIPDs;_ZTIPKDs;
+ # IEEE 754r decimal floating point
+ _ZTIDd;_ZTIPDd;_ZTIPKDd;
+ _ZTIDe;_ZTIPDe;_ZTIPKDe;
+ _ZTIDf;_ZTIPDf;_ZTIPKDf;
+ # IEEE 754r half-precision floating point
+ _ZTIDh;_ZTIPDh;_ZTIPKDh;
"typeinfo for bool*";
"typeinfo for wchar_t*";
@@ -195,6 +208,19 @@ CXXABI_1.3 {
"typeinfo name for void*";
"typeinfo name for unsigned int*";
"typeinfo name for float*";
+ # C++11 typeinfo not understood by our linker
+ # std::nullptr_t
+ _ZTSDn;_ZTIPDn;_ZTIPKDn;
+ # char16_t
+ _ZTSDi;_ZTIPDi;_ZTIPKDi;
+ # char32_t
+ _ZTSDs;_ZTIPDs;_ZTIPKDs;
+ # IEEE 754r decimal floating point
+ _ZTSDd;_ZTIPDd;_ZTIPKDd;
+ _ZTSDe;_ZTIPDe;_ZTIPKDe;
+ _ZTSDf;_ZTIPDf;_ZTIPKDf;
+ # IEEE 754r half-precision floating point
+ _ZTSDh;_ZTIPDh;_ZTIPKDh;
"typeinfo name for __cxxabiv1::__array_type_info";
"typeinfo name for __cxxabiv1::__class_type_info";
More information about the svn-src-stable-9
mailing list