diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-03-01 13:09:57 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-03-09 12:45:14 +0000 |
commit | aafc7234486f66efe2f53aa4b132a566c2bccb17 (patch) | |
tree | a5e468f10d2c248fbc3960893cd2624727c46c36 /share | |
parent | c14a8982855c82d3730fdfe0fe23054f07549fbb (diff) |
Do not pass --undefined-symbols=ignore-in-shared-libs
Now that we correctly add -rpath-link to the linker command line we want
errors regarding missing symbols to be reported. This patch removes the
--undefined-symbols=ignore-in-shared-libs argument that was added in
commit d9127c78.
Since ld's man page claims that report-error is the default, do not pass
an --undefined-symbols=XXX argument. On Darwin the behavior is not
changed.
Interestingly, passing --undefined-symbols=report-all on FreeBSD will
result in the weird linker errors mentioned in commit d9127c78.
The libc on FreeBSD refers to symbols that only occur in applications,
such as "__progname" and "environ". Thus, no dynamic library can be
linked with "report-all". The ld documentation is not correct in claiming
that this option is the default; the linker clearly does some additional
magic, like blacklisting some symbols or whatever.
Change-Id: I330b8ab7dd9fbf777946992914239cce5a43fd8d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 936797d69..9527b738c 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -258,12 +258,16 @@ function linkerFlags(project, product, inputs, output) { args.push("--sysroot=" + sysroot); // do not escape, compiler-as-linker also needs it } - var unresolvedSymbolsAction = isDarwin ? "error" : "ignore-in-shared-libs"; - if (ModUtils.moduleProperty(product, "allowUnresolvedSymbols")) - unresolvedSymbolsAction = isDarwin ? "suppress" : "ignore-all"; - args = args.concat(escapeLinkerFlags(product, inputs, isDarwin - ? ["-undefined", unresolvedSymbolsAction] - : ["--unresolved-symbols=" + unresolvedSymbolsAction])); + if (isDarwin) { + var unresolvedSymbolsAction; + unresolvedSymbolsAction = ModUtils.moduleProperty(product, "allowUnresolvedSymbols") + ? "suppress" : "error"; + args = args.concat(escapeLinkerFlags(product, inputs, + ["-undefined", unresolvedSymbolsAction])); + } else if (ModUtils.moduleProperty(product, "allowUnresolvedSymbols")) { + args = args.concat(escapeLinkerFlags(product, inputs, + ["--unresolved-symbols=ignore-all"])); + } for (i in rpaths) { if (systemRunPaths.indexOf(rpaths[i]) === -1) |