Solaris 2.9 x86 gcc 4.5.0 configure -without-gnu-as -with-as=/usr/ccs/bin/as


 => Assembly syntax errors in gcov.c whereever there is lock prefix.


I was actually looking for a problem with lock prefixes on 4.3 -- testing
4.5.0,
 found this instead, which is about about the same.

See:
 http://gcc.gnu.org/viewcvs?view=revision&revision=127728
  for handling of the lock prefix in a separate instruction.

See:
http://developers.sun.com/sunstudio/downloads/ssx/express_Feb2008_readme.html
 "You can now place lock/rep/repnz/repz/repe/repne prefix on the same line as
the following instruction."

But I'd like to stay compatible with the existing Sun assembler at
/usr/ccs/bin/as.

I considered just changing them all to \;, like there is rep\;ret, but
I noticed this:
sync.md:  "lock{%;| }or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}"


which appears to be an attempt to output Microsoft/Intel assembly, so I went
with the space usually and ; only for Darwin/Solaris, like how sync.md
was already using ; for Darwin.


Proposed patch below.
I'll open a bug. And test it on some machines maybe.
Any marked with TARGET_64BIT I left alone. Maybe that is too inconsistent
though.


diff -uw /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/i386.c ./i386.c
--- /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/i386.c      Wed Apr  7
23:58:27 2010
+++ ./i386.c    Tue May 11 10:01:54 2010
@@ -11896,11 +11896,10 @@
          return;

        case ';':
-#if TARGET_MACHO
+         if (TARGET_MACHO || TARGET_SOLARIS)
          fputs (" ; ", file);
-#else
+         else
          putc (' ', file);
-#endif
          return;

        default:
diff -uw /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/i386.h ./i386.h
--- /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/i386.h      Wed Mar 24
21:44:48 2010
+++ ./i386.h    Tue May 11 09:59:01 2010
@@ -467,6 +467,9 @@
    redefines this to 1.  */
 #define TARGET_MACHO 0

+/* Like TARGET_MACHO, redefined in sol2.h. */
+#define TARGET_SOLARIS 0
+
 /* Likewise, for the Windows 64-bit ABI.  */
 #define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI)

diff -uw /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/i386.md ./i386.md
--- /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/i386.md     Wed Mar 24
19:49:49 2010
+++ ./i386.md   Tue May 11 09:49:05 2010
@@ -13811,7 +13811,7 @@
   [(return)
    (unspec [(const_int 0)] UNSPEC_REP)]
   "reload_completed"
-  "rep\;ret"
+  "rep{%;| }ret"
   [(set_attr "length" "2")
    (set_attr "atom_unit" "jeu")
    (set_attr "length_immediate" "0")
@@ -17772,7 +17772,7 @@
        (mem:BLK (match_dup 4)))
    (use (match_dup 5))]
   "!TARGET_64BIT"
-  "rep movs{l|d}"
+  "rep{%;| }movs{l|d}"
   [(set_attr "type" "str")
    (set_attr "prefix_rep" "1")
    (set_attr "memory" "both")
@@ -17808,7 +17808,7 @@
        (mem:BLK (match_dup 4)))
    (use (match_dup 5))]
   "!TARGET_64BIT"
-  "rep movsb"
+  "rep{%;| }movsb"
   [(set_attr "type" "str")
    (set_attr "prefix_rep" "1")
    (set_attr "memory" "both")
@@ -18023,7 +18023,7 @@
    (use (match_operand:SI 2 "register_operand" "a"))
    (use (match_dup 4))]
   "!TARGET_64BIT"
-  "rep stos{l|d}"
+  "rep{%;| }stos{l|d}"
   [(set_attr "type" "str")
    (set_attr "prefix_rep" "1")
    (set_attr "memory" "store")
@@ -18056,7 +18056,7 @@
    (use (match_operand:QI 2 "register_operand" "a"))
    (use (match_dup 4))]
   "!TARGET_64BIT"
-  "rep stosb"
+  "rep{%;| }stosb"
   [(set_attr "type" "str")
    (set_attr "prefix_rep" "1")
    (set_attr "memory" "store")
@@ -18188,7 +18188,7 @@
    (clobber (match_operand:SI 1 "register_operand" "=D"))
    (clobber (match_operand:SI 2 "register_operand" "=c"))]
   "!TARGET_64BIT"
-  "repz cmpsb"
+  "repz{%;| }cmpsb"
   [(set_attr "type" "str")
    (set_attr "mode" "QI")
    (set_attr "prefix_rep" "1")])
@@ -18239,7 +18239,7 @@
    (clobber (match_operand:SI 1 "register_operand" "=D"))
    (clobber (match_operand:SI 2 "register_operand" "=c"))]
   "!TARGET_64BIT"
-  "repz cmpsb"
+  "repz{%;| }cmpsb"
   [(set_attr "type" "str")
    (set_attr "mode" "QI")
    (set_attr "prefix_rep" "1")])
@@ -18305,7 +18305,7 @@
    (clobber (match_operand:SI 1 "register_operand" "=D"))
    (clobber (reg:CC FLAGS_REG))]
   "!TARGET_64BIT"
-  "repnz scasb"
+  "repnz{%;| }scasb"
   [(set_attr "type" "str")
    (set_attr "mode" "QI")
    (set_attr "prefix_rep" "1")])
diff -uw /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/sol2.h ./sol2.h
--- /home/jkrell/src/orig/gcc-4.5.0/gcc/config/i386/sol2.h      Wed Mar 31
11:03:29 2010
+++ ./sol2.h    Tue May 11 10:02:17 2010
@@ -172,3 +172,6 @@
 #define TF_SIZE 113

 #define MD_UNWIND_SUPPORT "config/i386/sol2-unwind.h"
+
+#undef  TARGET_SOLARIS
+#define TARGET_SOLARIS 1


 - Jay


-- 
           Summary: Solaris 2.9 x86 Sun assembler doesn't like rep/lock
                    prefixes on same line
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jay dot krell at cornell dot edu
GCC target triplet: i386-pc-solaris2.9


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44074

Reply via email to