sh-elf has space optimized division functions for -m4 / -m4-single, which are
provided in a separate library, which is used when statically linking with -Os
.
However, libgcc itself constains some references to the divide functions.  If
these functions have not been used by something else earlier, the references
are satisifed from within libgcc.
This is a missed space optimization, but worse, libgcc.a has a module which
defines both signed and unsigned divide, while libgcc-Os-4-200.a provides
them in two separate modules.
If one of the symbols is pulled in early from libgcc-Os-4-200.a, and the other
satisfied later from within libgcc.a, the first symbol ends up being defined
twice.

I propose to fix this by putting a copy of the unwinder code into
libgcc-Os-4-200.a, which will make the only reference to signed divide
from libgcc.a irrelevant, and by providing an sh udiv_qrnnd definition in
longlong.h and optimizing 1U/0 away in sh.md, which will get rid of the
references to unsigned divide in libgcc.a


-- 
           Summary: space-optimized divide used inconsistently
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, link-failure
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org
GCC target triplet: sh-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28014

Reply via email to