This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Use -mtune= instead of -mcpu=


Hi!

This is an unsuccessful attempt to cure
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
warnings during the build.
GCC <= 3.3.x use -mcpu=, while 3.4.x+ uses -mtune=.
Unfortunately, it seems AC_SUBST doesn't work in configure fragments or
something.  Roland, any ideas?

Alternatively we could use something like:
CFLAGS-initfini.s += -march=i386 -m$(shell if $(CC) $(CFLAGS) -mtune=i386 -xc /dev/null -S -o - > /dev/null 2>&1; then echo tune; else echo cpu; fi)=i386

2005-03-05  Jakub Jelinek  <jakub@redhat.com>

	* config.make.in (have-cc-mtune): Add.
	* sysdeps/i386/configure.in (libc_cv_cc_mtune): Test for -mtune=
	switch.
	* sysdeps/i386/configure: Rebuilt.
	* sysdeps/i386/Makefile (CFLAGS-initfini.s): Use -mtune= instead
	of -mcpu= if compiler supports that.
linuxthreads/
	* sysdeps/i386/Makefile (CFLAGS-pt-initfini.s): Use -mtune= instead
	of -mcpu= if compiler supports that.

--- libc/config.make.in.jj	2004-09-20 15:34:55.000000000 +0200
+++ libc/config.make.in	2005-03-05 13:29:19.908436601 +0100
@@ -62,6 +62,7 @@ have-selinux = @have_selinux@
 have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
 fno-unit-at-a-time = @fno_unit_at_a_time@
 bind-now = @bindnow@
+have-cc-mtune = @libc_cv_cc_mtune@
 
 static-libgcc = @libc_cv_gcc_static_libgcc@
 
--- libc/sysdeps/i386/Makefile.jj	2005-01-26 18:22:24.000000000 +0100
+++ libc/sysdeps/i386/Makefile	2005-03-05 13:30:29.977959034 +0100
@@ -8,8 +8,12 @@ long-double-fcts = yes
 ifeq ($(subdir),csu)
 # On i686 we must avoid generating the trampoline functions generated
 # to get the GOT pointer.
+ifeq ($(have-cc-mtune),yes)
+CFLAGS-initfini.s += -march=i386 -mtune=i386
+else
 CFLAGS-initfini.s += -march=i386 -mcpu=i386
 endif
+endif
 
 ifeq ($(subdir),gmon)
 sysdep_routines += i386-mcount
--- libc/sysdeps/i386/configure.in.jj	2005-01-05 10:39:52.000000000 +0100
+++ libc/sysdeps/i386/configure.in	2005-03-05 13:27:32.001651891 +0100
@@ -33,3 +33,11 @@ rm -f conftest*])AC_SUBST(libc_cv_cpp_as
 if test $libc_cv_cpp_asm_debuginfo = yes; then
   AC_DEFINE(HAVE_CPP_ASM_DEBUGINFO)
 fi
+
+AC_CACHE_CHECK(if compiler supports -mtune option,
+	       libc_cv_cc_mtune, [dnl
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mtune=i386"
+  libc_cv_cc_mtune=no
+  AC_TRY_COMPILE(,,[libc_cv_cc_mtune=yes])
+])AC_SUBST(libc_cv_cc_mtune)
--- libc/sysdeps/i386/configure.jj	2005-01-05 10:39:52.000000000 +0100
+++ libc/sysdeps/i386/configure	2005-03-05 13:27:36.198904475 +0100
@@ -52,3 +52,61 @@ if test $libc_cv_cpp_asm_debuginfo = yes
 _ACEOF
 
 fi
+
+
+echo "$as_me:$LINENO: checking if compiler supports -mtune option" >&5
+echo $ECHO_N "checking if compiler supports -mtune option... $ECHO_C" >&6
+if test "${libc_cv_cc_mtune+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mtune=i386"
+  libc_cv_cc_mtune=no
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_cc_mtune=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $libc_cv_cc_mtune" >&5
+echo "${ECHO_T}$libc_cv_cc_mtune" >&6
--- libc/linuxthreads/sysdeps/i386/Makefile.jj	2005-01-08 16:50:22.000000000 +0100
+++ libc/linuxthreads/sysdeps/i386/Makefile	2005-03-05 13:31:40.653373513 +0100
@@ -1,7 +1,11 @@
 ifeq ($(subdir),linuxthreads)
 # On i686 we must avoid generating the trampoline functions generated
 # to get the GOT pointer.
+ifeq ($(have-cc-mtune),yes)
+CFLAGS-pt-initfini.s += -march=i386 -mtune=i386
+else
 CFLAGS-pt-initfini.s += -march=i386 -mcpu=i386
+endif
 
 # Most files must not be compiled without frame pointer since we need
 # the frame base address which is stored in %ebp unless the frame pointer

	Jakub


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