How to link in sub-object ganularity

Andras Tantos andras_tantos@yahoo.com
Tue Dec 2 17:59:00 GMT 2003


> > I guess the problem is that the linker cannot crack sections, so first I
> > would need to specify GCC to put each (extern) symbol into a different
> > section and than instruct the linker to do a per-section linking.
>
> gcc -ffunction-sections
> ld --gc-sections
>
> See the documentation.
>
> Ian


Wow! Thanks so much for the fast answer. (In my defense: I've read through
the docs, but I haven't connected 'garbage-collection' to this behavior.)
Anyway, I've tried it and it works great for ELF targets but not for COFF
(or PE for that matter). I've read it in the src/ld/NEWS file
that --gc-sections support was implemented for ELF only. Are there plans to
add support for COFF too?

Thanks again,
Andras Tantos



More information about the Binutils mailing list