[Issue 7044] Missing a way to control the order of arguments passed to the linker makes impossible to link some programs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 7 21:04:52 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=7044



--- Comment #31 from yebblies <yebblies at gmail.com> 2014-03-08 16:04:38 EST ---
(In reply to comment #29)
> 
> This is not actually the best option,

Yes, just a workaround for you until we get a real fix.

> because the runtime is statically
> compiled so we'd have to include the whole dependencies in the .a, and we lose
> dynamic linking, which mean we don't get security updates from the distribution
> anymore unless we recompile our stuff with a new version.
> 

This is not true.  You still get dynamic linking.

The dmd-produced command line is something like this:

g++ prog.obj -lstuffprogneeds -lphobos2

But you want

g++ prog.obj -lstuffprogneeds -lphobos2 -lstuffphobosneeds

A little bit of 'ar' magic will produce a new static lib that contains
everything in libphobos2.a and everything in libstuffphobosneeds.a

You can this pass this to dmd via -debuglib/-defaultlib and get (almost) the
same thing as the above command line.

> I think at least we reach an agreement for the solution to adopt, right? If
> that the case I might give it another shot to the implementation. But I don't
> want to come up with another PR that gets rejected.

Sure.  I was just giving a workaround that doesn't require changing the
compiler.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list