Re: RFC: -Wl,--as-needed by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13 November 2017 at 10:52, Björn 'besser82' Esser
<besser82@xxxxxxxxxxxxxxxxx> wrote:
[..]
> that specific flag should be in LDFLAGS, but there are reasons, we do
> NOT have it in there, because it will likely break any binaries built
> from or containing FORTRAN sources.  They will simply SEGFAULT, because
> `-Wl,--as-needed` causes some needed runtime libraries NOT being linked
> with them, because the linker thinks they are not needed / would over
> link.

If it is still any issue related to the Fortran it is nothing more
than just plain bug.
However AFAIK only reason of any issues related to use -Wl,--as-needed
is using WRONG list -l<foo> parameters (lack of some -l<foo>) and this
needs to be not treated by apply some workaround but but by apply
necessary fixes in -l<foo> linking parameters.
I've been personally involved in fixing many such problems in more
than last decade and I was one of the many similar people fixing
similar issues across many packages.
If it is still something left it will be IMO not more than few
packages in all Fedora packages.
In some packages using --as-needed will cause reduction of SONAME
dependencies by more than half!!!

In other words -Wl,--as-needed should be used everywhere WITHOUT exceptions.
Easiest way apply this globally in Fedora is add --as-needed in
/usr/lib/rpm/redhat/redhat-hardened-ld spec file by apply patch:

--- /usr/lib/rpm/redhat/redhat-hardened-ld.orig
+++ /usr/lib/rpm/redhat/redhat-hardened-ld
@@ -2,4 +2,4 @@
 + %{!static:%{!shared:%{!r:-pie}}}

 *link:
-+ -z now
++ -z now --as-needed

BTW: many packages are fiddling with LDFLAGS adding redundantly
-Wl,-z,now. All those modifications can be now dropped.
As well all packages which already are injecting -Wl,--as-needed can be cleaned.

[tkloczko@domek SPECS.fedora]$ grep LDFLAGS *| grep -c -- --as-needed
150
[tkloczko@domek SPECS.fedora]$ grep LDFLAGS *| grep -c -- -z,now
106

On top of this IMO it would be good to add in binutils ld modification
which will be reporting all dropped during linking -l<foo> as a
warning
Such warnings could be used on keep clean build frameworks.

kloczek
-- 
Tomasz Kłoczko | LinkedIn: http://lnkd.in/FXPWxH
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux