Dear Nick,
I see, thank you so much.

Best regards


2008-06-02 



jian 



发件人: Nick Clifton 
发送时间: 2008-06-02  16:32:40 
收件人: jian 
抄送: bug-binutils 
主题: Re: Ask for helping about LD linker 
 
Hi Jian,

> But how to remove the unused functions in system library(maybe compile 
> the system library without --funciton-sections) when linking program.

Short Answer: It cannot be done.

Long Answer:

If you are linking against a *shared* library then you will not be able 
to remove any functions in the shared library.  (Nor would you want to - 
other programs may need those functions).

If you are linking against a *static* system library (which has not been 
compiled with --ffunction-sections), then unused functions should not 
normally be copied into the executable.  The exception is when an unused 
function is in the same object file inside the library as a used 
function (or used global symbol).  Ie the linker only discards code at 
the object file level.  If some part of an object file inside a static 
library is needed by the executable then the entire contents of that 
object file will be copies into the executable.

Cheers
   Nick
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to