-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
Extra link added with -shared are useless #228
Comments
with gcc instead to do |
I think these link is hardcoded somewhere into ldc as by using gcc i do not have this extra link
|
There is no need to guess; linking is not magic. Use the |
ok so we could use the boolean var |
diff --git a/driver/linker.cpp b/driver/linker.cpp
index 72e16e6..f8d9581 100644
--- a/driver/linker.cpp
+++ b/driver/linker.cpp
@@ -196,16 +196,19 @@ int linkObjToBinaryGcc(bool sharedLib)
bool addSoname = false;
switch(global.params.os) {
case OSLinux:
- addSoname = true;
- args.push_back("-lrt");
+ if (!sharedLib)
+ args.push_back("-lrt");
// fallthrough
case OSMacOSX:
- args.push_back("-ldl");
+ if (!sharedLib)
+ args.push_back("-ldl");
// fallthrough
case OSFreeBSD:
addSoname = true;
- args.push_back("-lpthread");
- args.push_back("-lm");
+ if (!sharedLib){
+ args.push_back("-lpthread");
+ args.push_back("-lm");
+ }
break;
case OSSolaris:
|
I think this patch is wrong. What matters is not whether you are building a shared library, but whether Phobos is linked in as a shared library. Besides, I'm quite sure that it is possible for a typical application to reference symbols e.g. from libm without even explicitly invoking the functions, so in this case the »extra« linked library would be needed. I think if you want to reduce the number of linked libraries, you should investigate |
Hm, it doesn't seem to strip out the direct dependencies on |
|
The output for
None of these is unneeded, as every D shared library depends on |
a D file : libFoo.d
At least
are useless as libFoo will never call a function inside these libraries
The text was updated successfully, but these errors were encountered: