--gc-sections support under win32 mingw

Brian Dessent brian@dessent.net
Fri Apr 4 20:21:00 GMT 2008


Davide Pippa wrote:

> I'd like to know is there a version of ld supporting the --gc-sections
> option under win32?

In the BFD PE target bfd_gc_sections maps to bfd_generic_gc_sections
which is a dummy function that does nothing, so the PE ld accepts
--gc-sections but it does not do anything.  It looks like only ELF
targets (and not all of them) provide the necessary code to support the
option.  I don't see any technical reason why PE couldn't support this
as well, other than the fact that somebody would have to write and
contribute the code -- the ELF code obviously won't work for PE.  But
maybe I'm missing some aspect of PE that makes it infeasible.

> Is there a mingw port?

Of course there's a mingw port of the binutils, but due to the above the
option won't do anything.

Brian



More information about the Binutils mailing list