https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104671
Bug ID: 104671
Summary: -Wa,-m<cpu> no longer has any effect
Product: gcc
Version: 10.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: npiggin at gmail dot com
CC: amodra at gcc dot gnu.org, bergner at gcc dot gnu.org,
dje at gcc dot gnu.org, meissner at gcc dot gnu.org, pc at
us dot ibm.com,
segher at gcc dot gnu.org, wschmidt at gcc dot gnu.org
Target Milestone: ---
Commit e154242724b084380e3221df7c08fcdbd8460674 ("Don't pass -many to the
assembler") also added a workaround emitting a ".machine" directive to the top
of each generated .s file corresponding to -mcpu= option, to work around buggy
build code which uses incorrect -Wa,-mcpu options:
This patch also emits .machine assembler directives for ELF targets
when functions are compiled for different cpus via attributes or
pragmas. That's necessary when the initial -m<cpu> option passed to
the assembler doesn't enable the superset of all opcodes emitted, as
seen by a failure of gcc.target/powerpc/clone2.c without .machine
when building gcc for power8.
This also prevents passing a -m<cpu> to the assembler which is a strict
superset of the -mcpu= generated code.
This is a valid situation where .c code is built with a baseline architecture
compatibility plus dynamic support for newer instructions with inline asm. The
Linux kernel extensively uses this pattern.