[3/3] Disable _TIME_BITS if the compiler defaults to it
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Even though building glibc with 64 bit time_t flags is not supported,
and the usual way is to patch the build system to avoid it; some
systems do enable it by default, and it increases the requirements
to build glibc in such cases (it also does not help newcomers when
trying to build glibc).
The conform namespace and linknamespace tests also do not expect
that flag to be set by default, so disable it as well.
Checked with a build/check for major ABI and some (i386, arm,
mipsel, hppa) with a toolchain that has LFS flags by default.
---
Makeconfig | 3 +++
configure | 30 ++++++++++++++++++++++++++++++
configure.ac | 11 +++++++++++
conform/Makefile | 2 +-
4 files changed, 45 insertions(+), 1 deletion(-)
Comments
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
Same as part 2 but for _TIME_BITS.
LGTM with or without more line wrapping
Reviewed-by: DJ Delorie <dj@redhat.com>
> diff --git a/Makeconfig b/Makeconfig
> +# Filter out 64 bit time_t flags if compiler defines it by default.
> ++cflags += $(no-time-bits-source)
Ok.
> diff --git a/configure.ac b/configure.ac
> +dnl Check if compiler define _TIME_BITS by default
> +AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
> +#ifndef _TIME_BITS
> +# error _TIME_BITS not defined
> +#endif]])],
> + [libc_cv_compiler_default_time_bits=yes],
> + [libc_cv_compiler_default_time_bits=no])
> +AS_IF([test "$libc_cv_compiler_default_time_bits" = yes],
> + [no_time_bits_source="-U_TIME_BITS"])
> +AC_SUBST(no_time_bits_source)
> +LIBC_CONFIG_VAR([no-time-bits-source], [$no_time_bits_source])
If test succeeds, _TIME_BITS is set, so unset it. Ok.
> diff --git a/conform/Makefile b/conform/Makefile
> -conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. $(no-file-offset-bits-source)
> +conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. $(no-file-offset-bits-source) $(no-time-bits-source)
Might consider line wrapping here, but ok with me either way.
@@ -1014,6 +1014,9 @@ endif
# Filter out LFS flags if compiler defines it by default.
+cflags += $(no-file-offset-bits-source)
+# Filter out 64 bit time_t flags if compiler defines it by default.
++cflags += $(no-time-bits-source)
+
# Each sysdeps directory can contain header files that both will be
# used to compile and will be installed. Each can also contain an
# include/ subdirectory, whose header files will be used to compile
@@ -635,6 +635,7 @@ libc_cv_gcc_unwind_find_fde
libc_extra_cppflags
libc_extra_cflags
libc_cv_cxx_thread_local
+no_time_bits_source
no_file_offset_bits_source
fortify_source
no_fortify_source
@@ -7815,6 +7816,35 @@ fi
config_vars="$config_vars
no-file-offset-bits-source = $no_file_offset_bits_source"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+#ifndef _TIME_BITS
+# error _TIME_BITS not defined
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+ libc_cv_compiler_default_time_bits=yes
+else case e in #(
+ e) libc_cv_compiler_default_time_bits=no ;;
+esac
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+if test "$libc_cv_compiler_default_time_bits" = yes
+then :
+ no_time_bits_source="-U_TIME_BITS"
+fi
+
+config_vars="$config_vars
+no-time-bits-source = $no_time_bits_source"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the assembler requires one version per symbol" >&5
printf %s "checking whether the assembler requires one version per symbol... " >&6; }
@@ -1576,6 +1576,17 @@ AS_IF([test "$libc_cv_compiler_default_file_offset_bits" = yes],
AC_SUBST(no_file_offset_bits_source)
LIBC_CONFIG_VAR([no-file-offset-bits-source], [$no_file_offset_bits_source])
+dnl Check if compiler define _TIME_BITS by default
+AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
+#ifndef _TIME_BITS
+# error _TIME_BITS not defined
+#endif]])],
+ [libc_cv_compiler_default_time_bits=yes],
+ [libc_cv_compiler_default_time_bits=no])
+AS_IF([test "$libc_cv_compiler_default_time_bits" = yes],
+ [no_time_bits_source="-U_TIME_BITS"])
+AC_SUBST(no_time_bits_source)
+LIBC_CONFIG_VAR([no-time-bits-source], [$no_time_bits_source])
dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
dnl to one symbol (PR 23840).
@@ -372,7 +372,7 @@ test-xfail-UNIX98/ndbm.h/conform = yes
test-xfail-XOPEN2K/ndbm.h/conform = yes
test-xfail-XOPEN2K8/ndbm.h/conform = yes
-conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. $(no-file-offset-bits-source)
+conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I.. $(no-file-offset-bits-source) $(no-time-bits-source)
# conformtest-xfail-conds may be set by a sysdeps Makefile fragment to
# a list of conditions that are considered to be true when encountered
# in xfail[cond]- lines in test expectations.