dmd icon indicating copy to clipboard operation
dmd copied to clipboard

implement __d_dso_init for AArch64

Open WalterBright opened this issue 6 months ago • 1 comments

I wanted to use inline assembler for this, but I haven't written an inline assembler for AArch64 yet.

With this, we might be able to start attempting to compile druntime.

WalterBright avatar Jun 15 '25 05:06 WalterBright

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#21450"

dlang-bot avatar Jun 15 '25 05:06 dlang-bot

ping @thewilsonator @dkorpel

WalterBright avatar Jun 17 '25 05:06 WalterBright

I wanted to use inline assembler for this, but I haven't written an inline assembler for AArch64 yet.

Why inline assembler when the comments make it out to be trivial D code; and it is trivial D code that gdc+ldc have in their druntimes to implement this hook.

ibuclaw avatar Jun 17 '25 12:06 ibuclaw

Good question! The reasons are:

  • it's the only place that needs it
  • the backend is not set up to reference symbols that delineate sections
  • it's just a handful of lines of code

WalterBright avatar Jun 17 '25 17:06 WalterBright

Good question! The reasons are:

  • it's the only place that needs it
  • the backend is not set up to reference symbols that delineate sections
  • it's just a handful of lines of code

Fair point, its true that gdc and ldc support @section("minfo") void* __start_minfo;, which is a bit of an advantage.

https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gdc/Common-Attributes.html#index-section-function-attribute

ibuclaw avatar Jun 18 '25 11:06 ibuclaw

Thanks for the link. I'm reluctant to add such things without a demand for them, and dso_init for Elf is the only place I know of that needs it.

WalterBright avatar Jun 18 '25 21:06 WalterBright

Thanks for the link. I'm reluctant to add such things without a demand for them, and dso_init for Elf is the only place I know of that needs it.

I find it quite useful when dealing with non-standard binary formats, but I can just use a more capable compiler backend for that.

Herringway avatar Jun 18 '25 21:06 Herringway