[Issue 16547] -betterC switch no longer removes druntime symbols
https://issues.dlang.org/show_bug.cgi?id=16547 Martin Nowak changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |DUPLICATE --- Comment #7 from Martin Nowak --- Merging w/ issue 11881. Until this get's fixed, please use extern(C) __gshared int __dmd_personality_v0; as a workaround and remember to not link -betterC code with phobos using the -defaultlib= compiler switch. *** This issue has been marked as a duplicate of issue 11881 *** --
[Issue 16547] -betterC switch no longer removes druntime symbols
https://issues.dlang.org/show_bug.cgi?id=16547 --- Comment #6 from Martin Nowak --- (In reply to Jacob Carlborg from comment #5) > > Not sure if we did disable EH for -betterC. Would make sense, right? > > I guess. Unless we can limit it to something like Errors which cannot be > caught. Or somehow use what the C++ runtime provides, if that would help. It's exactly this native EH that drags in so much stuff. Did we excluded EH when introducing -betterC? Without TypeInfo it would hardly work anyhow. > BTW, how did this work in DMD 2.070.0? It didn't have anything similar to > __dmd_personality_v0? Yes, it's part of the native DWARF EH implementation, which was extended to OSX w/ 2.071.0. I'm inclined to merge this with issue 11881 b/c it's just another backend mechanism, that we're not correctly disabling with -betterC. Also if the binary weren't linked with phobos/druntime, this would have properly errored as undefined symbol. BetterC should always be used with -defaultlib=, maybe we should make that the default. --
[Issue 16547] -betterC switch no longer removes druntime symbols
https://issues.dlang.org/show_bug.cgi?id=16547 --- Comment #5 from Jacob Carlborg --- (In reply to Martin Nowak from comment #4) > Apparently happens b/c of __dmd_personality_v0 being emitted with -betterC. > A simple workaround is to add a dummy personality symbol to your binary, > e.g. in the same object file as main. > > extern(C) __gshared int __dmd_personality_v0; Yeah, that works. > Not sure if we did disable EH for -betterC. Would make sense, right? I guess. Unless we can limit it to something like Errors which cannot be caught. Or somehow use what the C++ runtime provides, if that would help. BTW, how did this work in DMD 2.070.0? It didn't have anything similar to __dmd_personality_v0? --
[Issue 16547] -betterC switch no longer removes druntime symbols
https://issues.dlang.org/show_bug.cgi?id=16547 --- Comment #4 from Martin Nowak --- Apparently happens b/c of __dmd_personality_v0 being emitted with -betterC. A simple workaround is to add a dummy personality symbol to your binary, e.g. in the same object file as main. extern(C) __gshared int __dmd_personality_v0; Not sure if we did disable EH for -betterC. Would make sense, right? --
[Issue 16547] -betterC switch no longer removes druntime symbols
https://issues.dlang.org/show_bug.cgi?id=16547 Jacob Carlborg changed: What|Removed |Added Status|RESOLVED|REOPENED CC||d...@me.com Resolution|INVALID |--- --- Comment #3 from Jacob Carlborg --- $ cat main.d module main; extern (C) int printf(in char*, ...); extern (C) void main() { printf("asd\n"); } $ dvm use 2.070.0 $ dmd --version DMD64 D Compiler v2.070.0 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright $ dmd -betterC main.d $ nm main | wc -l 4 $ dvm use 2.071.0 $ dmd --version DMD64 D Compiler v2.071.0 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright $ dmd -betterC main.d $ nm main | wc -l 2428 --
[Issue 16547] -betterC switch no longer removes druntime symbols
https://issues.dlang.org/show_bug.cgi?id=16547 Martin Nowak changed: What|Removed |Added Status|NEW |RESOLVED CC||c...@dawg.eu Resolution|--- |INVALID --- Comment #2 from Martin Nowak --- Can't reproduce any significant different among 2.069.x - 2.070.2-b1 either. Guess this is a confusion b/c the program was still linked w/ phobos. Also see issue 11881 for a few shortcomings w/ the current -betterC state. --
[Issue 16547] -betterC switch no longer removes druntime symbols
https://issues.dlang.org/show_bug.cgi?id=16547 Vladimir Panteleev changed: What|Removed |Added CC||thecybersha...@gmail.com --- Comment #1 from Vladimir Panteleev --- (In reply to Gary Willoughby from comment #0) > When building an executable and using the -betterC flag using DMD v2.070.0 > the symbols emitted from the above program are thus: > > T _main > U _printf I can't reproduce this. $ uname -a Linux home.thecybershadow.net 4.7.4-1-ARCH #1 SMP PREEMPT Thu Sep 15 15:24:29 CEST 2016 x86_64 GNU/Linux $ dmd --version DMD64 D Compiler v2.070.0 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright $ cat test.d import core.stdc.stdio; extern(C) void main() { printf("Hello World!\n"); } $ dmd -betterC test $ nm test | wc -l 1814 --