Bug 8787 - [DJGPP] GCC fails to emit .intel_syntax when invoked with the -masm=intel on DJGPP
Summary: [DJGPP] GCC fails to emit .intel_syntax when invoked with the -masm=intel on ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: 3.3.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-02 09:06 UTC by killer.lightspeed
Modified: 2003-06-12 00:03 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-06-09 19:42:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description killer.lightspeed 2002-12-02 09:06:00 UTC
GCC fails to emit the .intel_syntax directive when invoked with -masm=intel

E:\DJGPP\bugs>gcc -v -save-temps -masm=intel -Wa,-al -c test.c
Reading specs from e:/djgpp/lib/gcc-lib/djgpp/3.1/specs
Configured with: ../configure
i586-pc-msdosdjgpp --prefix=/dev/env/DJDIR --disable-nls
Thread model: single
gcc version 3.1

e:/djgpp/lib/gcc-lib/djgpp/3.1/cpp0.exe -lang-c -v -D__GNUC__=3 -D__GNUC_MIN
OR__=1 -D__GNUC_PATCHLEVEL__=0 -D__MSDOS__ -D__GO32__ -D__DJGPP__=2 -D__unix
__ -D__MSDOS__ -D__GO32__ -D__DJGPP__=2 -D__unix__ -Asystem=msdos -Asystem=u
nix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D_
_i386 -D__i386__ -D__tune_i586__ -D__tune_pentium__ -DMSDOS -DGO32 -DDJGPP=2
 -Dunix -remap -imacros e:/djgpp/lib/gcc-lib/djgpp/3.1/djgpp.ver test.c
test.i
GNU CPP version 3.1 (cpplib) (80386, BSD syntax)
ignoring nonexistent directory "e:/djgpp/djgpp/include"
#include "..." search starts here:
#include <...> search starts here:
 e:/djgpp/lib/gcc-lib/djgpp/3.1/include
 e:/djgpp/include
End of search list.
 e:/djgpp/lib/gcc-lib/djgpp/3.1/cc1.exe -fpreprocessed
test.i -quiet -dumpbase test.c -masm=intel -version -o test.s
GNU CPP version 3.1 (cpplib) (80386, BSD syntax)
GNU C version 3.1 (djgpp)
        compiled by GNU C version 3.1.
 e:/djgpp/bin/as.exe --traditional-format -al -o test.o test.s
test.s: Assembler messages:
test.s:7: Error: too many memory references for `mov'
test.s:8: Error: too many memory references for `sub'
test.s:9: Error: too many memory references for `and'
test.s:10: Error: too many memory references for `mov'
test.s:11: Error: too many memory references for `sub'
test.s:12: Error: too many memory references for `mov'
GAS LISTING test.s              page 1


   1                            .file   "test.c"
   2                            .section .text
   3                            .p2align 1
   4                    .globl _main
   5                    _main:
   6 ???? FF350000              push    ebp
   6      0000
   7                            mov     ebp, esp
   8                            sub     esp, 8
   9                            and     esp, -16
  10                            mov     eax, 0
  11                            sub     esp, eax
  12                            mov     eax, 1
  13 ???? C9                    leave
  14 ???? C3                    ret
  15                            .ident  "GCC: (GNU) 3.1"


Notice the missing .intel_syntax directive in the assembler file, causing
the errors.

Release:
gcc version 3.2.1

Environment:
OS: Windows 98 [Version 4.10.2222]
CPU: AuthenticAMD AMD-K6(tm) 3D processor
RAM: 160.0MB RAM

How-To-Repeat:
Preprocessed source:
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "e:/djgpp/lib/gcc-lib/djgpp/3.1/djgpp.ver" 1
# 1 "e:/djgpp/include/sys/version.h" 1 3
# 2 "e:/djgpp/lib/gcc-lib/djgpp/3.1/djgpp.ver" 2
# 2 "<command line>" 2
# 1 "test.c"
int main (void){
    return 1;
}

Invoked with: gcc -v -save-temps -masm=intel -Wa,-al -c test.c
Comment 1 Andrew Pinski 2003-05-25 23:13:55 UTC
Can you try using 3.3?
Comment 2 Andrew Pinski 2003-06-09 01:14:55 UTC
Also what version of binutils are you using?
Comment 3 killer.lightspeed 2003-06-09 11:44:41 UTC
Subject: Re:  [Cygwin] GCC fails to emit .intel_syntax when
 invoked with the -masm=intel on DJGPP

pinskia@physics.uc.edu wrote:

>PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8787
>
>
>
>------- Additional Comments From pinskia@physics.uc.edu  2003-06-09 01:14 -------
>Also what version of binutils are you using?
>
>
>
>------- You are receiving this mail because: -------
>You reported the bug, or are watching the reporter.
>
>  
>
OK. It's a DJGPP specific problem.
It does emit ".intel_syntax" under GCC 3.2 under Linux [gcc version 3.2 
(Mandrake Linux 9.0 3.2-1mdk)]
(see attached file [test1.linux.s] for output)
But, strangely, gcc 3.2 under Mandrake still prefixes registers with % 
when invoked with .intel_syntax, and GAS 2.12.90.0.15 under Linux does 
not accept the registers without the %.
This Linux binutils version is 2.12.90.0.15
[GNU assembler version 2.12.90.0.15 (i586-mandrake-linux-gnu) using BFD 
version 2.12.90.0.15 20020717]
Should I submit a bug report for this?

The DJGPP binutils version is 2.13.
[GNU assembler version 2.13 (i386-pc-msdosdjgpp) using BFD version 2.13]

The gcc version is 3.2.1
(see attached file [test1.djgpp.s] for output)
GCC version 3.2.3 is the same.

I will test gcc 3.3 when I can.
	.file	"test.c"
	.section .text
.globl _main
_main:
	push	ebp
	mov	ebp, esp
	sub	esp, 8
	and	esp, -16
	mov	eax, 0
	sub	esp, eax
	mov	eax, 1
	leave
	ret
	.ident	"GCC: (GNU) 3.2.1"
	.file	"test.c"
	.intel_syntax
	.text
	.align 2
.globl main
	.type	main,@function
main:
	push	%ebp
	mov	%ebp, %esp
	sub	%esp, 8
	and	%esp, -16
	mov	%eax, 0
	sub	%esp, %eax
	mov	%eax, 1
	leave
	ret
.Lfe1:
	.size	main,.Lfe1-main
	.ident	"GCC: (GNU) 3.2 (Mandrake Linux 9.0 3.2-1mdk)"
Comment 4 Andrew Pinski 2003-06-09 12:43:33 UTC
This is a real bug, looks like someone forgot to update config/i386/djgpp.h to print out 
`.intel_syntax' when ix86_asm_dialect == ASM_INTEL is true like att.h, linux.h, and gas.h.
This looks like it is easy to fix (I have not test this yet but can you?):
Patch to fix it:
Index: djgpp.h
============================================================
=======
RCS file: /cvs/gcc/gcc/gcc/config/i386/djgpp.h,v
retrieving revision 1.43
diff -u -d -b -w -u -p -r1.43 djgpp.h
--- djgpp.h	26 Dec 2002 18:45:02 -0000	1.43
+++ djgpp.h	9 Jun 2003 12:41:45 -0000
@@ -136,6 +136,8 @@ Boston, MA 02111-1307, USA.  */
 #undef ASM_FILE_START
 #define ASM_FILE_START(FILE)						\
   do {									\
+	if (ix86_asm_dialect == ASM_INTEL)				\
+	  fputs ("\t.intel_syntax\n", FILE);				\
 	output_file_directive (FILE, main_input_filename);		\
   } while (0)
 
Comment 5 killer.lightspeed 2003-06-09 19:34:50 UTC
Subject: Re:  [Cygwin] GCC fails to emit .intel_syntax when
 invoked with the -masm=intel on DJGPP

pinskia@physics.uc.edu wrote:

>PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
>
>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8787
>
>
>
>------- Additional Comments From pinskia@physics.uc.edu  2003-06-09 12:43 -------
>This is a real bug, looks like someone forgot to update config/i386/djgpp.h to print out 
>`.intel_syntax' when ix86_asm_dialect == ASM_INTEL is true like att.h, linux.h, and gas.h.
>This looks like it is easy to fix (I have not test this yet but can you?):
>
<snip>

