Page MenuHomeFreeBSD

libcxxrt: add padding in __cxa_allocate_* to fix alignment
ClosedPublic

Authored by emaste on Jul 21 2016, 2:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 25 2022, 2:24 PM
Unknown Object (File)
Dec 25 2022, 2:24 PM
Unknown Object (File)
Dec 25 2022, 2:22 PM
Unknown Object (File)
Dec 25 2022, 2:20 PM
Unknown Object (File)
Dec 24 2022, 1:37 PM
Unknown Object (File)
Dec 23 2022, 9:26 AM
Unknown Object (File)
Dec 13 2022, 9:27 PM
Unknown Object (File)
Feb 7 2017, 4:26 PM
Subscribers

Details

Summary

Prior to the addition of the referenceCount in __cxa_exception the unwindHeader was at offset 0x50, and it requires 16-byte alignment. Add padding in the same location that it will appear in libstdc++.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste retitled this revision from to libcxxrt: add padding to __cxa_exception to fix alignment.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added reviewers: dim, theraven, ed.
emaste added a subscriber: gjb.
emaste retitled this revision from libcxxrt: add padding to __cxa_exception to fix alignment to libcxxrt: add padding in __cxa_allocate_* to fix alignment.

Avoid changing the __cxa_exception ABI in 11.

The addition of the referenceCount to __cxa_allocate_exception put the unwindHeader at offset 0x58, but it requires 16-byte alignment. In order to avoid changing the broken __cxa_exception ABI (and thus breaking its consumers), add explicit padding in the allocation routins (and account for it when freeing).

contrib/libcxxrt/exception.cc
576–582 ↗(On Diff #18633)

Should this be // comments instead?

dim edited edge metadata.

LGTM. This looks like the least intrusive solution.

contrib/libcxxrt/exception.cc
576–582 ↗(On Diff #18633)

Not necessary, for instance the block below it uses /**, which appears to be used for longer comments (though not very consistently).

This revision is now accepted and ready to land.Jul 21 2016, 6:02 PM
This revision was automatically updated to reflect the committed changes.
head/contrib/libcxxrt/exception.cc
583

It would be nice if this could be computed with offsetof(), sizeof() and alignof(), rather than being hard-coded.