From 275b8f9017c5e640beef4a4b70a694f5758188dc Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sun, 29 Mar 2015 14:07:35 -0700 Subject: [PATCH 1/2] glibc: sync with upstream, add 2.20 ebuild --- .../coreos-overlay/sys-libs/glibc/Manifest | 2 + .../glibc/files/eblits/src_configure.eblit | 23 +-- .../sys-libs/glibc/glibc-2.20-r2.ebuild | 188 ++++++++++++++++++ 3 files changed, 201 insertions(+), 12 deletions(-) create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest index 37b8cb7be7..b177c7dd04 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest @@ -3,3 +3,5 @@ DIST glibc-2.17-patches-8.tar.bz2 83707 SHA256 477946a4915dcd0cc0565ff8532d219e2 DIST glibc-2.17.tar.xz 10981956 SHA256 6914e337401e0e0ade23694e1b2c52a5f09e4eda3270c67e7c3ba93a89b5b23e SHA512 384e54037daaa344a26ce58242acc3f9a249d0765088d18a540a305745afa33ae6dec4024adae958eacd7100be9c713d117260ace8340f6d8c8396dbde4868d2 WHIRLPOOL 9b98c1c298aeff607aaa554341c300c15491b7314f127524fc5c048c67c5059daaf706e6cf206bb69213d5307e37bed87137ab46f504d8072bb778310081fc23 DIST glibc-2.19-patches-3.tar.bz2 80664 SHA256 6fb03292e224199e0dd9ba7ee83aca723e1560f26831e85cdc6302b187c6de3c SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0 WHIRLPOOL 6f28a2d0dff42e8ad0e77859938e3093753f77f78821375777eebb2db5568bf1c56e8b8208f02280f23acb2dd26dc8a313fedd5b2c10755f1659e6d324a1dbc3 DIST glibc-2.19.tar.xz 12083312 SHA256 2d3997f588401ea095a0b27227b1d50cdfdd416236f6567b564549d3b46ea2a2 SHA512 9e021fcb3afbb9ace2a0e37fded231a62de861bd766e29d47163a03182e37add718b7acc3963d1c525f9556773e842297725715acde48dcfbaab6e756af1a23d WHIRLPOOL 9581a3a23ebdd56bc559b56b95b7bcd21ca039546ec19c6c0e4e0738597542164fdb21ab1d1f36d5e73a205fb51f0974c7d497972615bce69ae002298f6475b6 +DIST glibc-2.20-patches-4.tar.bz2 55075 SHA256 f0d5d1d4a2e9ba11a96b79c089525122fbfdf13004f219ddfcf7046896696529 SHA512 36881a85f9e3f75b7e6bd688aedd7075adc832eb6e795a435eb9f74aab7f4160c95ea8be209a786b4bb4d0785a538a2ca41375c68ca0592bebfcb6b134cdbceb WHIRLPOOL b995733f82146bb5040e2f02afd33cf96c2e7c8efe7edec70d2bc724921aaf47b992e033b2fe0512e33420e1ca2af5b7203d618bf5aa2ebeab87d1350d850364 +DIST glibc-2.20.tar.xz 12283992 SHA256 f84b6d42aecc288d593c397b0a3d02260a33ee686bce0c634eb9b32798f36ba5 SHA512 7a8eea8b71d3ccba766c3f304cab61055446d451ef063309476b26dc40d880562dc33b1b68fbedeedb4b55b84c26415b9202311aaa71ef8c141b6849a814d2fa WHIRLPOOL 042f74d75c62a655ae35348c9cd0bed0845ab199e37a76635eb74c04ed927b5eca77723c38d2dc46f12fca62c1004001887b43946a914b079ad22f6a9cc8daaa diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit index 5a85488dfa..1aa001c57f 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit @@ -1,6 +1,6 @@ -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_configure.eblit,v 1.3 2014/12/31 08:20:02 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_configure.eblit,v 1.6 2015/03/17 00:06:40 vapier Exp $ dump_toolchain_settings() { echo @@ -8,23 +8,20 @@ dump_toolchain_settings() { einfo "$*" local v - for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC {AS,C,CPP,CXX,LD}FLAGS ; do + for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC LD {AS,C,CPP,CXX,LD}FLAGS ; do einfo " $(printf '%15s' ${v}:) ${!v}" done - export CC=$(tc-getCC ${CTARGET}) - # Glibc does not work with gold (for various reasons) #269274. - if $(tc-getLD ${CTARGET}) --version | grep -q 'GNU gold' ; then - local d="${T}/bfd-linker" - mkdir -p "${d}" - ln -sf $(which ${CTARGET}-ld.bfd) "${d}"/ld - CC+=" -B${d}" - fi + # The glibc configure script doesn't properly use LDFLAGS all the time. + export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}" einfo " $(printf '%15s' 'Manual CC:') ${CC}" echo } glibc_do_configure() { + # Glibc does not work with gold (for various reasons) #269274. + tc-ld-disable-gold + dump_toolchain_settings "Configuring glibc for $1" local myconf=() @@ -101,6 +98,7 @@ glibc_do_configure() { myconf+=( --without-cvs + --disable-werror --enable-bind-now --build=${CBUILD_OPT:-${CBUILD}} --host=${CTARGET_OPT:-${CTARGET}} @@ -208,11 +206,12 @@ toolchain-glibc_headers_configure() { export ${v} done - local ports="" myconf=() + local myconf=() myconf+=( --disable-sanity-checks --enable-hacker-mode --without-cvs + --disable-werror --enable-bind-now --build=${CBUILD_OPT:-${CBUILD}} --host=${CTARGET_OPT:-${CTARGET}} diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild new file mode 100644 index 0000000000..7d13bc060c --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild @@ -0,0 +1,188 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.20-r2.ebuild,v 1.2 2015/03/22 20:38:54 zlogene Exp $ + +EAPI="4" + +inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing + +DESCRIPTION="GNU libc6 (also called glibc2) C library" +HOMEPAGE="http://www.gnu.org/software/libc/libc.html" + +LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" +KEYWORDS="~alpha amd64 ~arm ~arm64 -hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +RESTRICT="strip" # strip ourself #46186 +EMULTILIB_PKG="true" + +# Configuration variables +RELEASE_VER="" +case ${PV} in +9999*) + EGIT_REPO_URIS="git://sourceware.org/git/glibc.git" + EGIT_SOURCEDIRS="${S}" + inherit git-2 + ;; +*) + RELEASE_VER=${PV} + ;; +esac +GCC_BOOTSTRAP_VER="4.7.3-r1" +PATCH_VER="4" # Gentoo patchset +: ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires + +IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only" + +# Here's how the cross-compile logic breaks down ... +# CTARGET - machine that will target the binaries +# CHOST - machine that will host the binaries +# CBUILD - machine that will build the binaries +# If CTARGET != CHOST, it means you want a libc for cross-compiling. +# If CHOST != CBUILD, it means you want to cross-compile the libc. +# CBUILD = CHOST = CTARGET - native build/install +# CBUILD != (CHOST = CTARGET) - cross-compile a native build +# (CBUILD = CHOST) != CTARGET - libc for cross-compiler +# CBUILD != CHOST != CTARGET - cross-compile a libc for a cross-compiler +# For install paths: +# CHOST = CTARGET - install into / +# CHOST != CTARGET - install into /usr/CTARGET/ + +export CBUILD=${CBUILD:-${CHOST}} +export CTARGET=${CTARGET:-${CHOST}} +if [[ ${CTARGET} == ${CHOST} ]] ; then + if [[ ${CATEGORY} == cross-* ]] ; then + export CTARGET=${CATEGORY#cross-} + fi +fi + +is_crosscompile() { + [[ ${CHOST} != ${CTARGET} ]] +} + +# Why SLOT 2.2 you ask yourself while sippin your tea ? +# Everyone knows 2.2 > 0, duh. +SLOT="2.2" + +# General: We need a new-enough binutils/gcc to match upstream baseline. +# arch: we need to make sure our binutils/gcc supports TLS. +DEPEND=">=app-misc/pax-utils-0.1.10 + ! [version] +eblit-include() { + local skipable=false + [[ $1 == "--skip" ]] && skipable=true && shift + [[ $1 == pkg_* ]] && skipable=true + + local e v func=$1 ver=$2 + [[ -z ${func} ]] && die "Usage: eblit-include [version]" + for v in ${ver:+-}${ver} -${PVR} -${PV} "" ; do + e="${FILESDIR}/eblits/${func}${v}.eblit" + if [[ -e ${e} ]] ; then + source "${e}" + return 0 + fi + done + ${skipable} && return 0 + die "Could not locate requested eblit '${func}' in ${FILESDIR}/eblits/" +} + +# eblit-run-maybe +# run the specified function if it is defined +eblit-run-maybe() { + [[ $(type -t "$@") == "function" ]] && "$@" +} + +# eblit-run [version] +# aka: src_unpack() { eblit-run src_unpack ; } +eblit-run() { + eblit-include --skip common "${*:2}" + eblit-include "$@" + eblit-run-maybe eblit-$1-pre + eblit-${PN}-$1 + eblit-run-maybe eblit-$1-post +} + +src_unpack() { eblit-run src_unpack ; } +src_prepare() { eblit-run src_prepare ; } +src_configure() { eblit-run src_configure ; } +src_compile() { eblit-run src_compile ; } +src_test() { eblit-run src_test ; } +src_install() { eblit-run src_install ; } + +# FILESDIR might not be available during binpkg install +for x in setup {pre,post}inst ; do + e="${FILESDIR}/eblits/pkg_${x}.eblit" + if [[ -e ${e} ]] ; then + . "${e}" + eval "pkg_${x}() { eblit-run pkg_${x} ; }" + fi +done + +eblit-src_unpack-pre() { + [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 +} + +eblit-src_prepare-post() { + cd "${S}" + + if use hardened ; then + einfo "Patching to get working PIE binaries on PIE (hardened) platforms" + gcc-specs-pie && epatch "${FILESDIR}"/2.17/glibc-2.17-hardened-pie.patch + epatch "${FILESDIR}"/2.20/glibc-2.20-hardened-inittls-nosysenter.patch + + # We don't enable these for non-hardened as the output is very terse -- + # it only states that a crash happened. The default upstream behavior + # includes backtraces and symbols. + einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler" + cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die + cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-chk_fail.c debug/chk_fail.c || die + + if use debug ; then + # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested. + sed -i \ + -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ + -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ + debug/Makefile || die + fi + + # Build various bits with ssp-all + sed -i \ + -e 's:-fstack-protector$:-fstack-protector-all:' \ + */Makefile || die + fi +} From 51478cf0d3cc6456d9131ffb3c086326fdf65bb3 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sun, 29 Mar 2015 14:10:35 -0700 Subject: [PATCH 2/2] glibc: apply CoreOS tweaks to 2.20 --- .../coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild index 7d13bc060c..861b8471a5 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.20-r2.ebuild @@ -158,6 +158,9 @@ eblit-src_unpack-pre() { } eblit-src_prepare-post() { + cd "${WORKDIR}" + epatch "${FILESDIR}"/locale-default-en_US.patch + cd "${S}" if use hardened ; then @@ -186,3 +189,10 @@ eblit-src_prepare-post() { */Makefile || die fi } + +# CoreOS tweaks: +# - drop host.conf and gai.conf +# - nsswitch.conf and rpc are provided by baselayout +eblit-src_install-post() { + rm -f "${D}"/etc/{gai.conf,host.conf,nsswitch.conf,rpc} || die +}