bug-binutils
[Top][All Lists]
Advanced

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

Re: Re: Ask for helping about LD linker


From: jian
Subject: Re: Re: Ask for helping about LD linker
Date: Mon, 2 Jun 2008 16:44:11 +0800

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
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]