bug-binutils
[Top][All Lists]
Advanced

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

Re: Ask for helping about LD linker


From: Nick Clifton
Subject: Re: Ask for helping about LD linker
Date: Mon, 02 Jun 2008 09:35:44 +0100
User-agent: Thunderbird 1.5.0.12 (X11/20080213)

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]