Implement the betterC switch like DMD does.#1872
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 |
dnadlinger
left a comment
There was a problem hiding this comment.
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.
Why would we require __dmd_personality_v0 in the first place?
There was a problem hiding this comment.
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.
The MSVC libs are pulled in exclusively via the C parts in druntime lib. :/
There was a problem hiding this comment.
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 ?
f264531 to
7c6cc42
Compare
| extern(C) void mainCRTStartup() { } | ||
| } | ||
|
|
||
| extern(C) __gshared void* _d_dso_registry; |
There was a problem hiding this comment.
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 (
28vs38) and the resulting executable actually runs as we don't emit anydsosection (which explains the former) and no code that fondles with_d_dso_registry(which explains the latter).