-
-
Notifications
You must be signed in to change notification settings - Fork 267
Implement the betterC switch like DMD does. #1872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
No tests! Can you try to include a test that shows that the resulting object file can be linked without druntime? |
Other issues:
|
OK ) |
@9il: Is it just that you'd like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be okay as a DMD compatibility thing. We might want to sit down and properly discuss our "minimal runtime" to come up with a sensible and flexible design rather than Walter's one-off hack.
// CHECK-NOT: ModuleInfoZ | ||
// CHECK-NOT: ModuleRefZ | ||
// CHECK-NOT: call void @ldc.register_dso | ||
extern(C) __gshared int __dmd_personality_v0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we require __dmd_personality_v0 in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a leftover from the testing against dmd, can be safely removed.
Appveyor shows that _mainCRTStartup
can't be found though, don't know why since I expect the MSVC crt to provide that anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MSVC libs are pulled in exclusively via the C parts in druntime lib. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's very bare metal we're running on then heh
Adding a stub declaration in a version(CRuntime_Microsoft)
would do the trick, no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, good idea.
f264531
to
7c6cc42
Compare
extern(C) void mainCRTStartup() { } | ||
} | ||
|
||
extern(C) __gshared void* _d_dso_registry; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? Doesn't that mean that more code emission needs to be disabled with -betterC
?
Namely, don't emit the ModuleInfo.
betterC (in my vision) should verify that compiled code does not depend on Druntime. A code can still use some generic code from Phobos. assertions in non release mode should be replaced with inlined checks that use libc to exit from the program. |
Please document the new switch in LDMD's usage output too. |
Could you add the description from DMD to
|
I amended the LDMD addition and pushed it directly to master (62a2252), so that it can be part of beta 4. |
Namely, don't emit the ModuleInfo.
Additionally, for the following code we emit less symbols than dmd (
28
vs38
) and the resulting executable actually runs as we don't emit anydso
section (which explains the former) and no code that fondles with_d_dso_registry
(which explains the latter).