Re: Linking objects with GNU LD




Karl-Heinz wrote:

Hi everybody,

I am using the GNU GCC toolchain configured for m68k (cross compiler).
I want to link several objects into an executable file. Unfortunately
there are several c-functions compiled into one object but I don't want
to use all functions in my executable. Looking into the map file I can
see the unused functions in my executable. Is there a way to avoid this
functions being in the executable (apart from splitting the functions
in the c file)?

Thanks in advance

The gcc options -ffunction-sections and -fdata-sections will generate
separate sections for the functions and data items in a file. (Assuming
the output format can support this.)

The ld option --gc-sections will remove unreferenced sections.

.



Relevant Pages