This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: intel gas and `--32'


On Thu, 11 Jan 2001, Philip Blundell wrote:

> Passing the `--32' option to an i386 non-ELF gas (i386-cygwin, say) causes it 
> to silently call exit(1).  The problem is that md_longopts mentions this flag, 
> but md_parse_option doesn't do anything about it.

Fixed by the following patch, along with other recent x86 warts.

bfd/ChangeLog
	* configure.in ([bfd_elf64_x86_64_vec]): Set target64.
	* configure: Regenerate.

gas/ChangeLog
	* config/tc-i386.c (md_longopts): Recognize "--64" only for ELF.
	(md_parse_option): Always accept "--32".

gas/testsuite/ChangeLog
	* gas/i386/i386.exp (gas_64_check): Correct target string.
	Use gas_64_check rather than target string to decided whether
	x86_64 checks should run.
	* gas/i386/sse2.s: Add a label to cure objdump "no symbols" error.
	* gas/i386/ssemmx2.s: Likewise.
	* gas/i386/sse2.d: Update to suit.
	* gas/i386/ssemmx2.s: Likewise.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.

Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.38
diff -u -p -r1.38 configure.in
--- configure.in	2000/12/08 22:50:07	1.38
+++ configure.in	2001/01/12 02:29:35
@@ -507,7 +507,8 @@ do
     bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
     bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
-    bfd_elf64_x86_64_vec)	tb="$tb elf64-x86-64.lo elf64.lo $elf" ;;
+    bfd_elf64_x86_64_vec)	tb="$tb elf64-x86-64.lo elf64.lo $elf"
+				target64=true ;;
     bfd_elf32_i860_vec)		tb="$tb elf32-i860.lo elf32.lo $elf" ;;
     bfd_elf32_i860_little_vec)	tb="$tb elf32-i860.lo elf32.lo $elf" ;;
     bfd_elf32_i960_vec)		tb="$tb elf32-i960.lo elf32.lo $elf" ;;
Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.78
diff -u -p -r1.78 tc-i386.c
--- tc-i386.c	2001/01/08 09:37:43	1.78
+++ tc-i386.c	2001/01/12 02:55:30
@@ -4366,11 +4366,14 @@ const char *md_shortopts = "kVQ:sq";
 #else
 const char *md_shortopts = "q";
 #endif
+
 struct option md_longopts[] = {
 #define OPTION_32 (OPTION_MD_BASE + 0)
   {"32", no_argument, NULL, OPTION_32},
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
 #define OPTION_64 (OPTION_MD_BASE + 1)
   {"64", no_argument, NULL, OPTION_64},
+#endif
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof (md_longopts);
@@ -4405,35 +4408,28 @@ md_parse_option (c, arg)
       /* -s: On i386 Solaris, this tells the native assembler to use
          .stab instead of .stab.excl.  We always use .stab anyhow.  */
       break;
-#endif
-#ifdef OBJ_ELF
-    case OPTION_32:
+
     case OPTION_64:
       {
 	const char **list, **l;
 
-	default_arch = c == OPTION_32 ? "i386" : "x86_64";
 	list = bfd_target_list ();
 	for (l = list; *l != NULL; l++)
-	  {
-	    if (c == OPTION_32)
-	      {
-		if (strcmp (*l, "elf32-i386") == 0)
-		  break;
-	      }
-	    else
-	      {
-		if (strcmp (*l, "elf64-x86-64") == 0)
-		  break;
-	      }
-	  }
+	  if (strcmp (*l, "elf64-x86-64") == 0)
+	    {
+	      default_arch = "x86_64";
+	      break;
+	    }
 	if (*l == NULL)
-	  as_fatal (_("No compiled in support for %d bit object file format"),
-		    c == OPTION_32 ? 32 : 64);
+	  as_fatal (_("No compiled in support for x86_64"));
 	free (list);
       }
       break;
 #endif
+
+    case OPTION_32:
+      default_arch = "i386";
+      break;
 
     default:
       return 0;
Index: gas/testsuite/gas/i386/i386.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/i386.exp,v
retrieving revision 1.8
diff -u -p -r1.8 i386.exp
--- i386.exp	2001/01/10 14:32:32	1.8
+++ i386.exp	2001/01/12 02:55:50
@@ -20,8 +20,9 @@ proc gas_64_check { } {
     global srcdir
 
     catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
-    return [regexp "targets:.*x86_64" $nm_help];
+    return [regexp "targets:.*x86-64" $nm_help];
 }
+
 proc gas_32_check { } {
     global NM
     global NMFLAGS
@@ -61,7 +62,8 @@ if [expr ([istarget "i*86-*-*"] ||  [ist
     }
     set ASFLAGS "$old_ASFLAGS"
 }
-if [istarget "x86_64-*-*"] then {
+
+if [gas_64_check] then {
 
     global ASFLAGS
     set old_ASFLAGS "$ASFLAGS"
Index: gas/testsuite/gas/i386/sse2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/sse2.d,v
retrieving revision 1.1
diff -u -p -w -r1.1 sse2.d
--- sse2.d	2001/01/10 14:32:32	1.1
+++ sse2.d	2001/01/12 02:57:47
@@ -6,7 +6,7 @@
 
 Disassembly of section .text:
 
-0+ <.text>:
+0+ <foo>:
 [ 	]+0:	0f c3 00[ 	]+movnti %eax,\(%eax\)
 [ 	]+3:	0f ae f8[ 	]+sfence 
 [ 	]+6:	0f ae e8[ 	]+lfence 
Index: gas/testsuite/gas/i386/sse2.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/sse2.s,v
retrieving revision 1.1
diff -u -p -w -r1.1 sse2.s
--- sse2.s	2001/01/10 14:32:32	1.1
+++ sse2.s	2001/01/12 02:57:47
@@ -1,3 +1,4 @@
+foo:
 movnti %eax, (%eax)
 sfence
 lfence
@@ -144,4 +145,5 @@ pshuflw	$1, %xmm0, %xmm1
 pslldq	$1, %xmm0
 psrldq	$1, %xmm0
 punpckhqdq	%xmm0, %xmm1
+
 .p2align 4
Index: gas/testsuite/gas/i386/ssemmx2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/ssemmx2.d,v
retrieving revision 1.1
diff -u -p -w -r1.1 ssemmx2.d
--- ssemmx2.d	2001/01/10 14:32:32	1.1
+++ ssemmx2.d	2001/01/12 02:57:47
@@ -6,7 +6,7 @@
 
 Disassembly of section .text:
 
-0+ <.text>:
+0+ <foo>:
 [ 	]+0:	66 0f e0 c1[ 	]+pavgb[ 	]+%xmm1,%xmm0
 [ 	]+4:	66 0f e0 0a[ 	]+pavgb[ 	]+\(%edx\),%xmm1
 [ 	]+8:	66 0f e3 d3[ 	]+pavgw[ 	]+%xmm3,%xmm2
Index: gas/testsuite/gas/i386/ssemmx2.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/ssemmx2.s,v
retrieving revision 1.1
diff -u -p -w -r1.1 ssemmx2.s
--- ssemmx2.s	2001/01/10 14:32:32	1.1
+++ ssemmx2.s	2001/01/12 02:57:47
@@ -1,4 +1,5 @@
 .code32
+foo:
 pavgb		%xmm1,%xmm0
 pavgb		(%edx),%xmm1
 pavgw		%xmm3,%xmm2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]