Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Fix issue 20019: Symbol not found: _dyld_enumerate_tlv_storage on macOS 10.15 #172

Merged

Conversation

lionello
Copy link

@lionello lionello commented Feb 1, 2020

Ported from 378fc6d

The symbol dyld_enumerate_tlv_storage has been used to iterate all
the thread local storage addresses and registered them as roots with
the garbage collector.

The symbol has always been a private symbol, not part of the public
API. In the latest version of macOS, 10.15 it has been removed.

This replaces the usage of dyld_enumerate_tlv_storage by manually
iterating the TLV sections of all images and get key that the dynamic
loader has setup for each TLS symbol. The key is then used to get the
base address of the TLV storage.

@kinke
Copy link
Member

kinke commented Feb 1, 2020

The correct branch for 0.17.x is ldc-ltsmaster.

@lionello lionello changed the base branch from release-0.17.3 to ldc-ltsmaster February 2, 2020 01:57
@lionello lionello requested a review from kinke February 2, 2020 01:58
@lionello
Copy link
Author

lionello commented Feb 2, 2020

Thanks @kinke . Updated.

@lionello
Copy link
Author

@kinke Any idea who can review this? It's blocking the bootstrap process on MacOS 10.15

@thewilsonator
Copy link

This otherwise looks alright to me.

…OS 10.15

Ported from 378fc6d

The symbol `dyld_enumerate_tlv_storage` has been used to iterate all
the thread local storage addresses and registered them as roots with
the garbage collector.

The symbol has always been a private symbol, not part of the public
API. In the latest version of macOS, 10.15 it has been removed.

This replaces the usage of `dyld_enumerate_tlv_storage` by manually
iterating the TLV sections of all images and get key that the dynamic
loader has setup for each TLS symbol. The key is then used to get the
base address of the TLV storage.
Copy link

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge it tomorrow if @kinke doesn't get to it first. N.B you will want to do an ldc-developers/ldc ltsmaster PR to update its runtime/druntime git submodule.

src/rt/sections_ldc.d Outdated Show resolved Hide resolved
@kinke
Copy link
Member

kinke commented Feb 13, 2020

@lionello: If you care about the nixOS package, then it'd be worthwhile to try to overcome the bootstrapping via ltsmaster (via GDC or the previous LDC package if possible). If that's somehow not possible, then an intermediate compiler should be used to compile itself for the final binaries; an ltsmaster host compiler comes with limitations (--lowmem not usable, CTFE limits for x86 math etc.).

@lionello
Copy link
Author

@kinke Yeah I mostly use D through Nix and this blocked me since the update to Catalina. What I planned to do is to make the bootstrapping more configurable by having both dmd and ldc get an attribute DMD which can set to which compiler you want to use for bootstrapping. This way we can even set it to a pinned (and cached by Nix) older DMD binary. I'd still have it default to LDC0.16 for now.

@thewilsonator thewilsonator merged commit 4b5ca3e into ldc-developers:ldc-ltsmaster Feb 23, 2020
@lionello lionello deleted the fix-macos-catalina branch February 24, 2020 08:26
@lionello
Copy link
Author

Will merge it tomorrow if @kinke doesn't get to it first. N.B you will want to do an ldc-developers/ldc ltsmaster PR to update its runtime/druntime git submodule.

@thewilsonator please see ldc-developers/ldc#3337

kinke pushed a commit that referenced this pull request Feb 24, 2020
…OS 10.15 (#172)

Fix issue 20019: Symbol not found: _dyld_enumerate_tlv_storage on macOS 10.15

Ported from 378fc6d

The symbol `dyld_enumerate_tlv_storage` has been used to iterate all
the thread local storage addresses and registered them as roots with
the garbage collector.

The symbol has always been a private symbol, not part of the public
API. In the latest version of macOS, 10.15 it has been removed.

This replaces the usage of `dyld_enumerate_tlv_storage` by manually
iterating the TLV sections of all images and get key that the dynamic
loader has setup for each TLS symbol. The key is then used to get the
base address of the TLV storage.
@lionello
Copy link
Author

@kinke Re: Nix bootstrapping, I made this PR: NixOS/nixpkgs#82694

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants