Revert 3c4fd2463b
since upstream libcxxrt fixed it in another way
In0ee0dbfb0d
I imported a more recent libcxxrt snapshot, which includes an upstream fix for the padding of struct _Unwind_Exception:e458560b7e
However, we also had a similar fix in our tree as: https://cgit.freebsd.org/src/commit/?id=3c4fd2463bb29f65ef1404011fcb31e508cdf2e2 Since having both fixes makes the struct too large again, it leads to SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This is most easily tested by running kyua without any arguments. It looks like our fix is no longer needed now, so revert it to reduce diffs against upstream. PR: 253226 Reviewed by: arichardson, kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28799
This commit is contained in:
parent
f9e1cd6c99
commit
d2b3fadf2d
@ -572,19 +572,6 @@ static void free_exception(char *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __LP64__
|
|
||||||
/**
|
|
||||||
* There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte
|
|
||||||
* alignment but it was broken by the addition of the referenceCount.
|
|
||||||
* The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep
|
|
||||||
* compatibility with consumers of the broken __cxa_exception, explicitly add
|
|
||||||
* padding on allocation (and account for it on free).
|
|
||||||
*/
|
|
||||||
static const int exception_alignment_padding = 8;
|
|
||||||
#else
|
|
||||||
static const int exception_alignment_padding = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates an exception structure. Returns a pointer to the space that can
|
* Allocates an exception structure. Returns a pointer to the space that can
|
||||||
* be used to store an object of thrown_size bytes. This function will use an
|
* be used to store an object of thrown_size bytes. This function will use an
|
||||||
@ -593,19 +580,16 @@ static const int exception_alignment_padding = 0;
|
|||||||
*/
|
*/
|
||||||
extern "C" void *__cxa_allocate_exception(size_t thrown_size)
|
extern "C" void *__cxa_allocate_exception(size_t thrown_size)
|
||||||
{
|
{
|
||||||
size_t size = exception_alignment_padding + sizeof(__cxa_exception) +
|
size_t size = thrown_size + sizeof(__cxa_exception);
|
||||||
thrown_size;
|
|
||||||
char *buffer = alloc_or_die(size);
|
char *buffer = alloc_or_die(size);
|
||||||
return buffer + exception_alignment_padding + sizeof(__cxa_exception);
|
return buffer+sizeof(__cxa_exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void *__cxa_allocate_dependent_exception(void)
|
extern "C" void *__cxa_allocate_dependent_exception(void)
|
||||||
{
|
{
|
||||||
size_t size = exception_alignment_padding +
|
size_t size = sizeof(__cxa_dependent_exception);
|
||||||
sizeof(__cxa_dependent_exception);
|
|
||||||
char *buffer = alloc_or_die(size);
|
char *buffer = alloc_or_die(size);
|
||||||
return buffer + exception_alignment_padding +
|
return buffer+sizeof(__cxa_dependent_exception);
|
||||||
sizeof(__cxa_dependent_exception);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -633,8 +617,7 @@ extern "C" void __cxa_free_exception(void *thrown_exception)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free_exception(reinterpret_cast<char*>(ex) -
|
free_exception(reinterpret_cast<char*>(ex));
|
||||||
exception_alignment_padding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void releaseException(__cxa_exception *exception)
|
static void releaseException(__cxa_exception *exception)
|
||||||
@ -661,8 +644,7 @@ void __cxa_free_dependent_exception(void *thrown_exception)
|
|||||||
{
|
{
|
||||||
releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex)));
|
releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex)));
|
||||||
}
|
}
|
||||||
free_exception(reinterpret_cast<char*>(ex) -
|
free_exception(reinterpret_cast<char*>(ex));
|
||||||
exception_alignment_padding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user