[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
Mon Oct 22 02:11:30 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7044
--- Comment #5 from Leandro Lucarella <leandro.lucarella at sociomantic.com> 2012-10-22 02:10:58 PDT ---
(In reply to comment #4)
> The problem is the order of -defaultlib and -L is fixed as:
>
> 1. -L flags
> 2. libraries on the command line
> 3. libraries specified by pragma(lib)
> 4. standard libraries (also -debuglib, -defaultlib libraries)
>
> I suggest the straightforward approach of the order of (1), (2), and (4) be
> determined by the order in which they appear on the command line.
This is good enough to change the runtime in the dmd.conf file but is not ideal
for overriding a default later, because the -L flags are not replaced as the
-defaultlib option is, just appended.
For example, I have a default runtime which needs to link to librt, so I have
this in dmd.conf:
DFLAGS=-defaultlib=runtime1 -L-lrt
Then I want to compile some program using another runtime that depends on libz,
if I write:
dmd -defaultlib=runtime2 -Llz
The best we can do is to get these link options: -lrt -lruntime2 -lz
Which includes -lrt, which is not needed by runtime2 (and it might not even be
available in the environment runtime2 is compiled).
I think we need a flag to override the default runtime library *and* all its
dependencies in one go.
> That leaves (3), and I suggest that be inserted immediately before (4).
I guess it makes sense, if you want complete control on the ordering then you
have to switch to using -L instead of pragma(lib).
> This may break existing build systems, though.
This is one good point about the solution I proposed before, is completely
backwards compatible.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list