mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
Merge remote-tracking branch 'origin/stable'
This commit is contained in:
commit
7d368925cc
2 changed files with 14 additions and 1 deletions
7
changelog/druntime.macos-15-4-segfault.dd
Normal file
7
changelog/druntime.macos-15-4-segfault.dd
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Fixed generated binaries crashing on macOS 15.4
|
||||||
|
|
||||||
|
macOS 15.4 has introduced an undocumented ABI change to the format of
|
||||||
|
thread local variable section, which causes almost all executable built with
|
||||||
|
previous D compiler versions to crash during initialization, if they use
|
||||||
|
DRuntime. This release introduces a mitigation for this issue that is
|
||||||
|
backwards compatible with previous versions of macOS.
|
|
@ -145,7 +145,13 @@ pthread_key_t firstTLVKey(const mach_header_64* header) pure nothrow @nogc
|
||||||
if ((section.flags & SECTION_TYPE) != S_THREAD_LOCAL_VARIABLES)
|
if ((section.flags & SECTION_TYPE) != S_THREAD_LOCAL_VARIABLES)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return section.firstTLVDescriptor(slide).key;
|
// NOTE: macOS 15.4 has started to fill the upper 32 bits of
|
||||||
|
// the `key` field with an additional number. Using the whole
|
||||||
|
// 64-bit field as a key results in a segmentation fault. Even
|
||||||
|
// though none of this appears to be documented anywhere, we
|
||||||
|
// assume that only the lower 32 bits are used for the actual
|
||||||
|
// key and this results in binaries that execute normally.
|
||||||
|
return section.firstTLVDescriptor(slide).key & 0xFFFF_FFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue