1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-21 23:27:39 +01:00

Workaround non-power-of-two i386 sizeof(long double) in src/mi/mempool.c

To ensure that we return properly aligned pointers from sos_alloc(),
MAX_ALIGN must be a power-of-two. On i386 the power-of-two assumption
fails as sizeof(long double) = 12. Fix this by rounding up to 16.
This commit is contained in:
Tommi Rantala 2012-09-19 13:57:07 +03:00
parent e6edad069c
commit c36a14f245

View file

@ -31,7 +31,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifdef __BIGGEST_ALIGNMENT__
# define MAX_ALIGN __BIGGEST_ALIGNMENT__
#else
# define MAX_ALIGN (sizeof (long double))
/* Crude hack to check that MAX_ALIGN is power-of-two.
* sizeof(long double) = 12 on i386. */
# define MAX_ALIGN_(n) (n < 8 ? 8 : \
n < 16 ? 16 : n)
# define MAX_ALIGN MAX_ALIGN_(sizeof (long double))
#endif
static char sos_memory[SOS_MEMORY_SIZE];