It's 5 in the morning now. I've killed two birds with the one stone (so 
to say).
I tried it with GCC 3.2.2, with another small patch (for an ABI 
problem), and both problems were solved.
It now emits the .intel_syntax directive with -masm=intel, and it also 
correctly returns PCC structures, instead of REG structures by default.

Here's my diff (done under Linux). "djgpp.new" was created just for me 
to extract the old djgpp.h. Unfortunately, unzip did not set the 
modification time correctly, so I put it in by hand.

diff -u -d -b -w -u -p djgpp.old/gnu/gcc-3.22/gcc/config/i386/djgpp.h 
djgpp/gnu/gcc-3.22/gcc/config/i386/djgpp.h
--- djgpp.new/gnu/gcc-3.22/gcc/config/i386/djgpp.h    2003-03-04 21:10
+++ djgpp/gnu/gcc-3.22/gcc/config/i386/djgpp.h    2003-06-09 
23:10:36.000000000 +1000
@@ -137,6 +137,8 @@ Boston, MA 02111-1307, USA.  */
 #undef ASM_FILE_START
 #define ASM_FILE_START(FILE)                        \
   do {                                    \
+    if (ix86_asm_dialect == ASM_INTEL)                \
+      fputs ("\t.intel_syntax\n", FILE);                \
     output_file_directive (FILE, main_input_filename);        \
   } while (0)

@@ -258,6 +260,6 @@ do {                                \
 #undef DWARF_FRAME_REGNUM
 #define DWARF_FRAME_REGNUM(n) dbx_register_map[n]

-/* Don't default to pcc-struct-return, because gcc is the only compiler,
+/* Do default to pcc-struct-return, because gcc is the only compiler,
    and we want to retain compatibility with older gcc versions.  */
-#define DEFAULT_PCC_STRUCT_RETURN 0
+#define DEFAULT_PCC_STRUCT_RETURN 1


Comment 6 Andrew Pinski 2003-06-09 19:42:27 UTC
Thanks for trying it out an reporting it works I am submitting the patch for inclusion, it most likely 
will not be included for 3.3.1 but who knows I will try it for 3.3.1.
Comment 7 DJ Delorie 2003-06-09 19:54:01 UTC
Subject: Re:  [Cygwin] GCC fails to emit .intel_syntax when invoked with the -masm=intel on DJGPP


> I tried it with GCC 3.2.2,

3.2 is a dead branch.  Please produce patches for the 3.3 branch and
the cvs head (future 3.4).
Comment 8 Andrew Pinski 2003-06-09 20:02:22 UTC
My patch was for the mainline but nothing has changed in this area ever (aka since this file was 
added to the cvs which it was renamed from go32.h) it does not matter.
Comment 9 GCC Commits 2003-06-09 20:35:52 UTC
Subject: Bug 8787

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	zack@gcc.gnu.org	2003-06-09 20:35:47

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: djgpp.h 

Log message:
	2003-06-08  Andrew Pinski  <pinskia@physics.uc.edu>
	
	PR target/8787
	* config/i386/djgpp.h (ASM_FILE_START): emit `.intel_syntax'
	if -masm=intel.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.18121&r2=1.18122
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/djgpp.h.diff?cvsroot=gcc&r1=1.43&r2=1.44

Comment 10 GCC Commits 2003-06-11 23:08:13 UTC
Subject: Bug 8787

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	dj@gcc.gnu.org	2003-06-11 23:08:11

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: djgpp.h 

Log message:
	PR target/8787
	* config/i386/djgpp.h (ASM_FILE_START): emit `.intel_syntax'
	if -masm=intel.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.567&r2=1.16114.2.568
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/djgpp.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.42&r2=1.42.2.1

Comment 11 Andrew Pinski 2003-06-11 23:10:45 UTC
Will be fixed in 3.3.1.