Bug 22520 – darwin: crt_destructor functions not executed on OSX 12

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Mac OS X
Creation time
2021-11-18T10:36:39Z
Last change time
2022-01-13T09:41:44Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2021-11-18T10:36:39Z
Failures seen on test17868.d and test17868b.d https://github.com/dlang/dmd/pull/13273#issuecomment-962907600
Comment #1 by ibuclaw — 2021-11-18T10:54:47Z
Starting from macOS 12.0, .mod_term_func entries are no longer ran.
Comment #2 by ibuclaw — 2021-11-18T10:58:19Z
So what we need to now do is generate a new crt_constructor function that registers static destructors with __cxa_atexit().
Comment #3 by ibuclaw — 2021-11-18T14:30:49Z
Upstream bug report with Apple: https://openradar.appspot.com/FB9733712 The OSS folks I spoke to seemed to think it was a bug, and so far the radar has not been closed as invalid yet. However, this change in clang seems to suggest it might be deprecated to use mod_term_funcs anyway: https://reviews.llvm.org/D45578
Comment #4 by bugzilla — 2021-11-22T03:17:21Z
But is __cxa_atexit() compatible with older OSX's ? What OS version did it start with?
Comment #5 by ibuclaw — 2021-11-22T14:27:25Z
(In reply to Walter Bright from comment #4) > But is __cxa_atexit() compatible with older OSX's ? What OS version did it > start with? It is in OSX 10.5, possibly older versions too. That far exceeds DMD's minimum version requirement of 10.9.
Comment #6 by ibuclaw — 2022-01-13T09:41:44Z