-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
fix Issue 17521 - -betterC programs should not link in Phobos by default #6918
Conversation
bc4fa5b
to
ab5ce3f
Compare
b8bb995
to
26ce0c7
Compare
|
Consider the program: compile on Win32 with |
|
Is there a document which enumerates the effects of |
|
I've been writing one. You're right, it is needed. But as betterC is a work in progress, I don't know yet what all it will need to do. |
26ce0c7
to
488b81c
Compare
It's not necessary to document what it will do; only what it currently does. |
|
After pondering this a little, it occurred to me that DMD should never link in Phobos or druntime automatically. Rather, I think such dependencies should be specified on a platform-by-platform basis using a dmd.conf, linker script, or some other configuration file that is distributed with the toolchain's package. |
👍 You need something like this anyway to handle druntime/phobos dependencies: Depending on the OS when linking an application with static libphobos/druntime you'll also have to explicitly link druntime or phobos dependencies (libdl, libz, on windows all the import libraries). Hardcoding this in the compiler is not a good idea. In GDC we create a phobos and druntime are still hardcoded here though. This is mostly to support simple shared/static library switching using |
| @@ -98,7 +98,8 @@ bool doUnwindEhFrame() | |||
| * g++ on FreeBSD does not generate mixed frames, while g++ on OSX and Linux does. | |||
| */ | |||
| assert(!(usednteh & ~(EHtry | EHcleanup))); | |||
| return (usednteh & (EHtry | EHcleanup)) || (config.exe & (EX_FREEBSD | EX_FREEBSD64)); | |||
| return (usednteh & (EHtry | EHcleanup)) || | |||
| (config.exe & (EX_FREEBSD | EX_FREEBSD64)) && !config.betterC; | |||
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.
Does this mean that exceptions will NEVER work if you use the -betterC switch?
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.
No. Just that the frame handler isn't by default on on FreeBSD.
|
IMHO, this is a good short term fix, but it's papering over the larger issue: way too much w/in phobos and druntime is dragged in when not needed or used. Andrei's work to kill off static this()'s will help a bunch. More investigation and effort needs to be put into making linking those libraries to be essentially free when no parts of them are used. IE, needing this flag is a sign that something somewhere is wrong and not addressing that head on is a problem. |
|
I agree with you, @braddr , but this issue has been twisting around for 15 years with no progress and little interest. With the switch, we find out if this is a real thing or not, and we find out exactly what needs to be done. |
|
@WalterBright, you need to put the |
- fixes Issue 11881, and 17521
|
On Mon, Jun 26, 2017 at 10:31:14AM -0700, Martin Nowak wrote:
We might want to remove the `_d_run_main` wrapper with `-betterC` as well.
Right now, it is generated, but not used, right?
Cuz I've been playing with the -betterC patches (this one plus the two I did) and find it actually works quite well and I didn't even think about _d_run_main...
|
I've updated the issue (https://issues.dlang.org/show_bug.cgi?id=11881#c18), just use an |
|
On Mon, Jun 26, 2017 at 10:42:00AM -0700, Martin Nowak wrote:
I've updated the issue (https://issues.dlang.org/show_bug.cgi?id=11881#c18), just use an `extern(C) main` and the wrapper won't be generated.
oh good, then we're all set since with -betterC, you should use extern(C) main anyway.
|
488b81c
to
85873d9
Compare
|
Thanks for your pull request, @WalterBright! Bugzilla references
|
|
@MartinNowak seems like dlang-bot removed the auto-merge. We should immediately suppress insubordination by bots! |
GH had some delays processing push events (https://status.github.com/messages/2017-06-26), hence the bot got triggered after I added the label. |
In general, this is a feature to avoid allowing contributors without merge rights to sneak unapproved code into dlang repos. Our bot removes |

No description provided.