Skip to content

remove obsolete extern declaration of main() - #23473

Merged
rikkimax merged 1 commit into
dlang:masterfrom
WalterBright:main2
Jul 28, 2026
Merged

remove obsolete extern declaration of main()#23473
rikkimax merged 1 commit into
dlang:masterfrom
WalterBright:main2

Conversation

@WalterBright

Copy link
Copy Markdown
Member

That extern declaration was causing the Mac linker to error out. And it took me a while to figure out where the extra declaration was coming from.

@WalterBright WalterBright added the Arch:Aarch64 Issues specific to Arm 64 label Jul 27, 2026
@rikkimax

Copy link
Copy Markdown
Contributor

Given that this was working for x86, this smells, and it does seem odd that multiple externs are resulting in an error.

@WalterBright

Copy link
Copy Markdown
Member Author

The linker for the other platforms will merge the duplicates. The linker for Arm64 does not. I cannot fix the linker.

@rikkimax

Copy link
Copy Markdown
Contributor

Have you confirmed that with clang?

It could be something on our end with flags.

@WalterBright

Copy link
Copy Markdown
Member Author

Have you confirmed that with clang?

? I use the Mac clang ld linker, which dies when it sees two declarations with the same name. Chatgpt also told me that it was broken to have such. I can't fix the linker, I have to live with it.

Eliminating the duplicate in the code generation is a good solution.

There's another one I have to eliminate - the _Dmain duplication, which is turning out to be a bit harder to remove. core.internal.entrypoint is the culprit on that one.

Please merge this so I can move on with fixing the _Dmain problem.

@rikkimax

Copy link
Copy Markdown
Contributor

I am meaning to use clang with source files to generate multiple declarations, does it differ from the object file dmd is generating?

Please confirm, it could be hiding a different bug in dmd, if clang does the same then yeah I'll merge it.

@WalterBright

Copy link
Copy Markdown
Member Author

If you make multiple declarations of the same name in the same object file, it will work with x86_64, but not with Arm64.

@rikkimax
rikkimax merged commit 304ded6 into dlang:master Jul 28, 2026
42 checks passed
@WalterBright

Copy link
Copy Markdown
Member Author

thank you!

@WalterBright
WalterBright deleted the main2 branch July 28, 2026 05:25
@rikkimax

Copy link
Copy Markdown
Contributor

thank you!

Now you get one :P

#23314

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants