Skip to content

add sections_darwin_rt.d#22723

Merged
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:sections
Mar 13, 2026
Merged

add sections_darwin_rt.d#22723
WalterBright merged 1 commit intodlang:masterfrom
WalterBright:sections

Conversation

@WalterBright
Copy link
Copy Markdown
Member

As gdc and ldc compile druntime for OSX AArch64, it is a bit of a mystery why this is not represented in src/rt/sections.d ??

@ibuclaw @kinke please weigh in!

@WalterBright WalterBright added Arch:Aarch64 Issues specific to Arm 64 Druntime Specific to druntime labels Mar 12, 2026
@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#22723"

Comment thread druntime/src/rt/sections.d Outdated
else version (X86)
public import rt.sections_osx_x86;
else version (AArch64)
public import rt.sections_darwin_rt;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't exist?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sections_darwin_64 != sections_darwin_rt

@ibuclaw
Copy link
Copy Markdown
Member

ibuclaw commented Mar 12, 2026

@ibuclaw @kinke please weigh in!

GDC has all logic in its own package gcc.sections.macho, there's likely some duplication, but there's a more that isn't as this code is dependent on how the compiler generates code (i.e: no native TLS in GCC).

@kinke
Copy link
Copy Markdown
Contributor

kinke commented Mar 12, 2026

And LDC basically uses a generalized rt.sections_elf_shared on all major platforms, incl. Darwin and Windows. Which paves the way for druntime-as-shared-library, but requires compiler support.

@WalterBright
Copy link
Copy Markdown
Member Author

src/rt/sections.d is in druntime/mak/SRCS, which is fed to Makefile. How does gdc and ldc avoid compiling it?

@kinke
Copy link
Copy Markdown
Contributor

kinke commented Mar 12, 2026

LDC doesn't use the Makefiles. The whole rt.sections* stuff is quite heavily modified for LDC, primarily the rt.sections_elf_shared. Should all be upstreamed eventually, but that's gonna require compiler support, so the incentive is extremely low.

@WalterBright
Copy link
Copy Markdown
Member Author

Is there any essential difference between the sections for AArch64 and X68_64 on the OSX?

@kinke
Copy link
Copy Markdown
Contributor

kinke commented Mar 12, 2026

I don't recall any OTOH, but it's been more than 5 years that LDC comes with a macOS arm64 package, so the memory is anything but fresh.

Edit: I've taken a quick look, and no, I can't spot any diff at all for arm64.

@WalterBright
Copy link
Copy Markdown
Member Author

@kinke thank you!

Copy link
Copy Markdown
Contributor

@kinke kinke left a comment

Choose a reason for hiding this comment

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

Should work fine. FWIW, rt.sections_darwin_64 (LDC only uses that file - I guess it's just the base helpers) uses D_LP64 as inclusion guard. So I think ideally rt.sections_osx_x86_64 would be renamed (to rt.sections_osx_64 or so), to make clear that it's the generic 64-bit implementation for Apple targets.

@WalterBright
Copy link
Copy Markdown
Member Author

ok I renamed the file

@WalterBright WalterBright merged commit 46baa87 into dlang:master Mar 13, 2026
42 checks passed
@WalterBright WalterBright deleted the sections branch March 13, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch:Aarch64 Issues specific to Arm 64 Druntime Specific to druntime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants