Bug 88648 - Force unified syntax for inline assembly not functional (-masm-syntax-unified)
Summary: Force unified syntax for inline assembly not functional (-masm-syntax-unified)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.2.0
: P3 normal
Target Milestone: 7.5
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-01 23:19 UTC by Stefan Agner
Modified: 2019-02-11 09:34 UTC (History)
2 users (show)

See Also:
Host:
Target: arm*-*-*
Build:
Known to work: 5.4.1, 9.0
Known to fail: 6.5.0, 7.4.1, 8.2.1
Last reconfirmed: 2019-01-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Agner 2019-01-01 23:19:55 UTC
Forcing inline assembly to be unified syntax seems not to work properly

E.g. compiling a c file with the following inline assembly using
arm-none-eabi-gcc -marm -march=armv7-a -masm-syntax-unified test.c --save-temps


asm ( "nop" ); 

leads to:

        .syntax divided
@ 5 "test.c" 1
        nop
@ 0 "" 2
Comment 1 ktkachov 2019-01-08 09:31:29 UTC
Confirmed on all the branches since GCC 6. GCC 5 did the right thing.
I think r222995 is to blame
Comment 2 Ciro Santilli 2019-01-08 12:11:23 UTC
I have observed a similar problem on GCC 5.4.0 on Ubuntu 16.04 package gcc-arm-linux-gnueabihf.

The problem only happens if I give both -marm and -masm-syntax-unified, then it seems to ignore -masm-syntax-unified.

But without -marm it generates thumb code, which is not what I want.

Previously asked at: https://stackoverflow.com/questions/54078112/how-to-write-syntax-unified-ual-armv7-inline-assembly-in-gcc
Comment 3 ktkachov 2019-01-10 11:37:13 UTC
Author: ktkachov
Date: Thu Jan 10 11:36:42 2019
New Revision: 267804

URL: https://gcc.gnu.org/viewcvs?rev=267804&root=gcc&view=rev
Log:
ARM: fix -masm-syntax-unified (PR88648)

This allows to use unified asm syntax when compiling for the
ARM instruction. This matches documentation and seems what the
initial patch was intended doing when the flag got added.

2019-01-10  Stefan Agner  <stefan@agner.ch>

	PR target/88648
	* config/arm/arm.c (arm_option_override_internal): Force
	opts->x_inline_asm_unified to true only if TARGET_THUMB2_P.

	* gcc.target/arm/pr88648-asm-syntax-unified.c: Add test to
	check if -masm-syntax-unified gets applied properly.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr88648-asm-syntax-unified.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 ktkachov 2019-01-10 11:39:25 UTC
Fixed on trunk.
Comment 5 ktkachov 2019-02-11 09:27:02 UTC
Author: ktkachov
Date: Mon Feb 11 09:26:31 2019
New Revision: 268764

URL: https://gcc.gnu.org/viewcvs?rev=268764&root=gcc&view=rev
Log:
ARM: fix -masm-syntax-unified (PR88648)

	Backport from mainline.
	2019-01-10  Stefan Agner  <stefan@agner.ch>

	PR target/88648
	* config/arm/arm.c (arm_option_override_internal): Force
	opts->x_inline_asm_unified to true only if TARGET_THUMB2_P.

	* gcc.target/arm/pr88648-asm-syntax-unified.c: Add test to
	check if -masm-syntax-unified gets applied properly.

Added:
    branches/gcc-8-branch/gcc/testsuite/gcc.target/arm/pr88648-asm-syntax-unified.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/config/arm/arm.c
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
Comment 6 ktkachov 2019-02-11 09:31:44 UTC
Author: ktkachov
Date: Mon Feb 11 09:31:13 2019
New Revision: 268765

URL: https://gcc.gnu.org/viewcvs?rev=268765&root=gcc&view=rev
Log:
ARM: fix -masm-syntax-unified (PR88648)

	Backport from mainline.
	2019-01-10  Stefan Agner  <stefan@agner.ch>

	PR target/88648
	* config/arm/arm.c (arm_option_override_internal): Force
	opts->x_inline_asm_unified to true only if TARGET_THUMB2_P.

	* gcc.target/arm/pr88648-asm-syntax-unified.c: Add test to
	check if -masm-syntax-unified gets applied properly.

Added:
    branches/gcc-7-branch/gcc/testsuite/gcc.target/arm/pr88648-asm-syntax-unified.c
Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/config/arm/arm.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
Comment 7 ktkachov 2019-02-11 09:34:06 UTC
Fixed on all active branches.