[Bug target/68467] libgcc, compilation for target m68k-linux breaks in linux_atomic.c

jsm28 at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 29 21:01:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68467

--- Comment #24 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Author: jsm28
Date: Mon Jan 29 21:00:52 2018
New Revision: 257165

URL: https://gcc.gnu.org/viewcvs?rev=257165&root=gcc&view=rev
Log:
Fix m68k-linux-gnu libgcc build for ColdFire (PR target/68467).

PR target/68467 is libgcc failing to build for m68k-linux-gnu
configured for ColdFire.

Jeff has an analysis in the PR identifying the problem as resulting
from the callers of libcalls with 1-byte or 2-byte arguments wanting
to push just 1 or 2 bytes on the stack, while the libcall
implementations have the normal C ABI and expect 4-byte arguments.
For normal C functions, I believe the TARGET_PROMOTE_PROTOTYPES
definition would ensure such arguments get passed as 4-byte, but that
does not apply for libcalls.

This patch fixes the issue by defining TARGET_PROMOTE_FUNCTION_MODE
for m68k.  The definition is conservative, only applying promotions in
the case of arguments to libcalls; otherwise it returns the unpromoted
type, which I believe matches what the default implementation of the
hook would have done on m68k.

I have tested that this fixes the libgcc build for ColdFire, and, in
conjunction with one glibc patch, this enables glibc to build cleanly
for ColdFire and to pass the compilation parts of the glibc testsuite
except for one test unrelated to this patch (while glibc and the
compilation parts of the testsuite continue to build OK for
non-ColdFire m68k, as expected).  I have *not* run any GCC tests for
this patch, or any execution tests for m68k.

        Backport from mainline
        2018-01-24  Joseph Myers  <joseph@codesourcery.com>

        PR target/68467
        * config/m68k/m68k.c (m68k_promote_function_mode): New function.
        (TARGET_PROMOTE_FUNCTION_MODE): New macro.

Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/config/m68k/m68k.c


More information about the Gcc-bugs mailing list