[RFA] Fix build issue for binutils on newer SunOS systems

Alan Modra amodra@gmail.com
Tue Feb 9 05:10:00 GMT 2016


On Mon, Feb 08, 2016 at 09:02:19PM +0100, Pierre Muller wrote:
> 
>   SUNOS has changed the macro AT_SUN_HWCAP from 2009 to AT_SUN_CAP_HW1.
> 
>   This causes a warning, turned into an error by -Werror,
> because of re-definition of this macro on a system that
> has the new definition of this macro.

I'm committing this simpler patch, which like yours undefines
AT_SUN_HWCAP.  Nick had a different patch attached to the PR but it
didn't get committed, probably just an oversight, that only defined
AT_SUN_HWCAP if not already defined.  There's really not much
difference in the two patches, just a matter of whose AT_SUN_HWCAP
value you trust the most.

I did consider adding the following, but decided it was not worth
worrying.
#if defined AT_SUN_HWCAP && AT_SUN_HWCAP != 2009
#error AT_SUN_HWCAP value changed?
#endif

Note that I haven't defined AT_SUN_CAP_HW1 because a) there are as yet
no uses of the macro in the binutils/gdb sources, and b) presumably
AT_SUN_CAP_HW2 ought to be defined at the same time.

	PR 16583
	* elf/common.h (AT_SUN_HWCAP): Undef before defining.

diff --git a/include/elf/common.h b/include/elf/common.h
index 767ad3e..087d876 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -1021,6 +1021,7 @@
 #define AT_SUN_LDNAME   2006    /* String giving name of dynamic linker.  */
 #define AT_SUN_LPAGESZ  2007    /* Large pagesize.   */
 #define AT_SUN_PLATFORM 2008    /* Platform name string.  */
+#undef AT_SUN_HWCAP
 #define AT_SUN_HWCAP    2009	/* Machine dependent hints about
 				   processor capabilities.  */
 #define AT_SUN_IFLUSH   2010    /* Should flush icache? */

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list