kumquat-buildroot/package/glibc/glibc.mk

155 lines
5.2 KiB
Makefile
Raw Normal View History

################################################################################
#
# glibc
#
################################################################################
ifeq ($(BR2_arc),y)
GLIBC_VERSION = arc-2017.09-eng010
GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VERSION))
GLIBC_SOURCE = glibc-$(GLIBC_VERSION).tar.gz
else
package/glibc: bump to 2.26 Drop upstream patch: 0001-sh-Fix-building-with-gcc5-6.patch https://sourceware.org/git/?p=glibc.git;a=commit;h=d40dbe722f004f999b589de776f7e57e564dda01 0002-CVE-2017-1000366-Ignore-LD_LIBRARY_PATH-for-AT_SECUR.patch https://sourceware.org/git/?p=glibc.git;a=commit;h=f6110a8fee2ca36f8e2d2abecf3cba9fa7b8ea7d 0003-ld.so-Reject-overly-long-LD_PRELOAD-path-elements.patch https://sourceware.org/git/?p=glibc.git;a=commit;h=6d0ba622891bed9d8394eef1935add53003b12e8 0004-ld.so-Reject-overly-long-LD_AUDIT-path-elements.patch https://sourceware.org/git/?p=glibc.git;a=commit;h=81b82fb966ffbd94353f793ad17116c6088dedd9 0005-fix-binutils-2-29-build.patch https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff_plain;h=388b4f1a02f3a801965028bbfcd48d905638b797 0006-i686-Add-missing-IS_IN-libc-guards-to-vectorized-strcspn.patch https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff_plain;h=69052a3a95da37169a08f9e59b2cc1808312753c 0006-sh4-trap.patch https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff_plain;h=db3d848e154b00071f4a5e729d5884efad410109 But 2.26 version introduced quite a few regressions on x86, x86_64 and powerpc64le when float128 support was added. All these issues are now fixed in the glibc 2.26 stable branch. Backport patches from glibc 2.26 stable branch related to bug 21930. Take all patches listed in this bug report in order to have all fix for this issue [1] [2]. Fixes gnuradio build: [...]/sysroot/usr/include/boost/functional/hash/detail/hash_float.hpp: In function ‘std::size_t boost::hash_detail::float_hash_value(T)’: [...]/sysroot/usr/include/boost/functional/hash/detail/hash_float.hpp:210:21: error: expected primary-expression before ‘float’ switch (fpclassify(v)) ^ [...]/sysroot/usr/include/boost/functional/hash/detail/hash_float.hpp:210:21: error: expected primary-expression before ‘long’ switch (fpclassify(v)) ^ [...]/sysroot/usr/include/boost/functional/hash/detail/hash_float.hpp:210:21: error: found ‘:’ in nested-name-specifier, expected ‘::’ switch (fpclassify(v)) ^ [...]/sysroot/usr/include/boost/functional/hash/detail/hash_float.hpp:210:21: error: ‘_Float128’ is not a class or namespace switch (fpclassify(v)) ^ [...]/sysroot/usr/include/boost/functional/hash/detail/hash_float.hpp:210:21: error: ‘_Generic’ was not declared in this scope switch (fpclassify(v)) ^ Also backport fix for glibc bug 22146. Without this patch some C++ applications (jsoncpp, mesa3d and kodi) fail to build due to an issue while building the toolchain. A test in the libstdc++ configure script fail when -Os and float128 are used. See the bug report for details [3]. [1] https://sourceware.org/ml/libc-alpha/2017-08/msg00586.html [2] https://sourceware.org/bugzilla/show_bug.cgi?id=21930 [3] https://sourceware.org/bugzilla/show_bug.cgi?id=22146 Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Bernd Kuhls <bernd.kuhls@t-online.de> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2017-09-23 23:24:06 +02:00
GLIBC_VERSION = 2.26
GLIBC_SITE = $(BR2_GNU_MIRROR)/libc
GLIBC_SOURCE = glibc-$(GLIBC_VERSION).tar.xz
endif
GLIBC_SRC_SUBDIR = .
GLIBC_LICENSE = GPL-2.0+ (programs), LGPL-2.1+, BSD-3-Clause, MIT (library)
GLIBC_LICENSE_FILES = $(addprefix $(GLIBC_SRC_SUBDIR)/,COPYING COPYING.LIB LICENSES)
# glibc is part of the toolchain so disable the toolchain dependency
GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
# Before glibc is configured, we must have the first stage
# cross-compiler and the kernel headers
GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-gawk
GLIBC_SUBDIR = build
GLIBC_INSTALL_STAGING = YES
GLIBC_INSTALL_STAGING_OPTS = install_root=$(STAGING_DIR) install
# Thumb build is broken, build in ARM mode
ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
GLIBC_EXTRA_CFLAGS += -marm
endif
# MIPS64 defaults to n32 so pass the correct -mabi if
# we are using a different ABI. OABI32 is also used
# in MIPS so we pass -mabi=32 in this case as well
# even though it's not strictly necessary.
ifeq ($(BR2_MIPS_NABI64),y)
GLIBC_EXTRA_CFLAGS += -mabi=64
else ifeq ($(BR2_MIPS_OABI32),y)
GLIBC_EXTRA_CFLAGS += -mabi=32
endif
ifeq ($(BR2_ENABLE_DEBUG),y)
GLIBC_EXTRA_CFLAGS += -g
endif
# The stubs.h header is not installed by install-headers, but is
# needed for the gcc build. An empty stubs.h will work, as explained
# in http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html. The same trick
# is used by Crosstool-NG.
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_GLIBC),y)
define GLIBC_ADD_MISSING_STUB_H
mkdir -p $(STAGING_DIR)/usr/include/gnu
touch $(STAGING_DIR)/usr/include/gnu/stubs.h
endef
endif
# Even though we use the autotools-package infrastructure, we have to
# override the default configure commands for several reasons:
#
# 1. We have to build out-of-tree, but we can't use the same
# 'symbolic link to configure' used with the gcc packages.
#
# 2. We have to execute the configure script with bash and not sh.
#
# Note that as mentionned in
# http://patches.openembedded.org/patch/38849/, glibc must be
# built with -O2, so we pass our own CFLAGS and CXXFLAGS below.
define GLIBC_CONFIGURE_CMDS
mkdir -p $(@D)/build
# Do the configuration
(cd $(@D)/build; \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
CXXFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" \
$(SHELL) $(@D)/$(GLIBC_SRC_SUBDIR)/configure \
ac_cv_path_BASH_SHELL=/bin/bash \
libc_cv_forced_unwind=yes \
toolchain: switch to a two stage gcc build Currently, the internal toolchain backend does a three stage gcc build, with the following sequence of builds: - build gcc-initial - configure libc, install headers and start files - build gcc-intermediate - build libc - build gcc-final However, it turns out that this is not necessary, and only a two stage gcc build is needed. At some point, it was believed that a three stage gcc build was needed for NPTL based toolchains with old gcc versions, but even a gcc 4.4 build with a NPTL toolchain works fine. So, this commit switches the internal toolchain backend to use a two stage gcc build: just gcc-initial and gcc-final. It does so by: * Removing the custom dependency of all C libraries build step to host-gcc-intermediate. Now the C library packages simply have to depend on host-gcc-initial as a normal dependency (which they already do), and that's it. * Build and install both gcc *and* libgcc in host-gcc-initial. Previously, only gcc was built and installed in host-gcc-initial. libgcc was only done in host-gcc-intermediate, but now we need libgcc to build the C library. * Pass appropriate environment variables to get SSP (Stack Smashing Protection) to work properly: - Tell the compiler that the libc will provide the SSP support, by passing gcc_cv_libc_provides_ssp=yes. In Buildroot, we have chosen to use the SSP support from the C library instead of the SSP support from the compiler (this is not changed by this patch series, it was already the case). - Tell glibc to *not* build its own programs with SSP support. The issue is that if glibc detects that the compiler supports -fstack-protector, then glibc uses it to build a few things with SSP. However, at this point, the support is not complete (we only have host-gcc-initial, and the C library is not completely built). So, we pass libc_cv_ssp=no to tell the C library to not use SSP support itself. Note that this is not a big loss: only a few parts of the C library were built with -fstack-protector, not the entire library. * A special change is needed for ARC, because its libgcc depends on the C library, which breaks building libgcc in host-gcc-initial. This looks like a bug in the ARC compiler, as it does not obey the inhibit_libc variable which tells the compiler build process to *not* enable things that depend on the C library. So for now, in host-gcc-initial, we simply disable the build of libgmon.a for ARC. It's going to be built as part of host-gcc-final, so the final compiler will have gmon support. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-09-14 11:49:59 +02:00
libc_cv_ssp=no \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--prefix=/usr \
--enable-shared \
$(if $(BR2_SOFT_FLOAT),--without-fp,--with-fp) \
$(if $(BR2_x86_64),--enable-lock-elision) \
--with-pkgversion="Buildroot" \
--without-cvs \
--disable-profile \
--without-gd \
--enable-obsolete-rpc \
--enable-kernel=$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)) \
--with-headers=$(STAGING_DIR)/usr/include)
$(GLIBC_ADD_MISSING_STUB_H)
endef
#
# We also override the install to target commands since we only want
# to install the libraries, and nothing more.
#
GLIBC_LIBS_LIB = \
ld*.so.* libanl.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* \
libm.so.* libnsl.so.* libpthread.so.* libresolv.so.* librt.so.* \
libutil.so.* libnss_files.so.* libnss_dns.so.* libmvec.so.*
ifeq ($(BR2_PACKAGE_GDB),y)
GLIBC_LIBS_LIB += libthread_db.so.*
endif
define GLIBC_INSTALL_TARGET_CMDS
for libpattern in $(GLIBC_LIBS_LIB); do \
$(call copy_toolchain_lib_root,$$libpattern) ; \
done
endef
# MIPS R6 requires to have NaN2008 support which is currently not
# supported by the Linux kernel. In order to prevent building the
# glibc against kernels not having NaN2008 support on platforms that
# requires it, glibc currently checks for an (inexisting) 10.0.0
# kernel headers version.
#
# Since in practice the kernel support for NaN2008 is not really
# required for things to work properly, we adjust the glibc check to
# make it believe that NaN2008 support was added in the kernel
# starting from version 4.0.0.
#
# In general the compatibility issues introduced by mis-matched NaN
# encodings will not cause a problem as signalling NaNs are rarely used
# in average code. For MIPS R6 there isn't actually any compatibility
# issue as the hardware is always NaN2008 and software is always
# NaN2008. The problem only comes from when older MIPS code is linked in
# via a DSO and multiple NaN encodings are introduced. Since Buildroot
# is intended to have all code built from source then this scenario is
# highly unlikely. The failure mode, if it ever occurs, would be either
# that a signalling NaN fails to raise an invalid operation exception or
# (more likely) an ordinary NaN raises an invalid operation exception.
ifeq ($(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
define GLIBC_FIX_MIPS_R6
$(SED) 's#10.0.0#4.0.0#' \
$(@D)/sysdeps/unix/sysv/linux/mips/configure \
$(@D)/sysdeps/unix/sysv/linux/mips/configure.ac
endef
GLIBC_POST_EXTRACT_HOOKS += GLIBC_FIX_MIPS_R6
endif
$(eval $(autotools-package))