This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Can LD give warnings about the non-static functions defined but never used explicitly?
- From: "Pan ruochen" <panruochen at gmail dot com>
- To: "Alan Modra" <amodra at bigpond dot net dot au>, "Jonathan Adamczewski" <jadamcze at utas dot edu dot au>, "Eric Botcazou" <ebotcazou at adacore dot com>, "David Daney" <ddaney at caviumnetworks dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 26 Nov 2008 10:03:45 +0800
- Subject: Re: Can LD give warnings about the non-static functions defined but never used explicitly?
- References: <af0faace0811232319n6e6789e5t6cc39ff5be836ed4@mail.gmail.com> <492AD467.1040109@caviumnetworks.com>
> Compile your code with -ffunction-sections -fdata-sections.
>
> Then link with -Wl,--gc-sections
>
> In theory, that should eliminated unreferenced functions and data objects
> from the final object.
>
> David Daney
>
One more question. I have some data stored in a special section. These
data are not referenced within the program but these data are useful
to an external loader. In this case, how to let LD know the data are
`used' and keep them on linking.
Best Regards
PRC
Nov 26, 2008