about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStan Shebs <stanshebs@google.com>2018-01-19 12:41:15 -0800
committerStan Shebs <stanshebs@google.com>2019-04-23 14:25:52 -0700
commit4bbfeb8e5ba1b401aeb6fb71b0044efc53e4e92f (patch)
treed0141ec2d8d3d32f4320ca47306bbad5bdd377f8
parentdcd2b97dd1d695445d45beb4daa815cfe06691dd (diff)
downloadglibc-4bbfeb8e5ba1b401aeb6fb71b0044efc53e4e92f.tar.gz
glibc-4bbfeb8e5ba1b401aeb6fb71b0044efc53e4e92f.tar.xz
glibc-4bbfeb8e5ba1b401aeb6fb71b0044efc53e4e92f.zip
Add --with-clang and --disable-float128 options to toplevel configury
-rw-r--r--Makeconfig19
-rw-r--r--Makerules4
-rw-r--r--config.h.in2
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure51
-rw-r--r--configure.ac26
6 files changed, 96 insertions, 7 deletions
diff --git a/Makeconfig b/Makeconfig
index 07007c9459..208fd3ddde 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -829,7 +829,9 @@ endif
 # We have to assume that glibc functions are called in any rounding
 # mode and also change the rounding mode in a few functions. So,
 # disable any optimization that assume default rounding mode.
+ifeq ($(with-clang),no)
 +math-flags = -frounding-math
+endif
 
 # Logically only "libnldbl", "nonlib" and "testsuite" should be using
 # -fno-math-errno. However due to GCC bug #88576, only "libm" can use
@@ -900,6 +902,19 @@ ifeq	"$(strip $(+cflags))" ""
 +cflags	:= $(default_cflags)
 endif	# $(+cflags) == ""
 
+# For now, manually add known-needed clang flags here.
+ifeq ($(with-clang),yes)
++cflags += -fheinous-gnu-extensions
+# Don't complain about __sigsetjmp.
++cflags += -Wno-builtin-requires-header
+# clang takes gnu89 as requiring a warning about duplicates, gcc does not
++cflags += -Wno-duplicate-decl-specifier
+# Non-string format arguments come from debugging prints in ld.so.
++cflags += -Wno-format-security
+
++cflags += -no-integrated-as
+endif	# with-clang == yes
+
 +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) \
 	   $(+stack-protector)
 +gcc-nowarn := -w
@@ -1048,6 +1063,10 @@ ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
 endif
 override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu)
 
+ifeq ($(with-clang),yes)
+ASFLAGS += -no-integrated-as
+endif	# with-clang == yes
+
 ifndef BUILD_CC
 BUILD_CC = $(CC)
 endif
diff --git a/Makerules b/Makerules
index 83bdd3a44d..e88655c378 100644
--- a/Makerules
+++ b/Makerules
@@ -587,7 +587,7 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
 common-generated += shlib.lds
 
 shlib-lds = $(common-objpfx)shlib.lds
-shlib-lds-flags = -T $(shlib-lds)
+shlib-lds-flags = -Wl,-T,$(shlib-lds)
 endif
 
 define build-shlib
@@ -639,7 +639,7 @@ LDFLAGS-c.so = -nostdlib -nostartfiles
 # But we still want to link libc.so against $(libc.so-gnulib).
 LDLIBS-c.so += $(libc.so-gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
-LDFLAGS-c.so += -e __libc_main
+LDFLAGS-c.so += -Wl,-e,__libc_main
 # Pre-link the objects of libc_pic.a so that we can locally resolve
 # COMMON symbols before we link against ld.so.  This is because ld.so
 # contains some of libc_pic.a already, which will prevent the COMMONs
diff --git a/config.h.in b/config.h.in
index f059ec0435..cf2accda0a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -183,6 +183,8 @@
 /* Define if the linker defines __ehdr_start.  */
 #undef HAVE_EHDR_START
 
+#define WANT_FLOAT128 0
+
 /*
  */
 
diff --git a/config.make.in b/config.make.in
index f46bfc29bb..40ff573082 100644
--- a/config.make.in
+++ b/config.make.in
@@ -103,6 +103,7 @@ use-nscd = @use_nscd@
 build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
 build-pt-chown = @build_pt_chown@
 have-tunables = @have_tunables@
+enable-float128 = @enable_float128@
 
 # Build tools.
 CC = @CC@
diff --git a/configure b/configure
index 101dfddf37..48a96a4d5f 100755
--- a/configure
+++ b/configure
@@ -670,6 +670,7 @@ stack_protector
 libc_cv_ssp
 libc_cv_with_fp
 base_machine
+enable_float128
 have_tunables
 build_pt_chown
 build_nscd
@@ -733,6 +734,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -762,6 +764,7 @@ with_gd_include
 with_gd_lib
 with_binutils
 with_selinux
+with_clang
 with_headers
 with_default_link
 with_nonshared_cflags
@@ -792,6 +795,7 @@ enable_build_nscd
 enable_nscd
 enable_pt_chown
 enable_tunables
+enable_float128
 enable_mathvec
 enable_cet
 with_cpu
@@ -846,6 +850,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1098,6 +1103,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1235,7 +1249,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1388,6 +1402,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1467,6 +1482,7 @@ Optional Features:
   --enable-pt_chown       Enable building and installing pt_chown
   --enable-tunables       Enable tunables support. Known values are 'yes',
                           'no' and 'valstring'
+  --disable-float128      disable float128 support
   --enable-mathvec        Enable building and installing mathvec [default
                           depends on architecture]
   --enable-cet            enable Intel Control-flow Enforcement Technology
@@ -1482,6 +1498,7 @@ Optional Packages:
   --with-gd-lib=DIR       find libgd library files in DIR
   --with-binutils=PATH    specify location of binutils (as and ld)
   --with-selinux          if building with SELinux support
+  --with-clang            if building with clang (temporary)
   --with-headers=PATH     location of system headers to use (for example
                           /usr/src/linux/include) [default=compiler default]
   --with-default-link     do not use explicit linker scripts
@@ -3324,6 +3341,16 @@ else
 fi
 
 
+# Check whether --with-clang was given.
+if test "${with_clang+set}" = set; then :
+  withval=$with_clang; with_clang=$withval
+else
+  with_clang=no
+fi
+
+config_vars="$config_vars
+with-clang = $with_clang"
+
 
 # Check whether --with-headers was given.
 if test "${with_headers+set}" = set; then :
@@ -3757,6 +3784,19 @@ if test "$have_tunables" = yes; then
 
 fi
 
+# Check whether --enable-float128 was given.
+if test "${enable_float128+set}" = set; then :
+  enableval=$enable_float128; enable_float128=$enableval
+else
+  enable_float128=yes
+fi
+
+
+if test "$enable_float128" = yes; then
+  $as_echo "#define WANT_FLOAT128 1" >>confdefs.h
+
+fi
+
 # The abi-tags file uses a fairly simplistic model for name recognition that
 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
@@ -5120,8 +5160,10 @@ main ()
 {
 
 #if !defined __GNUC__ || __GNUC__ < 5
+#if !defined __clang__
 #error insufficient compiler
 #endif
+#endif
   ;
   return 0;
 }
@@ -6271,7 +6313,7 @@ char *foo (const char *a, const char *b)
   return __builtin_strstr (a, b);
 }
 EOF
