MIPS: link error against __unpack_d with --enable-target-optspace

Bug #892880 reported by Michael Hope
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Won't Fix
Undecided
Michael Collison

Bug Description

Logged here so we can discuss it. Probably upstream and needs to be bounced there.

Reported by PaulFertser on IRC:
 http://irclogs.linaro.org/2011/11/20/%23linaro.html

When building a program that uses double precision software floating point, linking fails with a missing reference to __unpack_d. This is a internal function used to split the floating point number into components when processing.

Most functions such as __muldf3 end up being resolved in libgcc_so.1. At least __ledf2 and __gtdf2 aren't and get pulled in from libgcc.a instead. GCC is configured with --enable-target-optspace, causing libgcc to be built with -Os, causing unpack_d() to not be inlined. libgcc.a doesn't contain a _unpack_d.o so the link fails.

Adding a -shared-libgcc works around the problem as for some reason libgcc_s.so.1 contains a copy of __unpack_d.

I imagine adding a -static-libgcc would cause all functions to break.

This may be related to __ledf2 and __gtdf2 being versioned where __muldf3 etc aren't.

The fault doesn't occur on arm-none-eabi with --enable-target-optspace. libgcc.a doesn't contain any references to unpack_d.

Links:

List of symbols from libgcc_s.so.1:
 http://paste.debian.net/plain/146425

Disassembly of libgcc_s.so.1 showing presence of _unpack_d:
 http://paulfertser.info/libgcc_s-objdump.txt

nm of libgcc.a showing links to unpack_d but no unpack_d itself:
 http://paste.debian.net/plain/146422

objdump of the 'bad' default configuration showing linked in copies of __ledf2 that call unpack_d:
 http://paulfertser.info/radvd-objdump-bad.txt

objdump of the 'good' version with -shared-libgcc showing links to the versioned __ledf2@@GCC_3.0:
 http://paulfertser.info/radvd-objdump-good.txt

Command line used during the link:
 http://paste.debian.net/146420/

Revision history for this message
Michael Hope (michaelh1) wrote :

...and this doesn't happen on ARM as we have hand-coded assembly versions in ieee754-df.s.

Revision history for this message
Richard Sandiford (rsandifo) wrote : Re: [Bug 892880] [NEW] MIPS: link error against __unpack_d with --enable-target-optspace

Michael Hope <email address hidden> writes:
> Most functions such as __muldf3 end up being resolved in libgcc_so.1.
> At least __ledf2 and __gtdf2 aren't and get pulled in from libgcc.a
> instead. GCC is configured with --enable-target-optspace, causing
> libgcc to be built with -Os, causing unpack_d() to not be inlined.
> libgcc.a doesn't contain a _unpack_d.o so the link fails.
[...]
> nm of libgcc.a showing links to unpack_d but no unpack_d itself:
> http://paste.debian.net/plain/146422

I may be missing something here, but there does seem to be a definition:

_unpack_df.o:
00000000 T __unpack_d

Is this the right nm output?

Richard

Revision history for this message
Michael Hope (michaelh1) wrote :

I believe so, yes. I see what you mean - the T means this is the definition of the symbol.

I've built a mips-unknown-linux-uclibc using crosstool-NG with the attached configuration and can't reproduce the fault.

The full build log is at:
 http://people.linaro.org/~michaelh/incoming/build.log.bz2

Revision history for this message
Michael Hope (michaelh1) wrote :
Changed in gcc-linaro:
status: New → Incomplete
Revision history for this message
Michael Collison (michael-collison) wrote :

Will not fix in older releases. Issue does not occur with MIPS cross compiler build using linaro 4.8 or 4.9

Changed in gcc-linaro:
assignee: nobody → Michael Collison (michael-collison)
status: Incomplete → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.