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

--- Comment #14 from Alan Modra <amodra at gcc dot gnu.org> ---
Author: amodra
Date: Sun Jul 28 09:26:13 2019
New Revision: 273853

URL: https://gcc.gnu.org/viewcvs?rev=273853&root=gcc&view=rev
Log:
[RS6000] Make assembler command line cpu match default for gcc

When gcc is configured using --with-cpu=<cpu>, the specified cpu
effectively becomes a default -mcpu=<cpu> passed to gcc.  This then
affects the cpu passed to gas via ASM_CPU_SPEC.  If gcc is not
configured using --with-cpu then the cpu passed to gas is that given
by ASM_DEFAULT_SPEC, which currently does not match the default flags
selected in default64.h.  This patch makes ASM_DEFAULT_SPEC agree with
TARGET_DEFAULT flags.

rs6000/default64.h appears in three places in config.gcc, the first
one immediately followed by rs6000/freebsd64.h in $tm_file, and the
other two immediately followed by rs6000/linux64.h.  To be able to
define ASM_DEFAULT_SPEC in rs6000/default64.h we don't want to
redefine in the other two files.  rs6000/freebsd64.h is easy since
that file is always preceded by rs6000/default64.h, but
rs6000/linux64.h can appear without rs6000/default64.h (a
powerpc*-linux config where the default is -m32).  In that case we
will have TARGET_DEFAULT flags of 0 (from rs6000/sysv4.h) and want to
use -mppc without -m64 and -mppc64 with -m64.  This can be done by
using the rs6000/rtems.h ASM_DEFAULT_SPEC in rs6000/sysv4.h, a change
that won't affect sysv4 configurations where -m64 is invalid.

The patch also introduces ASM_DEFAULT_EXTRA for the altivec variant
targets so as to enable -maltivec by default.

        PR target/91050
        * config/rs6000/sysv4.h (ASM_DEFAULT_SPEC): Modify if -m64.
        * config/rs6000/default64.h (ASM_DEFAULT_SPEC): Define.
        * config/rs6000/freebsd64.h (ASM_DEFAULT_SPEC): Don't define.
        * config/rs6000/linux64.h (ASM_DEFAULT_SPEC): Likewise.
        * config/rs6000/rtems.h (ASM_DEFAULT_SPEC): Likewise.
        * config/rs6000/rs6000.h (ASM_DEFAULT_EXTRA): Define and use
        in asm_default spec.
        * config/rs6000/eabialtivec.h (ASM_DEFAULT_EXTRA): Redefine.
        * config/rs6000/linuxaltivec.h (ASM_DEFAULT_EXTRA): Redefine.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/default64.h
    trunk/gcc/config/rs6000/eabialtivec.h
    trunk/gcc/config/rs6000/freebsd64.h
    trunk/gcc/config/rs6000/linux64.h
    trunk/gcc/config/rs6000/linuxaltivec.h
    trunk/gcc/config/rs6000/rs6000.h
    trunk/gcc/config/rs6000/rtems.h
    trunk/gcc/config/rs6000/sysv4.h

Reply via email to