MIPS -gc-sections broken?

Hiroki Kaminaga kaminaga@sm.sony.co.jp
Fri Jun 5 12:52:00 GMT 2009


Hi,

From: Nick Clifton <nickc@redhat.com>
> > $ mips-unknown-linux-dev-gcc -ffunction-sections -fdata-sections -Wl,-gc-sections -o test foo.c main.c
> > $ mips-unknown-linux-dev-readelf -s test | grep gbl_common
> >      4: 00000000  7200 OBJECT  GLOBAL DEFAULT  ABS gbl_common
> > 
> > and does not belong to any section... gbl_common symbol should be
> > removed, or at least have its entry in .bss section.
> > Any hints, comments are appreciated!
> 
> I tried this and it worked for me.  As in the executable did not contain 
> any reference to the gbl_common symbol.  Possible differences between my 
> build and yours are:
> 
>    * I was using the current mainline binutils sources.
>    * I was using the current mainline gcc sources.
>    * I configured the toolchain for a mipsisa32-elf target.

I've tried latest binutils-2.19.51.0.8 and gcc-4.5-20090604, and I still
have the same problem...
The unused function which is swept away by -gc-sections is placed in
.text.func_not_used so -ffunction-sections is working ok.

Humm, I'm using mips2 insn with o32.

binutils/bfd/elfxx-mips.c:_bfd_mips_elf_gc_sweep_hook() is currently
#if 0 'ed, however, other arch, such as arm, ppc reduces refcont for
plt. MIPS does not have plt count, but while sweeping away section 
.text.func_not_used and .rel.text.func_not_used, don't we need some
handling of relocation entries in these sections?

Thanks in Advance,


----
(Hiroki Kaminaga)
t



More information about the Binutils mailing list