Can LD give warnings about the non-static functions defined but never used explicitly?

Nick Clifton nickc@redhat.com
Thu Nov 27 09:56:00 GMT 2008


Hi Pan,

> Still one more question. I rebuilt all my projects with
> -ffunction-sections and got a lot of `multiple definition' errors. The
> reason for these errors is that some common variables are defined in
> header files in the project.

This is bad programming practice and you would be well advised to fix 
your header files.  The alternative however is to compile with the 
-fno-common gcc command line switch.

> BTW, I use '-Map` to print the linking map to a map file. But I don't
> find any information about data or functions removed by LD.

No, that information is generated by the --print-gc-sections linker 
command line switch.

Cheers
   Nick




More information about the Binutils mailing list