aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Shebs <stanshebs@google.com>2018-01-19 12:41:15 -0800
committerStan Shebs <stanshebs@google.com>2018-01-24 16:03:39 -0800
commit6ebb7473f27cab164dfd7b9672e1ee027269132c (patch)
treeecd9b44d9c950cc3a5ccdc354c04fd9fcfef6319
parent64182edc575adc4d0591126c67e1673946b1617d (diff)
downloadglibc-6ebb7473f27cab164dfd7b9672e1ee027269132c.tar
glibc-6ebb7473f27cab164dfd7b9672e1ee027269132c.tar.gz
glibc-6ebb7473f27cab164dfd7b9672e1ee027269132c.tar.bz2
glibc-6ebb7473f27cab164dfd7b9672e1ee027269132c.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 86a71e5802..24b8d44959 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
# We might want to compile with some stack-protection flag.
ifneq ($(stack-protector),)
@@ -895,6 +897,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
@@ -1045,6 +1060,10 @@ ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
endif
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 ef6abeac6d..35147191e7 100644
--- a/Makerules
+++ b/Makerules
@@ -653,7 +653,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
@@ -705,7 +705,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 d928e7dd86..0e94d01a3f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -169,6 +169,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 9e5e24b2c6..58f56c3038 100644
--- a/config.make.in
+++ b/config.make.in
@@ -101,6 +101,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 7a8bd3f817..8bdc71adf4 100755
--- a/configure
+++ b/configure
@@ -669,6 +669,7 @@ stack_protector
libc_cv_ssp
libc_cv_with_fp
base_machine
+enable_float128
have_tunables
build_pt_chown
build_nscd
@@ -730,6 +731,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -759,6 +761,7 @@ with_gd_include
with_gd_lib
with_binutils
with_selinux
+with_clang
with_headers
with_default_link
enable_sanity_checks
@@ -787,6 +790,7 @@ enable_build_nscd
enable_nscd
enable_pt_chown
enable_tunables
+enable_float128
enable_mathvec
with_cpu
'
@@ -840,6 +844,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}'
@@ -1092,6 +1097,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=* \
@@ -1229,7 +1243,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.
@@ -1382,6 +1396,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]
@@ -1459,6 +1474,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]
@@ -1472,6 +1488,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
@@ -3312,6 +3329,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 :
@@ -3721,6 +3748,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.
@@ -5030,8 +5070,10 @@ main ()
{
#if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+#if !defined __clang__
#error insufficient compiler
#endif
+#endif
;
return 0;
}
@@ -6170,7 +6212,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=$?
@@ -6251,7 +6293,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=$?
@@ -6771,7 +6813,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 ca1282a6b3..34b905be98 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],
@@ -435,6 +442,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.
@@ -958,7 +975,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__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+#if !defined __clang__
#error insufficient compiler
+#endif
#endif],
[libc_cv_compiler_ok=yes],
[libc_cv_compiler_ok=no])])
@@ -1502,7 +1521,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
@@ -1545,7 +1564,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
@@ -1811,7 +1830,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