Add a weak definition of mep_di to MeP's libgloss

Nick Clifton nickc@redhat.com
Wed Feb 4 10:39:00 GMT 2009


Hi Konrad,

> However, once processed, this archive is not revisited,
> even if later object files have unresolved symbols that could be
> resolved by this library (unless the library is mentioned a second time
> on the command line, to the right of these later object files).

Or unless command line switches such as --start-group ... --end-group 
are used to enclose a selection of archives.


> If you wish to override the definition of a symbol, add an object
> [...] defining that symbol
> before the library containing the overridden definition.

The problem with this solution is that it requires a specific link 
order.  I cannot guarantee that the user will specify the libraries and 
object files in the correct order on the linker command line to achieve 
this effect.  Plus things can become very complicated and even 
impossible to resolve if there are multiple symbols that need to be 
overridden in multiple different archives.


> Thus,
> adding weak definitions to existing members (object files) will bloat
> the linker's output (perhaps only slightly, as in the case below) when
> that member is extracted for other reasons.  

True, but if the size of the final executable is a real concern then 
compiling all archives with -ffunction-sections and enabling link time 
garbage collection would resolve this issue for most cases.  (Although 
technically not in this particular case since the weak symbol is 
explicitly placed in the same section as the function that refers to it).


Cheers
   Nick




More information about the Newlib mailing list