This is the mail archive of the
mailing list for the GCC project.
Re: [off topic] fallow code removal
- From: Eric Christopher <echristo at apple dot com>
- To: John Love-Jensen <eljay at adobe dot com>
- Cc: MSX to GCC <gcc-help at gcc dot gnu dot org>, gcc at gcc dot gnu dot org
- Date: Fri, 5 May 2006 11:27:49 -0700
- Subject: Re: [off topic] fallow code removal
- References: <C0809F23.FC9Demail@example.com>
Any suggestions, pointers or recommendations for tools, tips and/or
techniques would be appreciated.
A couple of different ways come to mind:
a) there's the binutils -ffunction-sections -Wl,-gc-sections approach
where every function is put into it's own section and the total is
then garbage collected by the linker with extra sections that aren't
referenced are then deleted.
b) the mechanism the mach-o linker uses which is similar, but since -
ffunction-sections may overrun the maximum allowed number of
sections, everything is divided on label boundaries and split into
"atoms". Any atom not in the direct call graph or without a
relocation is then deleted in the final linked image.