[PATCH] Don't build 32-bit libatomic with -march=i486 on x86-64

Uros Bizjak ubizjak@gmail.com
Tue Apr 19 15:45:00 GMT 2016


On Tue, Apr 19, 2016 at 5:07 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Gcc uses the same -march= for both -m32 and -m64 on x86-64 unless
> --with-arch-32= is used.  There is no need for -march=i486 to compile
> 32-bit libatomic on x86-64.
>
> Tested on x86-64.  OK for trunk?
>
> H.J.
> ---
>         PR target/70454
>         * configure.tgt (XCFLAGS): Don't add -march=i486 to compile
>         32-bit x86 target library on x86-64.
> ---
>  libatomic/configure.tgt | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
> index c5470d7..bbb93fc 100644
> --- a/libatomic/configure.tgt
> +++ b/libatomic/configure.tgt
> @@ -81,14 +81,8 @@ case "${target_cpu}" in
>         try_ifunc=yes
>         ;;
>    x86_64)
> -       case " ${CC} ${CFLAGS} " in
> -         *" -m32 "*)
> -           XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
> -           XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
> -           ;;
> -         *)
> -           ;;
> -       esac
> +       # Since 64-bit arch > i486, we can use the same -march= to build
> +       # both 32-bit and 64-bit target libraries.
>         ARCH=x86
>         # ??? Detect when -mcx16 is already enabled.
>         try_ifunc=yes
> --
> 2.5.5
>

No, this is wrong. My build with default options defaults to i386. So,
the difference between

$ /ssd/uros/gcc-build/gcc/cc1 -E -dM -m32 hello.c > aaa

and

$ /ssd/uros/gcc-build/gcc/cc1 -E -dM -m32 -march=i486 hello.c > bbb

is substantial:
--- aaa 2016-04-19 17:44:08.798432467 +0200
+++ bbb 2016-04-19 17:44:16.078351225 +0200
@@ -12,12 +12,15 @@
 #define __ORDER_LITTLE_ENDIAN__ 1234
 #define __SIZE_MAX__ 0xffffffffU
 #define __WCHAR_MAX__ 0x7fffffffL
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
 #define __DBL_DENORM_MIN__ ((double)4.94065645841246544177e-324L)
-#define __GCC_ATOMIC_CHAR_LOCK_FREE 1
+#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
 #define __GCC_IEC_559 2
 #define __FLT_EVAL_METHOD__ 2
 #define __unix__ 1
-#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1
+#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
 #define __UINT_FAST64_MAX__ 0xffffffffffffffffULL
 #define __SIG_ATOMIC_TYPE__ int
 #define __DBL_MIN_10_EXP__ (-307)
@@ -31,7 +34,7 @@
 #define __SHRT_MAX__ 0x7fff
 #define __LDBL_MAX__ 1.18973149535723176502e+4932L
 #define __UINT_LEAST8_MAX__ 0xff
-#define __GCC_ATOMIC_BOOL_LOCK_FREE 1
+#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
 #define __UINTMAX_TYPE__ long long unsigned int
 #define __linux 1
 #define __DEC32_EPSILON__ 1E-6DF
@@ -44,7 +47,7 @@
 #define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1)
 #define __INT64_C(c) c ## LL
 #define __DBL_DIG__ 15
-#define __GCC_ATOMIC_POINTER_LOCK_FREE 1
+#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
 #define __SIZEOF_INT__ 4
 #define __SIZEOF_POINTER__ 4
 #define __USER_LABEL_PREFIX__
@@ -80,6 +83,7 @@
 #define __DEC128_EPSILON__ 1E-33DL
 #define __ATOMIC_HLE_RELEASE 131072
 #define __PTRDIFF_MAX__ 0x7fffffff
+#define __tune_i486__ 1
 #define __STDC_NO_THREADS__ 1
 #define __ATOMIC_HLE_ACQUIRE 65536
 #define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
@@ -102,7 +106,7 @@
 #define __VERSION__ "7.0.0 20160419 (experimental) [trunk revision 235206]"
 #define __UINT64_C(c) c ## ULL
 #define _STDC_PREDEF_H 1
-#define __GCC_ATOMIC_INT_LOCK_FREE 1
+#define __GCC_ATOMIC_INT_LOCK_FREE 2
 #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
 #define __STDC_IEC_559_COMPLEX__ 1
 #define __INT32_C(c) c
@@ -111,6 +115,7 @@
 #define __DEC128_MIN_EXP__ (-6142)
 #define __code_model_32__ 1
 #define __INT_FAST32_TYPE__ int
+#define __i486__ 1
 #define __UINT_LEAST16_TYPE__ short unsigned int
 #define unix 1
 #define __INT16_MAX__ 0x7fff
@@ -125,7 +130,7 @@
 #define __LDBL_EPSILON__ 1.08420217248550443401e-19L
 #define __UINTMAX_C(c) c ## ULL
 #define __SIG_ATOMIC_MAX__ 0x7fffffff
-#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1
+#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
 #define __SIZEOF_PTRDIFF_T__ 4
 #define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
 #define __INT_FAST16_MAX__ 0x7fffffff
@@ -146,7 +151,7 @@
 #define __INT64_MAX__ 0x7fffffffffffffffLL
 #define __UINT_LEAST32_MAX__ 0xffffffffU
 #define __SEG_GS 1
-#define __GCC_ATOMIC_LONG_LOCK_FREE 1
+#define __GCC_ATOMIC_LONG_LOCK_FREE 2
 #define __INT_LEAST64_TYPE__ long long int
 #define __INT16_TYPE__ short int
 #define __INT_LEAST8_TYPE__ signed char
@@ -169,12 +174,13 @@
 #define __FLT_DIG__ 6
 #define __UINT_FAST64_TYPE__ long long unsigned int
 #define __INT_MAX__ 0x7fffffff
+#define __i486 1
 #define __INT64_TYPE__ long long int
 #define __FLT_MAX_EXP__ 128
 #define __DBL_MANT_DIG__ 53
 #define __SIZEOF_FLOAT128__ 16
 #define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL
-#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1
+#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
 #define __DEC64_MIN__ 1E-383DD
 #define __WINT_TYPE__ unsigned int
 #define __UINT_LEAST32_TYPE__ unsigned int
@@ -228,7 +234,7 @@
 #define __LDBL_DIG__ 18
 #define __FLT_DECIMAL_DIG__ 9
 #define __UINT_FAST16_MAX__ 0xffffffffU
-#define __GCC_ATOMIC_SHORT_LOCK_FREE 1
+#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
 #define __UINT_FAST8_TYPE__ unsigned char
 #define __ATOMIC_ACQ_REL 4
 #define __ATOMIC_RELEASE 3

Uros.



More information about the Gcc-patches mailing list