This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: same symbol appearing many times in executable


On Thu, 2010-10-07 at 11:59 -0700, Ian Lance Taylor wrote:
> Bahadir Balban <bbalban@b-labs.com> writes:
> 
> > I see multiple instances of the same symbol in the final executable. I
> > am suprised because I would expect them to not appear at all, if
> > compiler chose to inline them. If it did not choose to inline, I would
> > expect it to appear only once. This is because even though each instance
> > would be available in every .o file including the header, during the
> > final link they should have been reduced to one instance.
> 
> That last step does not occur by default.  It requires directing the
> linker to find and eliminate those duplicates.  When using the gold
> linker, you can make it occur in some cases by compiling with
> -ffunction-sections and linking with --icf-safe.
> 
> Ian

Hmm I didn't know this. So my best bet seems placing this function in a
source file with no inline.

-- 
Bahadir Balban


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]