[Issue 16856] D does not work on FreeBSD current (what will eventually be 12) due to libunwind

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 7 15:20:49 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=16856

--- Comment #5 from github-bugzilla at puremagic.com ---
Commits pushed to master at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/c56e8e0d8d599b1742fe85210f07adacf07e5e2a
Fix issue 16856: Apply correct alignment on the Unwind_Exception structure

In libundwind, _Unwind_Exception structure is defined as follows:

```
struct _Unwind_Exception
  {
    uint64_t exception_class;
    _Unwind_Exception_Cleanup_Fn exception_cleanup;
    unsigned long private_1;
    unsigned long private_2;
  } __attribute__((__aligned__));
```

so the alignment is done on the entire structure, and it
depends on the architecture. This sets the structure
to be 16bit aligned on the X86_64, so the binary layout
matches and that the C++ compiler's optimizations are still
valid (for example, on FreeBSD-12, exception handling was broken
because libunwind assumes correct alignment, so the fast but fragile
instructions were used.

https://github.com/dlang/druntime/commit/c7182eb2ef3d6cc57c3e3366028753306b4dceb7
Merge pull request #1823 from Burgos/exception_alignment

Fix issue 16856: Apply correct alignment on the Unwind_Exception stru…
merged-on-behalf-of: Jonathan M Davis <jmdavis at users.noreply.github.com>

--


More information about the Digitalmars-d-bugs mailing list