D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10440 - shared library on osx: worked in 2.062, fails in 2.063 / 2.063.2
Summary: shared library on osx: worked in 2.062, fails in 2.063 / 2.063.2
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-21 20:05 UTC by thelastmammoth
Modified: 2013-07-06 18:13 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thelastmammoth 2013-06-21 20:05:17 UTC
--foo.d
module foo;
extern(C) void foo1(){}

--main.d
module main;
pragma(lib,"foo");
extern(C) void foo1();
void main(){foo1;}

dmd -oflibfoo.dylib -shared foo.d;
dmd -L-L. main.d
./main

--output:
2.062:OK
2.063(and 2.063.2):NG

gdb ./main
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00000001000184fc in sections_osx_onAddImage ()
Comment 1 Maxim Fomin 2013-06-21 22:41:27 UTC
I noticed that shared libraries don't work in similar way in linux too, approximately after 2.063 release. This is quite sad, because this is the way dynamic linking was working in linux since 2011 autumn (or earlier).
Comment 2 Martin Nowak 2013-06-23 17:19:21 UTC
This never worked correctly as there is no shared library support on OSX.
Something that previously caused a silent misbehavior was made explicit therefor it now crashes.
https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L3L94
https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L8R70
Comment 3 thelastmammoth 2013-06-23 19:00:49 UTC
(In reply to comment #2)
> This never worked correctly as there is no shared library support on OSX.
> Something that previously caused a silent misbehavior was made explicit
> therefor it now crashes.
> https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L3L94
> https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L8R70

(In reply to comment #2)
> This never worked correctly as there is no shared library support on OSX.
> Something that previously caused a silent misbehavior was made explicit
> therefor it now crashes.
> https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L3L94
> https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L8R70

I still worked for a number of scenarios on which I relied on. Can you please put back the old behavior enabled by a version(use_unsafe_shared_library_osx) switch ?
that way people can still use shared libraries on OSX (at their own risk) until the problem is addressed.
Comment 4 Maxim Fomin 2013-06-23 20:08:43 UTC
(In reply to comment #2)
> This never worked correctly as there is no shared library support on OSX.
> Something that previously caused a silent misbehavior was made explicit
> therefor it now crashes.
> https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L3L94
> https://github.com/D-Programming-Language/druntime/commit/0e10e7e96c8a1d6c12bc45b143bab9364cd72755#L8R70

This does not explain crashes in linux where dynamic linking worked.
Comment 5 Martin Nowak 2013-06-24 06:18:33 UTC
(In reply to comment #4)
> This does not explain crashes in linux where dynamic linking worked.

Please open a separate bug for this.