-if { ac_try='${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null'
+if { ac_try='${CC-cc} -O3 -S conftest.c -o - | grep -F "strstr" > /dev/null'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6352,7 +6394,7 @@ __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
 foo (void) {}
 EOF
 libc_cv_cc_loop_to_function=no
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c'
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6872,7 +6914,10 @@ libc_cv_pie_default=$libc_cv_cc_pie_default
 
 # Set the `multidir' variable by grabbing the variable from the compiler.
 # We do it once and save the result in a generated makefile.
+libc_cv_multidir=.
+if test "$with_clang" = no; then
 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
+fi
 
 
 if test "$static_pie" = yes; then
diff --git a/configure.ac b/configure.ac
index 46a74687a6..064743c131 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,13 @@ AC_ARG_WITH([selinux],
 			   [if building with SELinux support]),
 	    [with_selinux=$withval],
 	    [with_selinux=auto])
+dnl This is a temporary hack, to help sort out wired-in GCC assumptions.
+AC_ARG_WITH([clang],
+	    AC_HELP_STRING([--with-clang],
+			   [if building with clang (temporary)]),
+	    [with_clang=$withval],
+	    [with_clang=no])
+LIBC_CONFIG_VAR([with-clang], [$with_clang])
 
 AC_ARG_WITH([headers],
 	    AC_HELP_STRING([--with-headers=PATH],
@@ -454,6 +461,16 @@ if test "$have_tunables" = yes; then
   AC_DEFINE(HAVE_TUNABLES)
 fi
 
+AC_ARG_ENABLE([float128],
+	      AC_HELP_STRING([--disable-float128],
+			     [disable float128 support]),
+	      [enable_float128=$enableval],
+	      [enable_float128=yes])
+AC_SUBST(enable_float128)
+if test "$enable_float128" = yes; then
+  AC_DEFINE(WANT_FLOAT128)
+fi
+
 # The abi-tags file uses a fairly simplistic model for name recognition that
 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
@@ -1018,7 +1035,9 @@ AC_CHECK_PROG_VER(BISON, bison, --version,
 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
 AC_TRY_COMPILE([], [
 #if !defined __GNUC__ || __GNUC__ < 5
+#if !defined __clang__
 #error insufficient compiler
+#endif
 #endif],
 	       [libc_cv_compiler_ok=yes],
 	       [libc_cv_compiler_ok=no])])
@@ -1556,7 +1575,7 @@ char *foo (const char *a, const char *b)
 }
 EOF
 dnl
-if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
+if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "strstr" > /dev/null]);
 then
   libc_cv_gcc_builtin_redirection=yes
 else
@@ -1599,7 +1618,7 @@ __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
 foo (void) {}
 EOF
 libc_cv_cc_loop_to_function=no
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
 then
   libc_cv_cc_loop_to_function=yes
 fi
@@ -1865,7 +1884,10 @@ AC_SUBST(libc_cv_pie_default)
 
 # Set the `multidir' variable by grabbing the variable from the compiler.
 # We do it once and save the result in a generated makefile.
+libc_cv_multidir=.
+if test "$with_clang" = no; then
 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
+fi
 AC_SUBST(libc_cv_multidir)
 
 if test "$static_pie" = yes; then