PLDWWW: DevelopingPLD/AdvancedDeveloping/FixingAsNeeded

patrys patrys at pld-linux.org
Tue Sep 12 20:50:27 CEST 2006


Author: patrys   Date: Tue Sep 12 18:50:27 2006 GMT
Module: PLDWWW   URL: http://pld-linux.org/DevelopingPLD/AdvancedDeveloping/FixingAsNeeded
---- Log message:


---- Page affected: DevelopingPLD/AdvancedDeveloping/FixingAsNeeded

---- Diffs:

================================================================
  #language en
  = Fixing --as-needed problems =
  
- === Quick Workaround ===
+ == Quick and ugly workaround ==
  
- Put in spec file this line:
+ Put this line in {{{spec}}} file:
+ 
  {{{
  %define filterout_ld -Wl,--as-needed
  }}}
+ 
- But '''don't use it''' unless you really need.
+ But '''don't use it''' unless you really need to quickly build a package.
+ Never ever try to commit such a change. It might be tempting to
+ do so but if you think about it {{{--as-needed}}} did it's job well and
+ disabled unneeded libraries. If building fails, it's the package that
+ needs to get fixed, not the linker flags.
- 
- Why ? Because it's very stupid. If something fails to build normally
- it's a sign {{{--as-needed}}} did well it's job and disabled unneeded
- libraries.
- 
  
  == How --as-needed works ==
+ 
  With {{{--as-needed}}} enabled, only libraries containing symbols required by
  __object files__ are linked.
  
+ === Why it fails for some packages ===
+ 
+ In other words, if you list 10 libraries and only 3 of them contain
+ referenced symbols, others are silently discarded. This is a good thing
+ but unfortunately some projects fail to list all their dependencies properly.
+ 
+ This normally works because if project requires libraries ''A'' and ''B''
+ and ''A'' itself lists ''B'' as a dependency, both ''A'' and ''B'' get pulled
+ in even if the project itself only lists ''A''.
+ 
+ Now assume that ''A'' is a superfluous (unneeded) dependency which gets
+ dropped (or ''A'' requiring ''B'' is superfluous and ''B'' gets
+ dropped from ''A''). The symbols are no longer available.
+ 
- ===== About positions =====
+ === About positions ===
+ 
  Linker options are positional, and position is very important.
  It looks for missing symbols only in libraries coming after object file.
  


More information about the pld-cvs-commit mailing list