2013-06-30 21:29:11 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
2013-09-02 18:06:33 +02:00
|
|
|
# glibc/eglibc
|
2013-06-30 21:29:11 +02:00
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2014-06-02 05:42:04 +02:00
|
|
|
GLIBC_VERSION = $(call qstrip,$(BR2_GLIBC_VERSION_STRING))
|
|
|
|
|
2013-09-02 18:06:33 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_EGLIBC),y)
|
2014-07-31 10:46:58 +02:00
|
|
|
GLIBC_SITE = http://downloads.yoctoproject.org/releases/eglibc
|
2013-09-02 18:06:33 +02:00
|
|
|
GLIBC_SOURCE = eglibc-$(GLIBC_VERSION).tar.bz2
|
|
|
|
GLIBC_SRC_SUBDIR = libc
|
|
|
|
else
|
|
|
|
GLIBC_SITE = $(BR2_GNU_MIRROR)/libc
|
|
|
|
GLIBC_SOURCE = glibc-$(GLIBC_VERSION).tar.xz
|
|
|
|
GLIBC_SRC_SUBDIR = .
|
|
|
|
endif
|
|
|
|
|
|
|
|
GLIBC_LICENSE = GPLv2+ (programs), LGPLv2.1+, BSD-3c, MIT (library)
|
|
|
|
GLIBC_LICENSE_FILES = $(addprefix $(GLIBC_SRC_SUBDIR)/,COPYING COPYING.LIB LICENSES)
|
2013-06-30 21:29:11 +02:00
|
|
|
|
2014-02-14 10:55:04 +01:00
|
|
|
# glibc is part of the toolchain so disable the toolchain dependency
|
|
|
|
GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
|
|
|
|
|
2013-09-02 18:06:33 +02:00
|
|
|
# Before (e)glibc is configured, we must have the first stage
|
2013-06-30 21:29:11 +02:00
|
|
|
# cross-compiler and the kernel headers
|
2013-10-08 20:16:58 +02:00
|
|
|
GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-gawk
|
2013-06-30 21:29:11 +02:00
|
|
|
|
2013-09-02 18:06:33 +02:00
|
|
|
GLIBC_SUBDIR = build
|
2013-06-30 21:29:11 +02:00
|
|
|
|
2013-09-02 18:06:33 +02:00
|
|
|
GLIBC_INSTALL_STAGING = YES
|
2013-06-30 21:29:11 +02:00
|
|
|
|
2014-09-27 21:32:41 +02:00
|
|
|
GLIBC_INSTALL_STAGING_OPTS = install_root=$(STAGING_DIR) install
|
2013-06-30 21:29:11 +02:00
|
|
|
|
2013-07-19 15:06:32 +02:00
|
|
|
# Thumb build is broken, build in ARM mode
|
|
|
|
ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
|
2013-09-02 18:06:33 +02:00
|
|
|
GLIBC_EXTRA_CFLAGS += -marm
|
2013-07-19 15:06:32 +02:00
|
|
|
endif
|
|
|
|
|
2013-09-25 17:00:57 +02:00
|
|
|
# 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
|
|
|
|
|
2015-01-01 11:16:43 +01:00
|
|
|
ifeq ($(BR2_ENABLE_DEBUG),y)
|
|
|
|
GLIBC_EXTRA_CFLAGS += -g
|
|
|
|
endif
|
|
|
|
|
2013-10-08 20:16:59 +02:00
|
|
|
# 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
|
|
|
|
|
2013-06-30 21:29:11 +02:00
|
|
|
# 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.
|
|
|
|
#
|
2013-08-06 12:46:14 +02:00
|
|
|
# Note that as mentionned in
|
2013-09-02 18:06:33 +02:00
|
|
|
# http://patches.openembedded.org/patch/38849/, eglibc/glibc must be
|
|
|
|
# built with -O2, so we pass our own CFLAGS and CXXFLAGS below.
|
|
|
|
define GLIBC_CONFIGURE_CMDS
|
2013-06-30 21:29:11 +02:00
|
|
|
mkdir -p $(@D)/build
|
|
|
|
# Do the configuration
|
|
|
|
(cd $(@D)/build; \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2013-09-02 18:06:33 +02:00
|
|
|
CFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
|
|
|
|
CXXFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" \
|
|
|
|
$(SHELL) $(@D)/$(GLIBC_SRC_SUBDIR)/configure \
|
2013-06-30 21:29:11 +02:00
|
|
|
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 \
|
2013-06-30 21:29:11 +02:00
|
|
|
--target=$(GNU_TARGET_NAME) \
|
|
|
|
--host=$(GNU_TARGET_NAME) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--prefix=/usr \
|
|
|
|
--enable-shared \
|
|
|
|
$(if $(BR2_SOFT_FLOAT),--without-fp,--with-fp) \
|
|
|
|
--with-pkgversion="Buildroot" \
|
|
|
|
--without-cvs \
|
|
|
|
--disable-profile \
|
|
|
|
--without-gd \
|
|
|
|
--enable-obsolete-rpc \
|
|
|
|
--with-headers=$(STAGING_DIR)/usr/include)
|
2013-10-08 20:16:59 +02:00
|
|
|
$(GLIBC_ADD_MISSING_STUB_H)
|
2013-06-30 21:29:11 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# We also override the install to target commands since we only want
|
|
|
|
# to install the libraries, and nothing more.
|
|
|
|
#
|
|
|
|
|
2013-09-02 18:06:33 +02:00
|
|
|
GLIBC_LIBS_LIB = \
|
2013-10-08 20:17:06 +02:00
|
|
|
ld*.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.*
|
2013-06-30 21:29:11 +02:00
|
|
|
|
2013-10-29 21:54:02 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_GDB),y)
|
2013-10-08 20:17:06 +02:00
|
|
|
GLIBC_LIBS_LIB += libthread_db.so.*
|
2013-06-30 21:29:11 +02:00
|
|
|
endif
|
|
|
|
|
2013-09-02 18:06:33 +02:00
|
|
|
define GLIBC_INSTALL_TARGET_CMDS
|
|
|
|
for libs in $(GLIBC_LIBS_LIB); do \
|
2013-06-30 21:29:11 +02:00
|
|
|
$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
|
|
|
|
done
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(autotools-package))
|