"3119369616.qq via Gcc" <gcc@gcc.gnu.org> writes:

> To divide functions into sections and then remove unused sections, I must
> provide flags "-fdata-sections" and "-ffunction-sections" in GCC and a flag
> "--gc-sections" in LD. Most of the build systems don't support these flags so
> GCC will generate bigger binaries.
> Is it possible to enable this feature without&nbsp; giving any command line 
> flags manually?

All (at least decent) build systems support passing extra flags to the
compiler and linker (e.g. CXXFLAGS="-ffunction-sections"), or passing a
custom compiler and linker (which can set those flags, something like
CC="gcc -ffunction-sections").  This is how you should be setting such
flags.

If you're interested in DCE and other size-reducing optimizations, you
might also be interested in LTO and -Os.
-- 
Arsen Arsenović

Attachment: signature.asc
Description: PGP signature

Reply via email to