This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

[PATCH] fix gas/gcc incompatibility regression on sparc (PR gas/13441)


This fixes PR gas/13441, a SPARC-specific regression present in the
binutils-2.22 release and on head, caused by the hwcap_allowed change
<http://sourceware.org/ml/binutils/2011-09/msg00133.html>.

Before that change gas did not require any explicit option to
accept instructions for later architecture revisions; it would
however record the minimum architecture revision needed by the
translation unit.

The hwcap_allowed change added a second independent mechanism for
checking instruction availability.  The new check is always enabled,
but hwcap_allowed is only set if the user passes an explicit -A option.
Without that option hwcap_allowed is always zero, making gas reject any
post-v7 instruction.  GCC did not pass that option to gas until very
recently (GCC PR50979 fixed for gcc-4.5 and later on 2011-11-04),
causing "older" gcc binaries to fail if binutils is updated and the
user's code needs post-v7 instructions.  In the PR, a signed int
multiply mapped to a v8 "smul" was enough to trigger the failure.

To maintain compatibility with "older" gcc binaries I suggest that
hwcap_allowed be default initialized to all-bits-one rather than zero,
effectively disabling the hwcap_allowed checking in the absence of
any explicit -A option.  The case when -A is present is unchanged.

Tested on binutils 2.22 and head with no testsuite regressions.

Ok for 2.22 branch and head?

(I don't have cvs write access, so if it's approved I'll need help
to get it committed.)

/Mikael

gas/

2011-11-27  Mikael Pettersson  <mikpe@it.uu.se>

	PR gas/13441
	* config/tc-sparc.c (hwcap_allowed): Initialize.
	(md_parse_option, case 'A'): Override default hwcap_allowed.

--- binutils-2.22/gas/config/tc-sparc.c.~1~	2011-09-22 02:03:28.000000000 +0200
+++ binutils-2.22/gas/config/tc-sparc.c	2011-11-27 17:04:18.000000000 +0100
@@ -84,7 +84,9 @@ static int hwcap_seen;
 #endif
 #endif
 
-static int hwcap_allowed;
+/* Bitmask of permitted instruction types, set from -A option.
+   Without -A option permits all instruction types.  */
+static int hwcap_allowed = ~0;
 
 static int architecture_requested;
 static int warn_on_bump;
@@ -507,7 +509,7 @@ md_parse_option (int c, char *arg)
 	if (!architecture_requested
 	    || opcode_arch > max_architecture)
 	  max_architecture = opcode_arch;
-	hwcap_allowed |= sa->hwcap_allowed;
+	hwcap_allowed = sa->hwcap_allowed;
 	architecture_requested = 1;
       }
       break;


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