mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-29 17:41:05 +02:00
Merge pull request #64 from marineam/toolchain
clean(toolchain): Remove overlay toolchain, moved to portage-stable
This commit is contained in:
commit
3b2c247612
@ -1,2 +0,0 @@
|
||||
DIST binutils-2.23.1-patches-1.0.tar.xz 13396 SHA256 6d2ac4f83588e57968ce0e8e4450effb5aa79d46b9025ed2779cf91c8f99ec01 SHA512 f8a708798d32f81aceb3291411f7ef461a4f5b91ff204519799f3051789b1cbcac79bc282819227cf8dee875f47b727c51aba6f3a2ac73f53b132430c0fe9bdd WHIRLPOOL fbbcf9040047d5411ef002dd4e8079b6555b4ef2c079534f19ea8d105b2d62a8fce98eaf9b217d733414d0ddde1ab64b55d0c16bd142375a28187febde0c76eb
|
||||
DIST binutils-2.23.1.tar.bz2 21455321 SHA256 2ab2e5b03e086d12c6295f831adad46b3e1410a3a234933a2e8fac66cb2e7a19 SHA512 effecc9e6ef943055815a83dea546f2fe5b5d4483dadeda5753aae239bd7095d4696239240613a051d18011ed2521ae75c48292f970ba82b02e97bc72b0fa51f WHIRLPOOL 48f99ba30f0f7085cd7d889b727ba615be3aceb9da6a836d676eecee65c16e36257110d84bfe82a739064741b6b5279f97e43c93a08ca90896a10474b4ea65e8
|
@ -1,308 +0,0 @@
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
CROS_WORKON_COMMIT="9c1580ea72a5a3b15d90a9baf82c2f7707b793c4"
|
||||
CROS_WORKON_TREE="2a7750a0cddd72df341d61250ade80d6270afbd7"
|
||||
CROS_WORKON_PROJECT=chromiumos/third_party/binutils
|
||||
|
||||
inherit eutils libtool flag-o-matic gnuconfig multilib versionator cros-workon
|
||||
|
||||
KEYWORDS="amd64 arm x86"
|
||||
|
||||
BVER=${PV}
|
||||
|
||||
# Version names
|
||||
if [[ "${PV}" == "9999" ]] ; then
|
||||
BINUTILS_VERSION="binutils-2.22"
|
||||
else
|
||||
BINUTILS_VERSION="${P}"
|
||||
fi
|
||||
|
||||
BINUTILS_PKG_VERSION="${BINUTILS_VERSION}_cos_gg"
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
if [[ ${CTARGET} == ${CHOST} ]] ; then
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
|
||||
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
|
||||
|
||||
DESCRIPTION="Tools necessary to build programs"
|
||||
HOMEPAGE="http://sources.redhat.com/binutils/"
|
||||
LICENSE="|| ( GPL-3 LGPL-3 )"
|
||||
IUSE="hardened mounted_binutils multislot multitarget nls test vanilla"
|
||||
if use multislot ; then
|
||||
SLOT="${CTARGET}-${BVER}"
|
||||
elif is_cross ; then
|
||||
SLOT="${CTARGET}"
|
||||
else
|
||||
SLOT="0"
|
||||
fi
|
||||
|
||||
RDEPEND=">=sys-devel/binutils-config-1.9"
|
||||
DEPEND="${RDEPEND}
|
||||
test? ( dev-util/dejagnu )
|
||||
nls? ( sys-devel/gettext )
|
||||
sys-devel/flex"
|
||||
|
||||
S_BINUTILS="${WORKDIR}/${BINUTILS_VERSION}"
|
||||
|
||||
RESTRICT="fetch strip"
|
||||
|
||||
MY_BUILDDIR_BINUTILS="${WORKDIR}/build"
|
||||
|
||||
GITDIR=${WORKDIR}/gitdir
|
||||
|
||||
LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
|
||||
INCPATH=${LIBPATH}/include
|
||||
DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER}
|
||||
if is_cross ; then
|
||||
BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER}
|
||||
else
|
||||
BINPATH=/usr/${CTARGET}/binutils-bin/${BVER}
|
||||
fi
|
||||
|
||||
src_unpack() {
|
||||
if use mounted_binutils ; then
|
||||
BINUTILS_DIR="/usr/local/toolchain_root/binutils"
|
||||
if [[ ! -d ${BINUTILS_DIR} ]] ; then
|
||||
die "binutils dirs not mounted at: ${BINUTILS_DIR}"
|
||||
fi
|
||||
else
|
||||
cros-workon_src_unpack
|
||||
mv "${S}" "${GITDIR}"
|
||||
BINUTILS_DIR="${GITDIR}"
|
||||
if [ -d "${GITDIR}/.git" ]; then
|
||||
CL=$(cd "${BINUTILS_DIR}"; git log --pretty=format:%s -n1 | egrep -o '[0-9]+')
|
||||
fi
|
||||
fi
|
||||
if [[ ! -z ${CL} ]] ; then
|
||||
BINUTILS_PKG_VERSION="${BINUTILS_PKG_VERSION}_${CL}"
|
||||
fi
|
||||
ln -s ${BINUTILS_DIR} ${S_BINUTILS}
|
||||
|
||||
mkdir -p "${MY_BUILDDIR_BINUTILS}"
|
||||
}
|
||||
|
||||
|
||||
src_compile() {
|
||||
# keep things sane
|
||||
strip-flags
|
||||
|
||||
local x
|
||||
echo
|
||||
for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
|
||||
einfo "$(printf '%10s' ${x}:) ${!x}"
|
||||
done
|
||||
echo
|
||||
|
||||
cd "${MY_BUILDDIR_BINUTILS}"
|
||||
local myconf=""
|
||||
is_cross && myconf="${myconf} --with-sysroot=/usr/${CTARGET}"
|
||||
myconf="--prefix=/usr \
|
||||
--host=${CHOST} \
|
||||
--target=${CTARGET} \
|
||||
--datadir=${DATAPATH} \
|
||||
--infodir=${DATAPATH}/info \
|
||||
--mandir=${DATAPATH}/man \
|
||||
--bindir=${BINPATH} \
|
||||
--libdir=${LIBPATH} \
|
||||
--libexecdir=${LIBPATH} \
|
||||
--includedir=${INCPATH} \
|
||||
--enable-64-bit-bfd \
|
||||
--enable-gold \
|
||||
--enable-shared \
|
||||
--disable-werror \
|
||||
--enable-secureplt \
|
||||
--enable-plugins \
|
||||
--without-included-gettext \
|
||||
--build=${CBUILD} \
|
||||
--with-bugurl=http://code.google.com/p/chromium-os/issues/entry \
|
||||
${myconf} ${EXTRA_ECONF}"
|
||||
|
||||
binutils_conf="${myconf} --with-pkgversion=${BINUTILS_PKG_VERSION}"
|
||||
|
||||
echo ./configure ${binutils_conf}
|
||||
"${S_BINUTILS}"/configure ${binutils_conf} || die "configure failed"
|
||||
|
||||
emake all || die "emake failed"
|
||||
|
||||
# only build info pages if we user wants them, and if
|
||||
# we have makeinfo (may not exist when we bootstrap)
|
||||
if type -p makeinfo > /dev/null ; then
|
||||
emake info || die "make info failed"
|
||||
fi
|
||||
# we nuke the manpages when we're left with junk
|
||||
# (like when we bootstrap, no perl -> no manpages)
|
||||
find . -name '*.1' -a -size 0 | xargs rm -f
|
||||
}
|
||||
|
||||
src_test() {
|
||||
cd "${MY_BUILDDIR_BINUTILS}"
|
||||
make check || die "check failed :("
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local x d
|
||||
|
||||
cd "${MY_BUILDDIR_BINUTILS}"
|
||||
emake DESTDIR="${D}" tooldir="${LIBPATH}" install || die
|
||||
rm -rf "${D}"/${LIBPATH}/bin
|
||||
|
||||
# Newer versions of binutils get fancy with ${LIBPATH} #171905
|
||||
cd "${D}"/${LIBPATH}
|
||||
for d in ../* ; do
|
||||
[[ ${d} == ../${BVER} ]] && continue
|
||||
mv ${d}/* . || die
|
||||
rmdir ${d} || die
|
||||
done
|
||||
|
||||
# Now we collect everything intp the proper SLOT-ed dirs
|
||||
# When something is built to cross-compile, it installs into
|
||||
# /usr/$CHOST/ by default ... we have to 'fix' that :)
|
||||
if is_cross ; then
|
||||
cd "${D}"/${BINPATH}
|
||||
for x in * ; do
|
||||
mv ${x} ${x/${CTARGET}-}
|
||||
done
|
||||
|
||||
if [[ -d ${D}/usr/${CHOST}/${CTARGET} ]] ; then
|
||||
mv "${D}"/usr/${CHOST}/${CTARGET}/include "${D}"/${INCPATH}
|
||||
mv "${D}"/usr/${CHOST}/${CTARGET}/lib/* "${D}"/${LIBPATH}/
|
||||
rm -r "${D}"/usr/${CHOST}/{include,lib}
|
||||
fi
|
||||
fi
|
||||
insinto ${INCPATH}
|
||||
doins "${S_BINUTILS}/include/libiberty.h"
|
||||
if [[ -d ${D}/${LIBPATH}/lib ]] ; then
|
||||
mv "${D}"/${LIBPATH}/lib/* "${D}"/${LIBPATH}/
|
||||
rm -r "${D}"/${LIBPATH}/lib
|
||||
fi
|
||||
|
||||
# Now, some binutils are tricky and actually provide
|
||||
# for multiple TARGETS. Really, we're talking just
|
||||
# 32bit/64bit support (like mips/ppc/sparc). Here
|
||||
# we want to tell binutils-config that it's cool if
|
||||
# it generates multiple sets of binutil symlinks.
|
||||
# e.g. sparc gets {sparc,sparc64}-unknown-linux-gnu
|
||||
local targ=${CTARGET/-*} src="" dst=""
|
||||
local FAKE_TARGETS=${CTARGET}
|
||||
case ${targ} in
|
||||
mips*) src="mips" dst="mips64";;
|
||||
powerpc*) src="powerpc" dst="powerpc64";;
|
||||
s390*) src="s390" dst="s390x";;
|
||||
sparc*) src="sparc" dst="sparc64";;
|
||||
esac
|
||||
case ${targ} in
|
||||
mips64*|powerpc64*|s390x*|sparc64*) targ=${src} src=${dst} dst=${targ};;
|
||||
esac
|
||||
[[ -n ${src}${dst} ]] && FAKE_TARGETS="${FAKE_TARGETS} ${CTARGET/${src}/${dst}}"
|
||||
|
||||
# Generate an env.d entry for this binutils
|
||||
insinto /etc/env.d/binutils
|
||||
cat <<-EOF > "${T}"/env.d
|
||||
TARGET="${CTARGET}"
|
||||
VER="${BVER}"
|
||||
LIBPATH="${LIBPATH}"
|
||||
FAKE_TARGETS="${FAKE_TARGETS}"
|
||||
EOF
|
||||
newins "${T}"/env.d ${CTARGET}-${BVER}
|
||||
|
||||
# Handle documentation
|
||||
if ! is_cross ; then
|
||||
cd "${S_BINUTILS}"
|
||||
dodoc README
|
||||
docinto bfd
|
||||
dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
|
||||
docinto binutils
|
||||
dodoc binutils/ChangeLog binutils/NEWS binutils/README
|
||||
docinto gas
|
||||
dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
|
||||
docinto gprof
|
||||
dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
|
||||
docinto ld
|
||||
dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
|
||||
docinto libiberty
|
||||
dodoc libiberty/ChangeLog* libiberty/README
|
||||
docinto opcodes
|
||||
dodoc opcodes/ChangeLog*
|
||||
fi
|
||||
# Remove shared info pages
|
||||
rm -f "${D}"/${DATAPATH}/info/{dir,configure.info,standards.info}
|
||||
# Trim all empty dirs
|
||||
find "${D}" -type d | xargs rmdir >& /dev/null
|
||||
|
||||
if use hardened ; then
|
||||
LDWRAPPER=ldwrapper.hardened
|
||||
else
|
||||
LDWRAPPER=ldwrapper
|
||||
fi
|
||||
|
||||
mv "${D}/${BINPATH}/ld.bfd" "${D}/${BINPATH}/ld.bfd.real" || die
|
||||
exeinto "${BINPATH}"
|
||||
newexe "${FILESDIR}/${LDWRAPPER}" "ld.bfd" || die
|
||||
|
||||
mv "${D}/${BINPATH}/ld.gold" "${D}/${BINPATH}/ld.gold.real" || die
|
||||
exeinto "${BINPATH}"
|
||||
newexe "${FILESDIR}/${LDWRAPPER}" "ld.gold" || die
|
||||
|
||||
# Set default to be ld.bfd in regular installation
|
||||
dosym ld.bfd "${BINPATH}/ld"
|
||||
|
||||
# Make a fake installation for gold with gold as the default linker
|
||||
# so we can turn gold on/off with binutils-config
|
||||
LASTDIR=${LIBPATH##/*/}
|
||||
dosym "${LASTDIR}" "${LIBPATH}-gold"
|
||||
LASTDIR=${DATAPATH##/*/}
|
||||
dosym "${LASTDIR}" "${DATAPATH}-gold"
|
||||
|
||||
mkdir "${D}/${BINPATH}-gold"
|
||||
cd "${D}"/${BINPATH}
|
||||
LASTDIR=${BINPATH##/*/}
|
||||
for x in * ; do
|
||||
dosym "../${LASTDIR}/${x}" "${BINPATH}-gold/${x}"
|
||||
done
|
||||
dosym ld.gold "${BINPATH}-gold/ld"
|
||||
|
||||
# Install gold binutils-config configuration file
|
||||
insinto /etc/env.d/binutils
|
||||
cat <<-EOF > "${T}"/env.d
|
||||
TARGET="${CTARGET}"
|
||||
VER="${BVER}-gold"
|
||||
LIBPATH="${LIBPATH}-gold"
|
||||
FAKE_TARGETS="${FAKE_TARGETS}"
|
||||
EOF
|
||||
newins "${T}"/env.d ${CTARGET}-${BVER}-gold
|
||||
|
||||
# Move the locale directory to where it is supposed to be
|
||||
mv "${D}/usr/share/locale" "${D}/${DATAPATH}/"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
binutils-config ${CTARGET}-${BVER}
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
local current_profile=$(binutils-config -c ${CTARGET})
|
||||
|
||||
# If no other versions exist, then uninstall for this
|
||||
# target ... otherwise, switch to the newest version
|
||||
# Note: only do this if this version is unmerged. We
|
||||
# rerun binutils-config if this is a remerge, as
|
||||
# we want the mtimes on the symlinks updated (if
|
||||
# it is the same as the current selected profile)
|
||||
if [[ ! -e ${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
|
||||
local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
|
||||
choice=${choice//$'\n'/ }
|
||||
choice=${choice/* }
|
||||
if [[ -z ${choice} ]] ; then
|
||||
env -i binutils-config -u ${CTARGET}
|
||||
else
|
||||
binutils-config ${choice}
|
||||
fi
|
||||
elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then
|
||||
binutils-config ${CTARGET}-${BVER}
|
||||
fi
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.1.ebuild,v 1.1 2012/11/15 19:43:36 vapier Exp $
|
||||
|
||||
PATCHVER="1.0"
|
||||
ELF2FLT_VER=""
|
||||
inherit toolchain-binutils
|
||||
|
||||
KEYWORDS=""
|
@ -1,306 +0,0 @@
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
CROS_WORKON_PROJECT=chromiumos/third_party/binutils
|
||||
|
||||
inherit eutils libtool flag-o-matic gnuconfig multilib versionator cros-workon
|
||||
|
||||
KEYWORDS="~amd64 ~arm ~x86"
|
||||
|
||||
BVER=${PV}
|
||||
|
||||
# Version names
|
||||
if [[ "${PV}" == "9999" ]] ; then
|
||||
BINUTILS_VERSION="binutils-2.22"
|
||||
else
|
||||
BINUTILS_VERSION="${P}"
|
||||
fi
|
||||
|
||||
BINUTILS_PKG_VERSION="${BINUTILS_VERSION}_cos_gg"
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
if [[ ${CTARGET} == ${CHOST} ]] ; then
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
|
||||
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
|
||||
|
||||
DESCRIPTION="Tools necessary to build programs"
|
||||
HOMEPAGE="http://sources.redhat.com/binutils/"
|
||||
LICENSE="|| ( GPL-3 LGPL-3 )"
|
||||
IUSE="hardened mounted_binutils multislot multitarget nls test vanilla"
|
||||
if use multislot ; then
|
||||
SLOT="${CTARGET}-${BVER}"
|
||||
elif is_cross ; then
|
||||
SLOT="${CTARGET}"
|
||||
else
|
||||
SLOT="0"
|
||||
fi
|
||||
|
||||
RDEPEND=">=sys-devel/binutils-config-1.9"
|
||||
DEPEND="${RDEPEND}
|
||||
test? ( dev-util/dejagnu )
|
||||
nls? ( sys-devel/gettext )
|
||||
sys-devel/flex"
|
||||
|
||||
S_BINUTILS="${WORKDIR}/${BINUTILS_VERSION}"
|
||||
|
||||
RESTRICT="fetch strip"
|
||||
|
||||
MY_BUILDDIR_BINUTILS="${WORKDIR}/build"
|
||||
|
||||
GITDIR=${WORKDIR}/gitdir
|
||||
|
||||
LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
|
||||
INCPATH=${LIBPATH}/include
|
||||
DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER}
|
||||
if is_cross ; then
|
||||
BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER}
|
||||
else
|
||||
BINPATH=/usr/${CTARGET}/binutils-bin/${BVER}
|
||||
fi
|
||||
|
||||
src_unpack() {
|
||||
if use mounted_binutils ; then
|
||||
BINUTILS_DIR="/usr/local/toolchain_root/binutils"
|
||||
if [[ ! -d ${BINUTILS_DIR} ]] ; then
|
||||
die "binutils dirs not mounted at: ${BINUTILS_DIR}"
|
||||
fi
|
||||
else
|
||||
cros-workon_src_unpack
|
||||
mv "${S}" "${GITDIR}"
|
||||
BINUTILS_DIR="${GITDIR}"
|
||||
if [ -d "${GITDIR}/.git" ]; then
|
||||
CL=$(cd "${BINUTILS_DIR}"; git log --pretty=format:%s -n1 | egrep -o '[0-9]+')
|
||||
fi
|
||||
fi
|
||||
if [[ ! -z ${CL} ]] ; then
|
||||
BINUTILS_PKG_VERSION="${BINUTILS_PKG_VERSION}_${CL}"
|
||||
fi
|
||||
ln -s ${BINUTILS_DIR} ${S_BINUTILS}
|
||||
|
||||
mkdir -p "${MY_BUILDDIR_BINUTILS}"
|
||||
}
|
||||
|
||||
|
||||
src_compile() {
|
||||
# keep things sane
|
||||
strip-flags
|
||||
|
||||
local x
|
||||
echo
|
||||
for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
|
||||
einfo "$(printf '%10s' ${x}:) ${!x}"
|
||||
done
|
||||
echo
|
||||
|
||||
cd "${MY_BUILDDIR_BINUTILS}"
|
||||
local myconf=""
|
||||
is_cross && myconf="${myconf} --with-sysroot=/usr/${CTARGET}"
|
||||
myconf="--prefix=/usr \
|
||||
--host=${CHOST} \
|
||||
--target=${CTARGET} \
|
||||
--datadir=${DATAPATH} \
|
||||
--infodir=${DATAPATH}/info \
|
||||
--mandir=${DATAPATH}/man \
|
||||
--bindir=${BINPATH} \
|
||||
--libdir=${LIBPATH} \
|
||||
--libexecdir=${LIBPATH} \
|
||||
--includedir=${INCPATH} \
|
||||
--enable-64-bit-bfd \
|
||||
--enable-gold \
|
||||
--enable-shared \
|
||||
--disable-werror \
|
||||
--enable-secureplt \
|
||||
--enable-plugins \
|
||||
--without-included-gettext \
|
||||
--build=${CBUILD} \
|
||||
--with-bugurl=http://code.google.com/p/chromium-os/issues/entry \
|
||||
${myconf} ${EXTRA_ECONF}"
|
||||
|
||||
binutils_conf="${myconf} --with-pkgversion=${BINUTILS_PKG_VERSION}"
|
||||
|
||||
echo ./configure ${binutils_conf}
|
||||
"${S_BINUTILS}"/configure ${binutils_conf} || die "configure failed"
|
||||
|
||||
emake all || die "emake failed"
|
||||
|
||||
# only build info pages if we user wants them, and if
|
||||
# we have makeinfo (may not exist when we bootstrap)
|
||||
if type -p makeinfo > /dev/null ; then
|
||||
emake info || die "make info failed"
|
||||
fi
|
||||
# we nuke the manpages when we're left with junk
|
||||
# (like when we bootstrap, no perl -> no manpages)
|
||||
find . -name '*.1' -a -size 0 | xargs rm -f
|
||||
}
|
||||
|
||||
src_test() {
|
||||
cd "${MY_BUILDDIR_BINUTILS}"
|
||||
make check || die "check failed :("
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local x d
|
||||
|
||||
cd "${MY_BUILDDIR_BINUTILS}"
|
||||
emake DESTDIR="${D}" tooldir="${LIBPATH}" install || die
|
||||
rm -rf "${D}"/${LIBPATH}/bin
|
||||
|
||||
# Newer versions of binutils get fancy with ${LIBPATH} #171905
|
||||
cd "${D}"/${LIBPATH}
|
||||
for d in ../* ; do
|
||||
[[ ${d} == ../${BVER} ]] && continue
|
||||
mv ${d}/* . || die
|
||||
rmdir ${d} || die
|
||||
done
|
||||
|
||||
# Now we collect everything intp the proper SLOT-ed dirs
|
||||
# When something is built to cross-compile, it installs into
|
||||
# /usr/$CHOST/ by default ... we have to 'fix' that :)
|
||||
if is_cross ; then
|
||||
cd "${D}"/${BINPATH}
|
||||
for x in * ; do
|
||||
mv ${x} ${x/${CTARGET}-}
|
||||
done
|
||||
|
||||
if [[ -d ${D}/usr/${CHOST}/${CTARGET} ]] ; then
|
||||
mv "${D}"/usr/${CHOST}/${CTARGET}/include "${D}"/${INCPATH}
|
||||
mv "${D}"/usr/${CHOST}/${CTARGET}/lib/* "${D}"/${LIBPATH}/
|
||||
rm -r "${D}"/usr/${CHOST}/{include,lib}
|
||||
fi
|
||||
fi
|
||||
insinto ${INCPATH}
|
||||
doins "${S_BINUTILS}/include/libiberty.h"
|
||||
if [[ -d ${D}/${LIBPATH}/lib ]] ; then
|
||||
mv "${D}"/${LIBPATH}/lib/* "${D}"/${LIBPATH}/
|
||||
rm -r "${D}"/${LIBPATH}/lib
|
||||
fi
|
||||
|
||||
# Now, some binutils are tricky and actually provide
|
||||
# for multiple TARGETS. Really, we're talking just
|
||||
# 32bit/64bit support (like mips/ppc/sparc). Here
|
||||
# we want to tell binutils-config that it's cool if
|
||||
# it generates multiple sets of binutil symlinks.
|
||||
# e.g. sparc gets {sparc,sparc64}-unknown-linux-gnu
|
||||
local targ=${CTARGET/-*} src="" dst=""
|
||||
local FAKE_TARGETS=${CTARGET}
|
||||
case ${targ} in
|
||||
mips*) src="mips" dst="mips64";;
|
||||
powerpc*) src="powerpc" dst="powerpc64";;
|
||||
s390*) src="s390" dst="s390x";;
|
||||
sparc*) src="sparc" dst="sparc64";;
|
||||
esac
|
||||
case ${targ} in
|
||||
mips64*|powerpc64*|s390x*|sparc64*) targ=${src} src=${dst} dst=${targ};;
|
||||
esac
|
||||
[[ -n ${src}${dst} ]] && FAKE_TARGETS="${FAKE_TARGETS} ${CTARGET/${src}/${dst}}"
|
||||
|
||||
# Generate an env.d entry for this binutils
|
||||
insinto /etc/env.d/binutils
|
||||
cat <<-EOF > "${T}"/env.d
|
||||
TARGET="${CTARGET}"
|
||||
VER="${BVER}"
|
||||
LIBPATH="${LIBPATH}"
|
||||
FAKE_TARGETS="${FAKE_TARGETS}"
|
||||
EOF
|
||||
newins "${T}"/env.d ${CTARGET}-${BVER}
|
||||
|
||||
# Handle documentation
|
||||
if ! is_cross ; then
|
||||
cd "${S_BINUTILS}"
|
||||
dodoc README
|
||||
docinto bfd
|
||||
dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
|
||||
docinto binutils
|
||||
dodoc binutils/ChangeLog binutils/NEWS binutils/README
|
||||
docinto gas
|
||||
dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
|
||||
docinto gprof
|
||||
dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
|
||||
docinto ld
|
||||
dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
|
||||
docinto libiberty
|
||||
dodoc libiberty/ChangeLog* libiberty/README
|
||||
docinto opcodes
|
||||
dodoc opcodes/ChangeLog*
|
||||
fi
|
||||
# Remove shared info pages
|
||||
rm -f "${D}"/${DATAPATH}/info/{dir,configure.info,standards.info}
|
||||
# Trim all empty dirs
|
||||
find "${D}" -type d | xargs rmdir >& /dev/null
|
||||
|
||||
if use hardened ; then
|
||||
LDWRAPPER=ldwrapper.hardened
|
||||
else
|
||||
LDWRAPPER=ldwrapper
|
||||
fi
|
||||
|
||||
mv "${D}/${BINPATH}/ld.bfd" "${D}/${BINPATH}/ld.bfd.real" || die
|
||||
exeinto "${BINPATH}"
|
||||
newexe "${FILESDIR}/${LDWRAPPER}" "ld.bfd" || die
|
||||
|
||||
mv "${D}/${BINPATH}/ld.gold" "${D}/${BINPATH}/ld.gold.real" || die
|
||||
exeinto "${BINPATH}"
|
||||
newexe "${FILESDIR}/${LDWRAPPER}" "ld.gold" || die
|
||||
|
||||
# Set default to be ld.bfd in regular installation
|
||||
dosym ld.bfd "${BINPATH}/ld"
|
||||
|
||||
# Make a fake installation for gold with gold as the default linker
|
||||
# so we can turn gold on/off with binutils-config
|
||||
LASTDIR=${LIBPATH##/*/}
|
||||
dosym "${LASTDIR}" "${LIBPATH}-gold"
|
||||
LASTDIR=${DATAPATH##/*/}
|
||||
dosym "${LASTDIR}" "${DATAPATH}-gold"
|
||||
|
||||
mkdir "${D}/${BINPATH}-gold"
|
||||
cd "${D}"/${BINPATH}
|
||||
LASTDIR=${BINPATH##/*/}
|
||||
for x in * ; do
|
||||
dosym "../${LASTDIR}/${x}" "${BINPATH}-gold/${x}"
|
||||
done
|
||||
dosym ld.gold "${BINPATH}-gold/ld"
|
||||
|
||||
# Install gold binutils-config configuration file
|
||||
insinto /etc/env.d/binutils
|
||||
cat <<-EOF > "${T}"/env.d
|
||||
TARGET="${CTARGET}"
|
||||
VER="${BVER}-gold"
|
||||
LIBPATH="${LIBPATH}-gold"
|
||||
FAKE_TARGETS="${FAKE_TARGETS}"
|
||||
EOF
|
||||
newins "${T}"/env.d ${CTARGET}-${BVER}-gold
|
||||
|
||||
# Move the locale directory to where it is supposed to be
|
||||
mv "${D}/usr/share/locale" "${D}/${DATAPATH}/"
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
binutils-config ${CTARGET}-${BVER}
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
local current_profile=$(binutils-config -c ${CTARGET})
|
||||
|
||||
# If no other versions exist, then uninstall for this
|
||||
# target ... otherwise, switch to the newest version
|
||||
# Note: only do this if this version is unmerged. We
|
||||
# rerun binutils-config if this is a remerge, as
|
||||
# we want the mtimes on the symlinks updated (if
|
||||
# it is the same as the current selected profile)
|
||||
if [[ ! -e ${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
|
||||
local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
|
||||
choice=${choice//$'\n'/ }
|
||||
choice=${choice/* }
|
||||
if [[ -z ${choice} ]] ; then
|
||||
env -i binutils-config -u ${CTARGET}
|
||||
else
|
||||
binutils-config ${choice}
|
||||
fi
|
||||
elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then
|
||||
binutils-config ${CTARGET}-${BVER}
|
||||
fi
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This files wraps as.
|
||||
# In addition, it adds --allow-incbin to the command line before invoking as.
|
||||
# This flag is necessary on link commands that use the .incbin directive.
|
||||
|
||||
exec "$(readlink -f "${0}").real" --allow-incbin "$@"
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
#
|
||||
# This script is given one argument: the base of the source directory of
|
||||
# the package, and it prints a string on stdout with the numerical version
|
||||
# number for said repo.
|
||||
|
||||
exec sed -n '/^ *VERSION=/{s:.*=::;p;q}' \
|
||||
"$(find "$1" -path '*/bfd/configure')"
|
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This files wraps ld and ld.gold.
|
||||
# In addition, it adds --hash-style=gnu to the linker command line.
|
||||
|
||||
exec "$(readlink -f "${0}").real" --hash-style=gnu "$@"
|
@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This files wraps ld and ld.gold.
|
||||
# In addition, it inserts hardened flags (-z now and -z relro) to the linker
|
||||
# before invoking it. It also adds --hash-style=gnu to the linker command line.
|
||||
#
|
||||
# There is a similar wrapper around gcc that adds -fPIE, -fstack-protector-all,
|
||||
# -D_FORTIFY_SOURCE=2 and -pie to the compile command line.
|
||||
|
||||
exec "$(readlink -f "${0}").real" -z now -z relro --hash-style=gnu "$@"
|
File diff suppressed because it is too large
Load Diff
@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
#
|
||||
# This script is given one argument: the base of the source directory of
|
||||
# the package, and it prints a string on stdout with the numerical version
|
||||
# number for said repo.
|
||||
#
|
||||
# The reason we extract the version from the ChangeLog instead of BASE-VER is
|
||||
# because BASE-VER contains a custom google string that lacks the x.y.z info.
|
||||
|
||||
|
||||
exec awk '$1 == "*" && $2 == "GCC" && $4 == "released." { print $3; exit }' \
|
||||
"$1"/ChangeLog
|
@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This script ensures that "--sysroot" is passed to whatever it is wrapping.
|
||||
# To use:
|
||||
# mv <tool> <tool>.real
|
||||
# ln -s <path_to_sysroot_wrapper> <tool>
|
||||
|
||||
SYSROOT_WRAPPER_LOG=/tmp/sysroot_wrapper.error
|
||||
if [ -n "$SYSROOT" ] ; then
|
||||
exec "${0}.real" --sysroot="$SYSROOT" "$@"
|
||||
else
|
||||
if [[ ! -f $SYSROOT_WRAPPER_LOG ]]; then
|
||||
touch $SYSROOT_WRAPPER_LOG
|
||||
chmod a+w $SYSROOT_WRAPPER_LOG
|
||||
fi
|
||||
echo "Invocation with missing SYSROOT: ${0} $@" >> $SYSROOT_WRAPPER_LOG
|
||||
exec "${0}.real" "$@"
|
||||
fi
|
@ -1,292 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This script is a meta-driver for the toolchain. It transforms the command
|
||||
# line to allow the following:
|
||||
# 1. This script ensures that '--sysroot' is passed to whatever it is wrapping.
|
||||
#
|
||||
# 2. It adds hardened flags to gcc invocation. The hardened flags are:
|
||||
# -fstack-protector-strong
|
||||
# -fPIE
|
||||
# -pie
|
||||
# -D_FORTIFY_SOURCE=2
|
||||
#
|
||||
# It can disable -fPIE -pie by checking if -nopie is passed to gcc. In this
|
||||
# case it removes -nopie as it is a non-standard flag.
|
||||
#
|
||||
# 3. Enable clang diagnostics with -clang option
|
||||
#
|
||||
# 4. Add new -print-cmdline option to print the command line before executon
|
||||
#
|
||||
# This is currently implemented as two loops on the list of arguments. The
|
||||
# first loop # identifies hardening flags, as well as determining if clang
|
||||
# invocation is specified. The second loop build command line for clang
|
||||
# invocation as well adjusting gcc command line.
|
||||
#
|
||||
# This implementation ensure compile time of default path remains mostly
|
||||
# the same.
|
||||
#
|
||||
# There is a similar hardening wrapper that wraps ld and adds -z now -z relro
|
||||
# to the link command line (see ldwrapper).
|
||||
#
|
||||
# To use:
|
||||
# mv <tool> <tool>.real
|
||||
# ln -s <path_to_sysroot_wrapper> <tool>
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
# Full hardening. Some/all of these may be discarded depending on
|
||||
# other flags.
|
||||
flags_to_add = set(['-fstack-protector-strong', '-fPIE', '-pie',
|
||||
'-D_FORTIFY_SOURCE=2', '-frecord-gcc-switches'])
|
||||
disable_flags = set(['-mno-movbe', '-mno-ssse3'])
|
||||
|
||||
# Only FORTIFY_SOURCE hardening flag is applicable for clang parser.
|
||||
clang_cmdline = ['-fsyntax-only', '-Qunused-arguments', '-D_FORTIFY_SOURCE=2']
|
||||
|
||||
# If -clang is present.
|
||||
clang_compile_requested = 0
|
||||
|
||||
# If -print-cmdline is present.
|
||||
print_cmdline = 0
|
||||
|
||||
# If ccache should be used automatically.
|
||||
use_ccache = True # @CCACHE_DEFAULT@ Keep this comment for code.
|
||||
|
||||
fstack = set(['-D__KERNEL__', '-fno-stack-protector', '-nodefaultlibs',
|
||||
'-nostdlib'])
|
||||
fPIE = set(['-D__KERNEL__', '-fPIC', '-fPIE', '-fno-PIC', '-fno-PIE',
|
||||
'-fno-pic', '-fno-pie', '-fpic', '-fpie', '-nopie', '-nostartfiles',
|
||||
'-nostdlib', '-pie', '-static'])
|
||||
pie = set(['-D__KERNEL__', '-A', '-fno-PIC', '-fno-PIE', '-fno-pic', '-fno-pie',
|
||||
'-nopie', '-nostartfiles', '-nostdlib', '-pie', '-r', '--shared', '-shared',
|
||||
'-static'])
|
||||
sse = set(['-msse3', '-mssse3', '-msse4.1', '-msse4.2', '-msse4', '-msse4a'])
|
||||
wrapper_only_options = set(['-clang', '-print-cmdline', '-nopie', '-noccache'])
|
||||
|
||||
myargs = sys.argv[1:]
|
||||
if fstack.intersection(myargs):
|
||||
flags_to_add.remove('-fstack-protector-strong')
|
||||
flags_to_add.add('-fno-stack-protector')
|
||||
if fPIE.intersection(myargs):
|
||||
flags_to_add.remove('-fPIE')
|
||||
if pie.intersection(myargs):
|
||||
flags_to_add.remove('-pie')
|
||||
if sse.intersection(myargs):
|
||||
disable_flags.remove('-mno-ssse3')
|
||||
clang_compile_requested = '-clang' in myargs
|
||||
print_cmdline = '-print-cmdline' in myargs
|
||||
if '-noccache' in myargs:
|
||||
# Only explicitly disable so we can set defaults up top.
|
||||
use_ccache = False
|
||||
cmdline = [x for x in myargs if x not in wrapper_only_options]
|
||||
|
||||
if not clang_compile_requested:
|
||||
gcc_cmdline = cmdline
|
||||
else:
|
||||
import subprocess
|
||||
# Gcc flags to remove from the clang command line.
|
||||
# TODO: Once clang supports gcc compatibility mode, remove
|
||||
# these checks.
|
||||
#
|
||||
# Use of -Qunused-arguments allows this set to be small, just those
|
||||
# that clang still warns about.
|
||||
clang_unsupported = set(['-pass-exit-codes', '-Ofast', '-Wclobbered',
|
||||
'-fvisibility=internal', '-Woverride-init', '-Wunsafe-loop-optimizations',
|
||||
'-Wlogical-op', '-Wmissing-parameter-type', '-Wold-style-declaration'])
|
||||
clang_unsupported_prefixes = ('-Wstrict-aliasing=')
|
||||
|
||||
# Clang may use different options for the same or similar functionality.
|
||||
gcc_to_clang = {
|
||||
'-Wno-error=unused-but-set-variable': '-Wno-error=unused-variable',
|
||||
'-Wno-error=maybe-uninitialized': '-Wno-error=uninitialized',
|
||||
}
|
||||
|
||||
# If these options are specified, do not run clang, even if -clang is
|
||||
# specified.
|
||||
# This is mainly for utilities that depend on compiler output.
|
||||
skip_clang_prefixes = ('-print-', '-dump', '@')
|
||||
skip_clang_set = set(['-', '-E', '-M', '-x'])
|
||||
|
||||
# Reset gcc cmdline too. Only change is to remove -Xclang-only
|
||||
# options if specified.
|
||||
gcc_cmdline = []
|
||||
|
||||
skip_clang = False
|
||||
for flag in cmdline:
|
||||
if flag.startswith(skip_clang_prefixes) or flag in skip_clang_set or flag.endswith('.S'):
|
||||
skip_clang = True
|
||||
elif not (flag in clang_unsupported or
|
||||
flag.startswith(clang_unsupported_prefixes)):
|
||||
# Strip off -Xclang-only= if present.
|
||||
if flag.startswith('-Xclang-only='):
|
||||
opt = flag.partition('=')[2]
|
||||
clang_cmdline.append(opt)
|
||||
# No need to add to gcc_cmdline.
|
||||
continue
|
||||
elif flag in gcc_to_clang.keys():
|
||||
clang_cmdline.append(gcc_to_clang[flag])
|
||||
else:
|
||||
clang_cmdline.append(flag)
|
||||
gcc_cmdline.append(flag)
|
||||
|
||||
if re.match(r'i.86|x86_64', os.path.basename(sys.argv[0])):
|
||||
gcc_cmdline.extend(disable_flags)
|
||||
|
||||
|
||||
def get_proc_cmdline(pid):
|
||||
with open('/proc/%i/cmdline' % pid) as fp:
|
||||
return fp.read().replace('\0', ' ')
|
||||
return None
|
||||
|
||||
|
||||
def get_proc_status(pid, item):
|
||||
with open('/proc/%i/status' % pid) as fp:
|
||||
for line in fp:
|
||||
m = re.match(r'%s:\s*(.*)' % re.escape(item), line)
|
||||
if m:
|
||||
return m.group(1)
|
||||
return None
|
||||
|
||||
|
||||
def log_parent_process_tree(log, ppid):
|
||||
depth = 0
|
||||
|
||||
while ppid > 1:
|
||||
cmdline = get_proc_cmdline(ppid)
|
||||
log.warning(' %*s {%5i}: %s' % (depth, '', ppid, cmdline))
|
||||
|
||||
ppid = get_proc_status(ppid, 'PPid')
|
||||
if not ppid:
|
||||
break
|
||||
ppid = int(ppid)
|
||||
depth += 2
|
||||
|
||||
|
||||
sysroot = os.environ.get('SYSROOT', '')
|
||||
if sysroot:
|
||||
clang_cmdline.append('--sysroot=%s' % sysroot)
|
||||
gcc_cmdline.append('--sysroot=%s' % sysroot)
|
||||
else:
|
||||
import logging
|
||||
import logging.handlers
|
||||
import traceback
|
||||
|
||||
log_file = '/tmp/sysroot_wrapper.error'
|
||||
|
||||
log = logging.getLogger('sysroot_wrapper')
|
||||
log.setLevel(logging.DEBUG)
|
||||
|
||||
handler = logging.handlers.RotatingFileHandler(log_file, maxBytes=0x20000000,
|
||||
backupCount=1)
|
||||
formatter = logging.Formatter('%(asctime)s %(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
log.addHandler(handler)
|
||||
|
||||
log.warning('Invocation with missing SYSROOT: %s' % ' '.join(sys.argv))
|
||||
try:
|
||||
log_parent_process_tree(log, os.getppid())
|
||||
except IOError:
|
||||
log.error('%s' % traceback.format_exc())
|
||||
|
||||
try:
|
||||
# The logging module does not support setting permissions.
|
||||
os.chmod(log_file, 0666)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
if clang_compile_requested and not skip_clang:
|
||||
clang_comp = os.environ.get('CLANG', '/usr/bin/clang')
|
||||
|
||||
# Specify the target for clang.
|
||||
gcc_comp = os.path.basename(sys.argv[0])
|
||||
arch = gcc_comp.split('-')[0]
|
||||
if arch == 'i386' or arch == 'i486' or arch == 'i586' or arch == 'i686':
|
||||
clang_cmdline.insert(0, '-m32')
|
||||
elif arch == 'x86_64':
|
||||
clang_cmdline.insert(0, '-m64')
|
||||
elif arch.startswith('arm'):
|
||||
clang_cmdline.insert(0, 'armv7a-cros-linux-gnueabi')
|
||||
clang_cmdline.insert(0, '-target')
|
||||
|
||||
# Check for clang or clang++.
|
||||
if sys.argv[0].endswith('++'):
|
||||
clang_comp += '++'
|
||||
|
||||
if print_cmdline:
|
||||
print '%s %s\n' % (clang_comp, ' '.join(clang_cmdline))
|
||||
|
||||
p = subprocess.Popen([clang_comp] + clang_cmdline)
|
||||
p.wait()
|
||||
if p.returncode != 0:
|
||||
sys.exit(p.returncode)
|
||||
|
||||
execargs = []
|
||||
real_gcc = '%s.real' % sys.argv[0]
|
||||
if use_ccache:
|
||||
# Portage likes to set this for us when it has FEATURES=-ccache.
|
||||
# The other vars we need to setup manually because of tools like
|
||||
# scons that scrubs the env before we get executed.
|
||||
os.environ.pop('CCACHE_DISABLE', None)
|
||||
|
||||
# We should be able to share the objects across compilers as
|
||||
# the pre-processed output will differ. This allows boards
|
||||
# that share compiler flags (like x86 boards) to share caches.
|
||||
ccache_dir = '/var/cache/distfiles/ccache'
|
||||
os.environ['CCACHE_DIR'] = ccache_dir
|
||||
|
||||
# If RESTRICT=sandbox is enabled, then sandbox won't be setup,
|
||||
# and the env vars won't be available for appending.
|
||||
if 'SANDBOX_WRITE' in os.environ:
|
||||
os.environ['SANDBOX_WRITE'] += ':%s' % ccache_dir
|
||||
|
||||
# We need to get ccache to make relative paths from within the
|
||||
# sysroot. This lets us share cached files across boards (if
|
||||
# all other things are equal of course like CFLAGS) as well as
|
||||
# across versions. A quick test is something like:
|
||||
# $ export CFLAGS='-O2 -g -pipe' CXXFLAGS='-O2 -g -pipe'
|
||||
# $ BOARD=x86-alex
|
||||
# $ cros_workon-$BOARD stop cros-disks
|
||||
# $ emerge-$BOARD cros-disks
|
||||
# $ cros_workon-$BOARD start cros-disks
|
||||
# $ emerge-$BOARD cros-disks
|
||||
# $ BOARD=amd64-generic
|
||||
# $ cros_workon-$BOARD stop cros-disks
|
||||
# $ emerge-$BOARD cros-disks
|
||||
# $ cros_workon-$BOARD start cros-disks
|
||||
# $ emerge-$BOARD cros-disks
|
||||
# All of those will get cache hits (ignoring the first one
|
||||
# which will seed the cache) due to this setting.
|
||||
if sysroot:
|
||||
os.environ['CCACHE_BASEDIR'] = sysroot
|
||||
|
||||
# Minor speed up as we don't care about this in general.
|
||||
#os.environ['CCACHE_NOSTATS'] = 'no'
|
||||
# Useful for debugging.
|
||||
#os.environ['CCACHE_LOG'] = '/dev/stderr'
|
||||
|
||||
# We take care of nuking the cache in the gcc ebuild whenever
|
||||
# it revbumps in a way that matters, so disable ccache's check.
|
||||
os.environ['CCACHE_COMPILERCHECK'] = 'none'
|
||||
|
||||
# Make sure we keep the cached files group writable.
|
||||
os.environ['CCACHE_UMASK'] = '002'
|
||||
|
||||
argv0 = '/usr/bin/ccache'
|
||||
execargs += ['ccache']
|
||||
#gcc_cmdline += ['-noccache']
|
||||
else:
|
||||
argv0 = real_gcc
|
||||
|
||||
execargs += [real_gcc] + list(flags_to_add) + gcc_cmdline
|
||||
|
||||
if print_cmdline:
|
||||
print '[%s] %s' % (argv0, ' '.join(execargs))
|
||||
|
||||
sys.stdout.flush()
|
||||
os.execv(argv0, execargs)
|
@ -1,548 +0,0 @@
|
||||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.4.3-r3.ebuild,v 1.1 2010/06/19 01:53:09 zorry Exp $
|
||||
|
||||
EAPI=1
|
||||
CROS_WORKON_COMMIT="164c96f2f2c2aec1854ec2866d1ad865b2326251"
|
||||
CROS_WORKON_TREE="896542d4852cae24c8117b2a0706e0e8c2a51fdd"
|
||||
CROS_WORKON_LOCALNAME=gcc
|
||||
CROS_WORKON_PROJECT=chromiumos/third_party/gcc
|
||||
|
||||
inherit eutils cros-workon binutils-funcs
|
||||
|
||||
GCC_FILESDIR="${PORTDIR}/sys-devel/gcc/files"
|
||||
|
||||
DESCRIPTION="The GNU Compiler Collection. Includes C/C++, java compilers, pie+ssp extensions, Haj Ten Brugge runtime bounds checking. This Compiler is based off of Crosstoolv14."
|
||||
|
||||
LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
|
||||
KEYWORDS="amd64 arm x86"
|
||||
|
||||
RDEPEND=">=sys-libs/zlib-1.1.4
|
||||
>=sys-devel/gcc-config-1.6
|
||||
virtual/libiconv
|
||||
>=dev-libs/gmp-4.2.1
|
||||
>=dev-libs/mpc-0.8.1
|
||||
>=dev-libs/mpfr-2.3.2
|
||||
graphite? (
|
||||
>=dev-libs/ppl-0.10
|
||||
>=dev-libs/cloog-ppl-0.15.4
|
||||
)
|
||||
!build? (
|
||||
gcj? (
|
||||
gtk? (
|
||||
x11-libs/libXt
|
||||
x11-libs/libX11
|
||||
x11-libs/libXtst
|
||||
x11-proto/xproto
|
||||
x11-proto/xextproto
|
||||
>=x11-libs/gtk+-2.2
|
||||
x11-libs/pango
|
||||
)
|
||||
>=media-libs/libart_lgpl-2.1
|
||||
app-arch/zip
|
||||
app-arch/unzip
|
||||
)
|
||||
>=sys-libs/ncurses-5.2-r2
|
||||
nls? ( sys-devel/gettext )
|
||||
)"
|
||||
DEPEND="${RDEPEND}
|
||||
test? ( >=dev-util/dejagnu-1.4.4 >=sys-devel/autogen-5.5.4 )
|
||||
>=sys-apps/texinfo-4.8
|
||||
>=sys-devel/bison-1.875
|
||||
elibc_glibc? ( >=sys-libs/glibc-2.8 )
|
||||
amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )
|
||||
ppc? ( >=${CATEGORY}/binutils-2.17 )
|
||||
ppc64? ( >=${CATEGORY}/binutils-2.17 )
|
||||
>=${CATEGORY}/binutils-2.15.94"
|
||||
PDEPEND=">=sys-devel/gcc-config-1.4"
|
||||
if [[ ${CATEGORY} != cross-* ]] ; then
|
||||
PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
|
||||
fi
|
||||
|
||||
RESTRICT="mirror strip"
|
||||
|
||||
IUSE="gcj git_gcc graphite gtk hardened hardfp mounted_gcc multilib multislot
|
||||
nls cxx openmp tests +thumb upstream_gcc vanilla +wrapper_ccache"
|
||||
|
||||
is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] ; }
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
if [[ ${CTARGET} = ${CHOST} ]] ; then
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
|
||||
if use multislot ; then
|
||||
SLOT="${CTARGET}-${PV}"
|
||||
else
|
||||
SLOT="${CTARGET}"
|
||||
fi
|
||||
|
||||
PREFIX=/usr
|
||||
|
||||
src_unpack() {
|
||||
if use mounted_gcc ; then
|
||||
if [[ ! -d "$(get_gcc_dir)" ]] ; then
|
||||
die "gcc dir not mounted/present at: $(get_gcc_dir)"
|
||||
fi
|
||||
elif use upstream_gcc ; then
|
||||
GCC_MIRROR=ftp://mirrors.kernel.org/gnu/gcc
|
||||
GCC_TARBALL=${GCC_MIRROR}/${P}/${P}.tar.bz2
|
||||
wget $GCC_TARBALL
|
||||
tar xf ${GCC_TARBALL##*/}
|
||||
elif use git_gcc ; then
|
||||
git clone "${CROS_WORKON_REPO}/${CROS_WORKON_PROJECT}.git" "${S}"
|
||||
if [[ -n ${GCC_GITHASH} ]] ; then
|
||||
einfo "Checking out: ${GCC_GITHASH}"
|
||||
pushd "$(get_gcc_dir)" >/dev/null
|
||||
git checkout ${GCC_GITHASH} || \
|
||||
die "Couldn't checkout ${GCC_GITHASH}"
|
||||
popd >/dev/null
|
||||
fi
|
||||
else
|
||||
cros-workon_src_unpack
|
||||
cd "${S}"
|
||||
[[ ${ABI} == "x32" ]] && epatch "${FILESDIR}"/90_all_gcc-4.7-x32.patch
|
||||
fi
|
||||
|
||||
COST_PKG_VERSION="$("${FILESDIR}"/chromeos-version.sh "${S}")_cos_gg"
|
||||
|
||||
if [[ -d ${S}/.git ]]; then
|
||||
COST_PKG_VERSION+="_$(cd ${S}; git describe --always)"
|
||||
elif [[ -n ${VCSID} ]]; then
|
||||
COST_PKG_VERSION+="_${VCSID}"
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile()
|
||||
{
|
||||
src_configure
|
||||
cd $(get_gcc_build_dir) || "Build dir $(get_gcc_build_dir) not found"
|
||||
GCC_CFLAGS="$(portageq envvar CFLAGS)"
|
||||
TARGET_FLAGS=""
|
||||
|
||||
if use hardened
|
||||
then
|
||||
TARGET_FLAGS="${TARGET_FLAGS} -fstack-protector-strong -D_FORTIFY_SOURCE=2"
|
||||
fi
|
||||
|
||||
# Do not link libgcc with gold. That is known to fail on internal linker
|
||||
# errors. See crosbug.com/16719
|
||||
local LD_NON_GOLD="$(get_binutils_path_ld ${CTARGET})/ld"
|
||||
|
||||
emake CFLAGS="${GCC_CFLAGS}" \
|
||||
LDFLAGS="-Wl,-O1" \
|
||||
STAGE1_CFLAGS="-O2 -pipe" \
|
||||
BOOT_CFLAGS="-O2" \
|
||||
CFLAGS_FOR_TARGET="$(get_make_var CFLAGS_FOR_TARGET) ${TARGET_FLAGS}" \
|
||||
CXXFLAGS_FOR_TARGET="$(get_make_var CXXFLAGS_FOR_TARGET) ${TARGET_FLAGS}" \
|
||||
LD_FOR_TARGET="${LD_NON_GOLD}" \
|
||||
all || die
|
||||
}
|
||||
|
||||
# Logic copied from Gentoo's toolchain.eclass.
|
||||
toolchain_src_install() {
|
||||
BINPATH=$(get_bin_dir) # cros to Gentoo glue
|
||||
|
||||
# These should be symlinks
|
||||
dodir /usr/bin
|
||||
cd "${D}"${BINPATH}
|
||||
for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
|
||||
# For some reason, g77 gets made instead of ${CTARGET}-g77...
|
||||
# this should take care of that
|
||||
[[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
|
||||
|
||||
if [[ -f ${CTARGET}-${x} ]] ; then
|
||||
if ! is_crosscompile ; then
|
||||
ln -sf ${CTARGET}-${x} ${x}
|
||||
dosym ${BINPATH}/${CTARGET}-${x} \
|
||||
/usr/bin/${x}-${GCC_CONFIG_VER}
|
||||
fi
|
||||
|
||||
# Create version-ed symlinks
|
||||
dosym ${BINPATH}/${CTARGET}-${x} \
|
||||
/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
|
||||
fi
|
||||
|
||||
if [[ -f ${CTARGET}-${x}-${GCC_CONFIG_VER} ]] ; then
|
||||
rm -f ${CTARGET}-${x}-${GCC_CONFIG_VER}
|
||||
ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
src_install()
|
||||
{
|
||||
cd $(get_gcc_build_dir) || "Build dir $(get_gcc_build_dir) not found"
|
||||
emake DESTDIR="${D}" install || die "Could not install gcc"
|
||||
|
||||
find "${D}" -name libiberty.a -exec rm -f "{}" \;
|
||||
|
||||
# Move the libraries to the proper location
|
||||
gcc_movelibs
|
||||
|
||||
# Move pretty-printers to gdb datadir to shut ldconfig up
|
||||
gcc_move_pretty_printers
|
||||
|
||||
GCC_CONFIG_VER=$(get_gcc_base_ver)
|
||||
dodir /etc/env.d/gcc
|
||||
insinto /etc/env.d/gcc
|
||||
|
||||
local LDPATH=$(get_lib_dir)
|
||||
for SUBDIR in 32 64 ; do
|
||||
if [[ -d ${D}/${LDPATH}/${SUBDIR} ]]
|
||||
then
|
||||
LDPATH="${LDPATH}:${LDPATH}/${SUBDIR}"
|
||||
fi
|
||||
done
|
||||
|
||||
cat <<-EOF > env.d
|
||||
LDPATH="${LDPATH}"
|
||||
MANPATH="$(get_data_dir)/man"
|
||||
INFOPATH="$(get_data_dir)/info"
|
||||
STDCXX_INCDIR="$(get_stdcxx_incdir)"
|
||||
CTARGET=${CTARGET}
|
||||
GCC_PATH="$(get_bin_dir)"
|
||||
GCC_VER="$(get_gcc_base_ver)"
|
||||
EOF
|
||||
newins env.d $(get_gcc_config_file)
|
||||
cd -
|
||||
|
||||
toolchain_src_install
|
||||
|
||||
if is_crosscompile ; then
|
||||
if use hardened
|
||||
then
|
||||
SYSROOT_WRAPPER_FILE=sysroot_wrapper.hardened
|
||||
else
|
||||
SYSROOT_WRAPPER_FILE=sysroot_wrapper
|
||||
fi
|
||||
|
||||
exeinto "$(get_bin_dir)"
|
||||
doexe "${FILESDIR}/${SYSROOT_WRAPPER_FILE}" || die
|
||||
sed -i \
|
||||
-e "/^use_ccache = .*@CCACHE_DEFAULT@/s:=[^#]*:= $(usex wrapper_ccache True False) :" \
|
||||
"${D}$(get_bin_dir)/${SYSROOT_WRAPPER_FILE}" || die
|
||||
for x in c++ cpp g++ gcc; do
|
||||
if [[ -f "${CTARGET}-${x}" ]]; then
|
||||
mv "${CTARGET}-${x}" "${CTARGET}-${x}.real"
|
||||
dosym "${SYSROOT_WRAPPER_FILE}" "$(get_bin_dir)/${CTARGET}-${x}" || die
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if use tests
|
||||
then
|
||||
TEST_INSTALL_DIR="usr/local/dejagnu/gcc"
|
||||
dodir ${TEST_INSTALL_DIR}
|
||||
cd ${D}/${TEST_INSTALL_DIR}
|
||||
tar -czf "tests.tar.gz" ${WORKDIR}
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preinst()
|
||||
{
|
||||
# We handle ccache ourselves in the sysroot wrapper.
|
||||
rm -f /usr/lib/ccache/bin/*-*
|
||||
|
||||
local ccache_dir="/var/cache/distfiles/ccache"
|
||||
local vcsid_file="${ccache_dir}/.gcc.vcsid.${CTARGET}"
|
||||
# Clean out the ccache whenever the gcc code changes.
|
||||
# If we are using a live ebuild, nuke it everytime just
|
||||
# to be safe.
|
||||
[[ ${PV} == "9999" ]] && rm -f "${vcsid_file}"
|
||||
local old_vcsid=$(cat "${vcsid_file}" 2>/dev/null)
|
||||
if [[ ${old_vcsid} != ${CROS_WORKON_COMMIT} ]] ; then
|
||||
# Don't just delete the whole dir as that would punt
|
||||
# the vcsid tag files from other targets too.
|
||||
rm -rf "${ccache_dir}"/*
|
||||
fi
|
||||
mkdir -p -m 2775 "${ccache_dir}"
|
||||
echo "${CROS_WORKON_COMMIT}" > "${vcsid_file}"
|
||||
|
||||
# Use a 10G limit as our bots have finite resources. A full
|
||||
# x86-generic build uses ~6GB, while an amd64-generic uses
|
||||
# ~8GB, so this limit should be sufficient.
|
||||
CCACHE_UMASK=002 CCACHE_DIR=${ccache_dir} ccache -F 0 -M 11G
|
||||
|
||||
# Make sure the dirs have perms for emerge builders.
|
||||
chown -R ${PORTAGE_USERNAME}:portage "${ccache_dir}"
|
||||
}
|
||||
|
||||
pkg_postinst()
|
||||
{
|
||||
gcc-config $(get_gcc_config_file)
|
||||
}
|
||||
|
||||
pkg_postrm()
|
||||
{
|
||||
if is_crosscompile ; then
|
||||
if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
|
||||
rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
|
||||
rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
|
||||
rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure()
|
||||
{
|
||||
if use mounted_gcc && [[ -f $(get_gcc_build_dir)/Makefile ]] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Set configuration based on path variables
|
||||
local DATAPATH=$(get_data_dir)
|
||||
local confgcc="$(use_enable multilib)
|
||||
--prefix=${PREFIX} \
|
||||
--bindir=$(get_bin_dir) \
|
||||
--datadir=${DATAPATH} \
|
||||
--mandir=${DATAPATH}/man \
|
||||
--infodir=${DATAPATH}/info \
|
||||
--includedir=$(get_lib_dir)/include \
|
||||
--with-gxx-include-dir=$(get_stdcxx_incdir)
|
||||
--with-python-dir=${DATAPATH#${PREFIX}}/python"
|
||||
confgcc="${confgcc} --host=${CHOST}"
|
||||
confgcc="${confgcc} --target=${CTARGET}"
|
||||
confgcc="${confgcc} --build=${CBUILD}"
|
||||
|
||||
# Language options for stage1/stage2.
|
||||
if ! use cxx
|
||||
then
|
||||
GCC_LANG="c"
|
||||
else
|
||||
GCC_LANG="c,c++"
|
||||
fi
|
||||
confgcc="${confgcc} --enable-languages=${GCC_LANG}"
|
||||
|
||||
if use hardfp && [[ ${CTARGET} == arm* ]] ;
|
||||
then
|
||||
confgcc="${confgcc} --with-float=hard"
|
||||
fi
|
||||
|
||||
if use thumb && [[ ${CTARGET} == arm* ]] ;
|
||||
then
|
||||
confgcc="${confgcc} --with-mode=thumb"
|
||||
fi
|
||||
|
||||
if is_crosscompile ; then
|
||||
local needed_libc="glibc"
|
||||
if [[ -n ${needed_libc} ]] ; then
|
||||
if ! has_version ${CATEGORY}/${needed_libc} ; then
|
||||
confgcc="${confgcc} --disable-shared --disable-threads --without-headers"
|
||||
elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
|
||||
confgcc="${confgcc} --disable-shared --with-sysroot=/usr/${CTARGET}"
|
||||
else
|
||||
confgcc="${confgcc} --with-sysroot=/usr/${CTARGET}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
confgcc="${confgcc} --enable-shared --enable-threads=posix"
|
||||
fi
|
||||
|
||||
confgcc="${confgcc} $(get_gcc_configure_options ${CTARGET})"
|
||||
|
||||
EXTRA_ECONF="--with-bugurl=http://code.google.com/p/chromium-os/issues/entry\
|
||||
--with-pkgversion=${COST_PKG_VERSION} --enable-linker-build-id"
|
||||
confgcc="${confgcc} ${EXTRA_ECONF}"
|
||||
|
||||
# Build in a separate build tree
|
||||
mkdir -p $(get_gcc_build_dir) || \
|
||||
die "Could not create build dir $(get_gcc_build_dir)"
|
||||
cd $(get_gcc_build_dir) || die "Build dir $(get_gcc_build_dir) not found"
|
||||
|
||||
# and now to do the actual configuration
|
||||
addwrite /dev/zero
|
||||
echo "Running this:"
|
||||
echo "configure ${confgcc}"
|
||||
echo "$(get_gcc_dir)"/configure "$@"
|
||||
"$(get_gcc_dir)"/configure ${confgcc} || die "failed to run configure"
|
||||
}
|
||||
|
||||
get_gcc_configure_options()
|
||||
{
|
||||
local CTARGET=$1; shift
|
||||
local confgcc=$(get_gcc_common_options)
|
||||
case ${CTARGET} in
|
||||
arm*) #264534
|
||||
local arm_arch="${CTARGET%%-*}"
|
||||
# Only do this if arm_arch is armv*
|
||||
if [[ ${arm_arch} == armv* ]] ; then
|
||||
# Convert armv7{a,r,m} to armv7-{a,r,m}
|
||||
[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
|
||||
# Remove endian ('l' / 'eb')
|
||||
[[ ${arm_arch} == *l ]] && arm_arch=${arm_arch%l}
|
||||
[[ ${arm_arch} == *eb ]] && arm_arch=${arm_arch%eb}
|
||||
confgcc="${confgcc} --with-arch=${arm_arch}"
|
||||
confgcc="${confgcc} --disable-esp"
|
||||
fi
|
||||
;;
|
||||
i?86*)
|
||||
# Hardened is enabled for x86, but disabled for ARM.
|
||||
confgcc="${confgcc} --enable-esp"
|
||||
confgcc="${confgcc} --with-arch=atom"
|
||||
confgcc="${confgcc} --with-tune=atom"
|
||||
# Remove this once crash2 supports larger symbols.
|
||||
# http://code.google.com/p/chromium-os/issues/detail?id=23321
|
||||
confgcc="${confgcc} --enable-frame-pointer"
|
||||
;;
|
||||
x86_64*-gnux32)
|
||||
confgcc="${confgcc} --with-abi=x32 --with-multilib-list=mx32"
|
||||
;;
|
||||
esac
|
||||
echo ${confgcc}
|
||||
}
|
||||
|
||||
get_gcc_common_options()
|
||||
{
|
||||
local confgcc
|
||||
confgcc="${confgcc} --disable-libmudflap"
|
||||
confgcc="${confgcc} --disable-libssp"
|
||||
confgcc+=" $(use_enable openmp libgomp)"
|
||||
confgcc="${confgcc} --enable-__cxa_atexit"
|
||||
confgcc="${confgcc} --enable-checking=release"
|
||||
confgcc="${confgcc} --disable-libquadmath"
|
||||
echo ${confgcc}
|
||||
}
|
||||
|
||||
get_gcc_dir()
|
||||
{
|
||||
local GCCDIR
|
||||
if use mounted_gcc ; then
|
||||
GCCDIR=${GCC_SOURCE_PATH:=/usr/local/toolchain_root/gcc}
|
||||
elif use upstream_gcc ; then
|
||||
GCCDIR=${P}
|
||||
else
|
||||
GCCDIR=${S}
|
||||
fi
|
||||
echo "${GCCDIR}"
|
||||
}
|
||||
|
||||
get_gcc_build_dir()
|
||||
{
|
||||
echo "$(get_gcc_dir)-build-${CTARGET}"
|
||||
}
|
||||
|
||||
get_gcc_base_ver()
|
||||
{
|
||||
cat "$(get_gcc_dir)/gcc/BASE-VER"
|
||||
}
|
||||
|
||||
get_stdcxx_incdir()
|
||||
{
|
||||
echo "$(get_lib_dir)/include/g++-v4"
|
||||
}
|
||||
|
||||
get_lib_dir()
|
||||
{
|
||||
echo "${PREFIX}/lib/gcc/${CTARGET}/$(get_gcc_base_ver)"
|
||||
}
|
||||
|
||||
get_bin_dir()
|
||||
{
|
||||
if is_crosscompile ; then
|
||||
echo ${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/$(get_gcc_base_ver)
|
||||
else
|
||||
echo ${PREFIX}/${CTARGET}/gcc-bin/$(get_gcc_base_ver)
|
||||
fi
|
||||
}
|
||||
|
||||
get_data_dir()
|
||||
{
|
||||
echo "${PREFIX}/share/gcc-data/${CTARGET}/$(get_gcc_base_ver)"
|
||||
}
|
||||
|
||||
get_gcc_config_file()
|
||||
{
|
||||
echo ${CTARGET}-${PV}
|
||||
}
|
||||
|
||||
# Grab a variable from the build system (taken from linux-info.eclass)
|
||||
get_make_var() {
|
||||
local var=$1 makefile=${2:-$(get_gcc_build_dir)/Makefile}
|
||||
echo -e "e:\\n\\t@echo \$(${var})\\ninclude ${makefile}" | \
|
||||
r=${makefile%/*} emake --no-print-directory -s -f - 2>/dev/null
|
||||
}
|
||||
XGCC() { get_make_var GCC_FOR_TARGET ; }
|
||||
|
||||
gcc_move_pretty_printers() {
|
||||
LIBPATH=$(get_lib_dir) # cros to Gentoo glue
|
||||
|
||||
local py gdbdir=/usr/share/gdb/auto-load${LIBPATH}
|
||||
pushd "${D}"${LIBPATH} >/dev/null
|
||||
for py in $(find . -name '*-gdb.py') ; do
|
||||
local multidir=${py%/*}
|
||||
insinto "${gdbdir}/${multidir}"
|
||||
sed -i "/^libdir =/s:=.*:= '${LIBPATH}/${multidir}':" "${py}" || die #348128
|
||||
doins "${py}" || die
|
||||
rm "${py}" || die
|
||||
done
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
# make sure the libtool archives have libdir set to where they actually
|
||||
# -are-, and not where they -used- to be. also, any dependencies we have
|
||||
# on our own .la files need to be updated.
|
||||
fix_libtool_libdir_paths() {
|
||||
pushd "${D}" >/dev/null
|
||||
|
||||
pushd "./${1}" >/dev/null
|
||||
local dir="${PWD#${D%/}}"
|
||||
local allarchives=$(echo *.la)
|
||||
allarchives="\(${allarchives// /\\|}\)"
|
||||
popd >/dev/null
|
||||
|
||||
sed -i \
|
||||
-e "/^libdir=/s:=.*:='${dir}':" \
|
||||
./${dir}/*.la
|
||||
sed -i \
|
||||
-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \
|
||||
$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
|
||||
./${dir}/*.la
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
gcc_movelibs() {
|
||||
LIBPATH=$(get_lib_dir) # cros to Gentoo glue
|
||||
|
||||
local multiarg removedirs=""
|
||||
for multiarg in $($(XGCC) -print-multi-lib) ; do
|
||||
multiarg=${multiarg#*;}
|
||||
multiarg=${multiarg//@/ -}
|
||||
|
||||
local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
|
||||
local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
|
||||
local TODIR=${D}${LIBPATH}/${MULTIDIR}
|
||||
local FROMDIR=
|
||||
|
||||
[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
|
||||
|
||||
for FROMDIR in \
|
||||
${LIBPATH}/${OS_MULTIDIR} \
|
||||
${LIBPATH}/../${MULTIDIR} \
|
||||
${PREFIX}/lib/${OS_MULTIDIR} \
|
||||
${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
|
||||
do
|
||||
removedirs="${removedirs} ${FROMDIR}"
|
||||
FROMDIR=${D}${FROMDIR}
|
||||
if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
|
||||
local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
|
||||
if [[ -n ${files} ]] ; then
|
||||
mv ${files} "${TODIR}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
|
||||
done
|
||||
|
||||
# We remove directories separately to avoid this case:
|
||||
# mv SRC/lib/../lib/*.o DEST
|
||||
# rmdir SRC/lib/../lib/
|
||||
# mv SRC/lib/../lib32/*.o DEST # Bork
|
||||
for FROMDIR in ${removedirs} ; do
|
||||
rmdir "${D}"${FROMDIR} >& /dev/null
|
||||
done
|
||||
find "${D}" -type d | xargs rmdir >& /dev/null
|
||||
}
|
@ -1,546 +0,0 @@
|
||||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.4.3-r3.ebuild,v 1.1 2010/06/19 01:53:09 zorry Exp $
|
||||
|
||||
EAPI=1
|
||||
CROS_WORKON_LOCALNAME=gcc
|
||||
CROS_WORKON_PROJECT=chromiumos/third_party/gcc
|
||||
|
||||
inherit eutils cros-workon binutils-funcs
|
||||
|
||||
GCC_FILESDIR="${PORTDIR}/sys-devel/gcc/files"
|
||||
|
||||
DESCRIPTION="The GNU Compiler Collection. Includes C/C++, java compilers, pie+ssp extensions, Haj Ten Brugge runtime bounds checking. This Compiler is based off of Crosstoolv14."
|
||||
|
||||
LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
|
||||
KEYWORDS="~amd64 ~arm ~x86"
|
||||
|
||||
RDEPEND=">=sys-libs/zlib-1.1.4
|
||||
>=sys-devel/gcc-config-1.6
|
||||
virtual/libiconv
|
||||
>=dev-libs/gmp-4.2.1
|
||||
>=dev-libs/mpc-0.8.1
|
||||
>=dev-libs/mpfr-2.3.2
|
||||
graphite? (
|
||||
>=dev-libs/ppl-0.10
|
||||
>=dev-libs/cloog-ppl-0.15.4
|
||||
)
|
||||
!build? (
|
||||
gcj? (
|
||||
gtk? (
|
||||
x11-libs/libXt
|
||||
x11-libs/libX11
|
||||
x11-libs/libXtst
|
||||
x11-proto/xproto
|
||||
x11-proto/xextproto
|
||||
>=x11-libs/gtk+-2.2
|
||||
x11-libs/pango
|
||||
)
|
||||
>=media-libs/libart_lgpl-2.1
|
||||
app-arch/zip
|
||||
app-arch/unzip
|
||||
)
|
||||
>=sys-libs/ncurses-5.2-r2
|
||||
nls? ( sys-devel/gettext )
|
||||
)"
|
||||
DEPEND="${RDEPEND}
|
||||
test? ( >=dev-util/dejagnu-1.4.4 >=sys-devel/autogen-5.5.4 )
|
||||
>=sys-apps/texinfo-4.8
|
||||
>=sys-devel/bison-1.875
|
||||
elibc_glibc? ( >=sys-libs/glibc-2.8 )
|
||||
amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )
|
||||
ppc? ( >=${CATEGORY}/binutils-2.17 )
|
||||
ppc64? ( >=${CATEGORY}/binutils-2.17 )
|
||||
>=${CATEGORY}/binutils-2.15.94"
|
||||
PDEPEND=">=sys-devel/gcc-config-1.4"
|
||||
if [[ ${CATEGORY} != cross-* ]] ; then
|
||||
PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
|
||||
fi
|
||||
|
||||
RESTRICT="mirror strip"
|
||||
|
||||
IUSE="gcj git_gcc graphite gtk hardened hardfp mounted_gcc multilib multislot
|
||||
nls cxx openmp tests +thumb upstream_gcc vanilla +wrapper_ccache"
|
||||
|
||||
is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] ; }
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
if [[ ${CTARGET} = ${CHOST} ]] ; then
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
|
||||
if use multislot ; then
|
||||
SLOT="${CTARGET}-${PV}"
|
||||
else
|
||||
SLOT="${CTARGET}"
|
||||
fi
|
||||
|
||||
PREFIX=/usr
|
||||
|
||||
src_unpack() {
|
||||
if use mounted_gcc ; then
|
||||
if [[ ! -d "$(get_gcc_dir)" ]] ; then
|
||||
die "gcc dir not mounted/present at: $(get_gcc_dir)"
|
||||
fi
|
||||
elif use upstream_gcc ; then
|
||||
GCC_MIRROR=ftp://mirrors.kernel.org/gnu/gcc
|
||||
GCC_TARBALL=${GCC_MIRROR}/${P}/${P}.tar.bz2
|
||||
wget $GCC_TARBALL
|
||||
tar xf ${GCC_TARBALL##*/}
|
||||
elif use git_gcc ; then
|
||||
git clone "${CROS_WORKON_REPO}/${CROS_WORKON_PROJECT}.git" "${S}"
|
||||
if [[ -n ${GCC_GITHASH} ]] ; then
|
||||
einfo "Checking out: ${GCC_GITHASH}"
|
||||
pushd "$(get_gcc_dir)" >/dev/null
|
||||
git checkout ${GCC_GITHASH} || \
|
||||
die "Couldn't checkout ${GCC_GITHASH}"
|
||||
popd >/dev/null
|
||||
fi
|
||||
else
|
||||
cros-workon_src_unpack
|
||||
cd "${S}"
|
||||
[[ ${ABI} == "x32" ]] && epatch "${FILESDIR}"/90_all_gcc-4.7-x32.patch
|
||||
fi
|
||||
|
||||
COST_PKG_VERSION="$("${FILESDIR}"/chromeos-version.sh "${S}")_cos_gg"
|
||||
|
||||
if [[ -d ${S}/.git ]]; then
|
||||
COST_PKG_VERSION+="_$(cd ${S}; git describe --always)"
|
||||
elif [[ -n ${VCSID} ]]; then
|
||||
COST_PKG_VERSION+="_${VCSID}"
|
||||
fi
|
||||
}
|
||||
|
||||
src_compile()
|
||||
{
|
||||
src_configure
|
||||
cd $(get_gcc_build_dir) || "Build dir $(get_gcc_build_dir) not found"
|
||||
GCC_CFLAGS="$(portageq envvar CFLAGS)"
|
||||
TARGET_FLAGS=""
|
||||
|
||||
if use hardened
|
||||
then
|
||||
TARGET_FLAGS="${TARGET_FLAGS} -fstack-protector-strong -D_FORTIFY_SOURCE=2"
|
||||
fi
|
||||
|
||||
# Do not link libgcc with gold. That is known to fail on internal linker
|
||||
# errors. See crosbug.com/16719
|
||||
local LD_NON_GOLD="$(get_binutils_path_ld ${CTARGET})/ld"
|
||||
|
||||
emake CFLAGS="${GCC_CFLAGS}" \
|
||||
LDFLAGS="-Wl,-O1" \
|
||||
STAGE1_CFLAGS="-O2 -pipe" \
|
||||
BOOT_CFLAGS="-O2" \
|
||||
CFLAGS_FOR_TARGET="$(get_make_var CFLAGS_FOR_TARGET) ${TARGET_FLAGS}" \
|
||||
CXXFLAGS_FOR_TARGET="$(get_make_var CXXFLAGS_FOR_TARGET) ${TARGET_FLAGS}" \
|
||||
LD_FOR_TARGET="${LD_NON_GOLD}" \
|
||||
all || die
|
||||
}
|
||||
|
||||
# Logic copied from Gentoo's toolchain.eclass.
|
||||
toolchain_src_install() {
|
||||
BINPATH=$(get_bin_dir) # cros to Gentoo glue
|
||||
|
||||
# These should be symlinks
|
||||
dodir /usr/bin
|
||||
cd "${D}"${BINPATH}
|
||||
for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
|
||||
# For some reason, g77 gets made instead of ${CTARGET}-g77...
|
||||
# this should take care of that
|
||||
[[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
|
||||
|
||||
if [[ -f ${CTARGET}-${x} ]] ; then
|
||||
if ! is_crosscompile ; then
|
||||
ln -sf ${CTARGET}-${x} ${x}
|
||||
dosym ${BINPATH}/${CTARGET}-${x} \
|
||||
/usr/bin/${x}-${GCC_CONFIG_VER}
|
||||
fi
|
||||
|
||||
# Create version-ed symlinks
|
||||
dosym ${BINPATH}/${CTARGET}-${x} \
|
||||
/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
|
||||
fi
|
||||
|
||||
if [[ -f ${CTARGET}-${x}-${GCC_CONFIG_VER} ]] ; then
|
||||
rm -f ${CTARGET}-${x}-${GCC_CONFIG_VER}
|
||||
ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
src_install()
|
||||
{
|
||||
cd $(get_gcc_build_dir) || "Build dir $(get_gcc_build_dir) not found"
|
||||
emake DESTDIR="${D}" install || die "Could not install gcc"
|
||||
|
||||
find "${D}" -name libiberty.a -exec rm -f "{}" \;
|
||||
|
||||
# Move the libraries to the proper location
|
||||
gcc_movelibs
|
||||
|
||||
# Move pretty-printers to gdb datadir to shut ldconfig up
|
||||
gcc_move_pretty_printers
|
||||
|
||||
GCC_CONFIG_VER=$(get_gcc_base_ver)
|
||||
dodir /etc/env.d/gcc
|
||||
insinto /etc/env.d/gcc
|
||||
|
||||
local LDPATH=$(get_lib_dir)
|
||||
for SUBDIR in 32 64 ; do
|
||||
if [[ -d ${D}/${LDPATH}/${SUBDIR} ]]
|
||||
then
|
||||
LDPATH="${LDPATH}:${LDPATH}/${SUBDIR}"
|
||||
fi
|
||||
done
|
||||
|
||||
cat <<-EOF > env.d
|
||||
LDPATH="${LDPATH}"
|
||||
MANPATH="$(get_data_dir)/man"
|
||||
INFOPATH="$(get_data_dir)/info"
|
||||
STDCXX_INCDIR="$(get_stdcxx_incdir)"
|
||||
CTARGET=${CTARGET}
|
||||
GCC_PATH="$(get_bin_dir)"
|
||||
GCC_VER="$(get_gcc_base_ver)"
|
||||
EOF
|
||||
newins env.d $(get_gcc_config_file)
|
||||
cd -
|
||||
|
||||
toolchain_src_install
|
||||
|
||||
if is_crosscompile ; then
|
||||
if use hardened
|
||||
then
|
||||
SYSROOT_WRAPPER_FILE=sysroot_wrapper.hardened
|
||||
else
|
||||
SYSROOT_WRAPPER_FILE=sysroot_wrapper
|
||||
fi
|
||||
|
||||
exeinto "$(get_bin_dir)"
|
||||
doexe "${FILESDIR}/${SYSROOT_WRAPPER_FILE}" || die
|
||||
sed -i \
|
||||
-e "/^use_ccache = .*@CCACHE_DEFAULT@/s:=[^#]*:= $(usex wrapper_ccache True False) :" \
|
||||
"${D}$(get_bin_dir)/${SYSROOT_WRAPPER_FILE}" || die
|
||||
for x in c++ cpp g++ gcc; do
|
||||
if [[ -f "${CTARGET}-${x}" ]]; then
|
||||
mv "${CTARGET}-${x}" "${CTARGET}-${x}.real"
|
||||
dosym "${SYSROOT_WRAPPER_FILE}" "$(get_bin_dir)/${CTARGET}-${x}" || die
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if use tests
|
||||
then
|
||||
TEST_INSTALL_DIR="usr/local/dejagnu/gcc"
|
||||
dodir ${TEST_INSTALL_DIR}
|
||||
cd ${D}/${TEST_INSTALL_DIR}
|
||||
tar -czf "tests.tar.gz" ${WORKDIR}
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preinst()
|
||||
{
|
||||
# We handle ccache ourselves in the sysroot wrapper.
|
||||
rm -f /usr/lib/ccache/bin/*-*
|
||||
|
||||
local ccache_dir="/var/cache/distfiles/ccache"
|
||||
local vcsid_file="${ccache_dir}/.gcc.vcsid.${CTARGET}"
|
||||
# Clean out the ccache whenever the gcc code changes.
|
||||
# If we are using a live ebuild, nuke it everytime just
|
||||
# to be safe.
|
||||
[[ ${PV} == "9999" ]] && rm -f "${vcsid_file}"
|
||||
local old_vcsid=$(cat "${vcsid_file}" 2>/dev/null)
|
||||
if [[ ${old_vcsid} != ${CROS_WORKON_COMMIT} ]] ; then
|
||||
# Don't just delete the whole dir as that would punt
|
||||
# the vcsid tag files from other targets too.
|
||||
rm -rf "${ccache_dir}"/*
|
||||
fi
|
||||
mkdir -p -m 2775 "${ccache_dir}"
|
||||
echo "${CROS_WORKON_COMMIT}" > "${vcsid_file}"
|
||||
|
||||
# Use a 10G limit as our bots have finite resources. A full
|
||||
# x86-generic build uses ~6GB, while an amd64-generic uses
|
||||
# ~8GB, so this limit should be sufficient.
|
||||
CCACHE_UMASK=002 CCACHE_DIR=${ccache_dir} ccache -F 0 -M 11G
|
||||
|
||||
# Make sure the dirs have perms for emerge builders.
|
||||
chown -R ${PORTAGE_USERNAME}:portage "${ccache_dir}"
|
||||
}
|
||||
|
||||
pkg_postinst()
|
||||
{
|
||||
gcc-config $(get_gcc_config_file)
|
||||
}
|
||||
|
||||
pkg_postrm()
|
||||
{
|
||||
if is_crosscompile ; then
|
||||
if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
|
||||
rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
|
||||
rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
|
||||
rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure()
|
||||
{
|
||||
if use mounted_gcc && [[ -f $(get_gcc_build_dir)/Makefile ]] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Set configuration based on path variables
|
||||
local DATAPATH=$(get_data_dir)
|
||||
local confgcc="$(use_enable multilib)
|
||||
--prefix=${PREFIX} \
|
||||
--bindir=$(get_bin_dir) \
|
||||
--datadir=${DATAPATH} \
|
||||
--mandir=${DATAPATH}/man \
|
||||
--infodir=${DATAPATH}/info \
|
||||
--includedir=$(get_lib_dir)/include \
|
||||
--with-gxx-include-dir=$(get_stdcxx_incdir)
|
||||
--with-python-dir=${DATAPATH#${PREFIX}}/python"
|
||||
confgcc="${confgcc} --host=${CHOST}"
|
||||
confgcc="${confgcc} --target=${CTARGET}"
|
||||
confgcc="${confgcc} --build=${CBUILD}"
|
||||
|
||||
# Language options for stage1/stage2.
|
||||
if ! use cxx
|
||||
then
|
||||
GCC_LANG="c"
|
||||
else
|
||||
GCC_LANG="c,c++"
|
||||
fi
|
||||
confgcc="${confgcc} --enable-languages=${GCC_LANG}"
|
||||
|
||||
if use hardfp && [[ ${CTARGET} == arm* ]] ;
|
||||
then
|
||||
confgcc="${confgcc} --with-float=hard"
|
||||
fi
|
||||
|
||||
if use thumb && [[ ${CTARGET} == arm* ]] ;
|
||||
then
|
||||
confgcc="${confgcc} --with-mode=thumb"
|
||||
fi
|
||||
|
||||
if is_crosscompile ; then
|
||||
local needed_libc="glibc"
|
||||
if [[ -n ${needed_libc} ]] ; then
|
||||
if ! has_version ${CATEGORY}/${needed_libc} ; then
|
||||
confgcc="${confgcc} --disable-shared --disable-threads --without-headers"
|
||||
elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
|
||||
confgcc="${confgcc} --disable-shared --with-sysroot=/usr/${CTARGET}"
|
||||
else
|
||||
confgcc="${confgcc} --with-sysroot=/usr/${CTARGET}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
confgcc="${confgcc} --enable-shared --enable-threads=posix"
|
||||
fi
|
||||
|
||||
confgcc="${confgcc} $(get_gcc_configure_options ${CTARGET})"
|
||||
|
||||
EXTRA_ECONF="--with-bugurl=http://code.google.com/p/chromium-os/issues/entry\
|
||||
--with-pkgversion=${COST_PKG_VERSION} --enable-linker-build-id"
|
||||
confgcc="${confgcc} ${EXTRA_ECONF}"
|
||||
|
||||
# Build in a separate build tree
|
||||
mkdir -p $(get_gcc_build_dir) || \
|
||||
die "Could not create build dir $(get_gcc_build_dir)"
|
||||
cd $(get_gcc_build_dir) || die "Build dir $(get_gcc_build_dir) not found"
|
||||
|
||||
# and now to do the actual configuration
|
||||
addwrite /dev/zero
|
||||
echo "Running this:"
|
||||
echo "configure ${confgcc}"
|
||||
echo "$(get_gcc_dir)"/configure "$@"
|
||||
"$(get_gcc_dir)"/configure ${confgcc} || die "failed to run configure"
|
||||
}
|
||||
|
||||
get_gcc_configure_options()
|
||||
{
|
||||
local CTARGET=$1; shift
|
||||
local confgcc=$(get_gcc_common_options)
|
||||
case ${CTARGET} in
|
||||
arm*) #264534
|
||||
local arm_arch="${CTARGET%%-*}"
|
||||
# Only do this if arm_arch is armv*
|
||||
if [[ ${arm_arch} == armv* ]] ; then
|
||||
# Convert armv7{a,r,m} to armv7-{a,r,m}
|
||||
[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
|
||||
# Remove endian ('l' / 'eb')
|
||||
[[ ${arm_arch} == *l ]] && arm_arch=${arm_arch%l}
|
||||
[[ ${arm_arch} == *eb ]] && arm_arch=${arm_arch%eb}
|
||||
confgcc="${confgcc} --with-arch=${arm_arch}"
|
||||
confgcc="${confgcc} --disable-esp"
|
||||
fi
|
||||
;;
|
||||
i?86*)
|
||||
# Hardened is enabled for x86, but disabled for ARM.
|
||||
confgcc="${confgcc} --enable-esp"
|
||||
confgcc="${confgcc} --with-arch=atom"
|
||||
confgcc="${confgcc} --with-tune=atom"
|
||||
# Remove this once crash2 supports larger symbols.
|
||||
# http://code.google.com/p/chromium-os/issues/detail?id=23321
|
||||
confgcc="${confgcc} --enable-frame-pointer"
|
||||
;;
|
||||
x86_64*-gnux32)
|
||||
confgcc="${confgcc} --with-abi=x32 --with-multilib-list=mx32"
|
||||
;;
|
||||
esac
|
||||
echo ${confgcc}
|
||||
}
|
||||
|
||||
get_gcc_common_options()
|
||||
{
|
||||
local confgcc
|
||||
confgcc="${confgcc} --disable-libmudflap"
|
||||
confgcc="${confgcc} --disable-libssp"
|
||||
confgcc+=" $(use_enable openmp libgomp)"
|
||||
confgcc="${confgcc} --enable-__cxa_atexit"
|
||||
confgcc="${confgcc} --enable-checking=release"
|
||||
confgcc="${confgcc} --disable-libquadmath"
|
||||
echo ${confgcc}
|
||||
}
|
||||
|
||||
get_gcc_dir()
|
||||
{
|
||||
local GCCDIR
|
||||
if use mounted_gcc ; then
|
||||
GCCDIR=${GCC_SOURCE_PATH:=/usr/local/toolchain_root/gcc}
|
||||
elif use upstream_gcc ; then
|
||||
GCCDIR=${P}
|
||||
else
|
||||
GCCDIR=${S}
|
||||
fi
|
||||
echo "${GCCDIR}"
|
||||
}
|
||||
|
||||
get_gcc_build_dir()
|
||||
{
|
||||
echo "$(get_gcc_dir)-build-${CTARGET}"
|
||||
}
|
||||
|
||||
get_gcc_base_ver()
|
||||
{
|
||||
cat "$(get_gcc_dir)/gcc/BASE-VER"
|
||||
}
|
||||
|
||||
get_stdcxx_incdir()
|
||||
{
|
||||
echo "$(get_lib_dir)/include/g++-v4"
|
||||
}
|
||||
|
||||
get_lib_dir()
|
||||
{
|
||||
echo "${PREFIX}/lib/gcc/${CTARGET}/$(get_gcc_base_ver)"
|
||||
}
|
||||
|
||||
get_bin_dir()
|
||||
{
|
||||
if is_crosscompile ; then
|
||||
echo ${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/$(get_gcc_base_ver)
|
||||
else
|
||||
echo ${PREFIX}/${CTARGET}/gcc-bin/$(get_gcc_base_ver)
|
||||
fi
|
||||
}
|
||||
|
||||
get_data_dir()
|
||||
{
|
||||
echo "${PREFIX}/share/gcc-data/${CTARGET}/$(get_gcc_base_ver)"
|
||||
}
|
||||
|
||||
get_gcc_config_file()
|
||||
{
|
||||
echo ${CTARGET}-${PV}
|
||||
}
|
||||
|
||||
# Grab a variable from the build system (taken from linux-info.eclass)
|
||||
get_make_var() {
|
||||
local var=$1 makefile=${2:-$(get_gcc_build_dir)/Makefile}
|
||||
echo -e "e:\\n\\t@echo \$(${var})\\ninclude ${makefile}" | \
|
||||
r=${makefile%/*} emake --no-print-directory -s -f - 2>/dev/null
|
||||
}
|
||||
XGCC() { get_make_var GCC_FOR_TARGET ; }
|
||||
|
||||
gcc_move_pretty_printers() {
|
||||
LIBPATH=$(get_lib_dir) # cros to Gentoo glue
|
||||
|
||||
local py gdbdir=/usr/share/gdb/auto-load${LIBPATH}
|
||||
pushd "${D}"${LIBPATH} >/dev/null
|
||||
for py in $(find . -name '*-gdb.py') ; do
|
||||
local multidir=${py%/*}
|
||||
insinto "${gdbdir}/${multidir}"
|
||||
sed -i "/^libdir =/s:=.*:= '${LIBPATH}/${multidir}':" "${py}" || die #348128
|
||||
doins "${py}" || die
|
||||
rm "${py}" || die
|
||||
done
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
# make sure the libtool archives have libdir set to where they actually
|
||||
# -are-, and not where they -used- to be. also, any dependencies we have
|
||||
# on our own .la files need to be updated.
|
||||
fix_libtool_libdir_paths() {
|
||||
pushd "${D}" >/dev/null
|
||||
|
||||
pushd "./${1}" >/dev/null
|
||||
local dir="${PWD#${D%/}}"
|
||||
local allarchives=$(echo *.la)
|
||||
allarchives="\(${allarchives// /\\|}\)"
|
||||
popd >/dev/null
|
||||
|
||||
sed -i \
|
||||
-e "/^libdir=/s:=.*:='${dir}':" \
|
||||
./${dir}/*.la
|
||||
sed -i \
|
||||
-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \
|
||||
$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
|
||||
./${dir}/*.la
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
gcc_movelibs() {
|
||||
LIBPATH=$(get_lib_dir) # cros to Gentoo glue
|
||||
|
||||
local multiarg removedirs=""
|
||||
for multiarg in $($(XGCC) -print-multi-lib) ; do
|
||||
multiarg=${multiarg#*;}
|
||||
multiarg=${multiarg//@/ -}
|
||||
|
||||
local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
|
||||
local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
|
||||
local TODIR=${D}${LIBPATH}/${MULTIDIR}
|
||||
local FROMDIR=
|
||||
|
||||
[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
|
||||
|
||||
for FROMDIR in \
|
||||
${LIBPATH}/${OS_MULTIDIR} \
|
||||
${LIBPATH}/../${MULTIDIR} \
|
||||
${PREFIX}/lib/${OS_MULTIDIR} \
|
||||
${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
|
||||
do
|
||||
removedirs="${removedirs} ${FROMDIR}"
|
||||
FROMDIR=${D}${FROMDIR}
|
||||
if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
|
||||
local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
|
||||
if [[ -n ${files} ]] ; then
|
||||
mv ${files} "${TODIR}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
|
||||
done
|
||||
|
||||
# We remove directories separately to avoid this case:
|
||||
# mv SRC/lib/../lib/*.o DEST
|
||||
# rmdir SRC/lib/../lib/
|
||||
# mv SRC/lib/../lib32/*.o DEST # Bork
|
||||
for FROMDIR in ${removedirs} ; do
|
||||
rmdir "${D}"${FROMDIR} >& /dev/null
|
||||
done
|
||||
find "${D}" -type d | xargs rmdir >& /dev/null
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
DIST gdb-7.1-patches-1.tar.lzma 9207 RMD160 61d829abcfe7186f679ead31540fc9c2c9f0aad9 SHA1 35ca21761d451481a1ff0caa12c95eb9eb0f4e67 SHA256 d2efe1ee66110e4e0c55bbe4365380bdb6e159c45ea849a1e329ac293b4e7e3c
|
||||
DIST gdb-7.1.tar.bz2 17977195 RMD160 800d224496240a360c996e588490f2d87367c4e3 SHA1 417e2e637a296ea0e1cdddf56233311b8708fa19 SHA256 142c27d7970a4e652dc225d61d887777ae00cf22fdd75cd1e8e4e13bfbd85352
|
@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
#
|
||||
# This script is given one argument: the base of the source directory of
|
||||
# the package, and it prints a string on stdout with the numerical version
|
||||
# number for said repo.
|
||||
|
||||
exec sed 's:-gg:_p:' "$1"/gdb/version.in
|
@ -1,150 +0,0 @@
|
||||
# Copyright 1999-2011 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-devel/gdb/gdb-9999.ebuild,v 1.3 2011/08/23 16:21:56 vapier Exp $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
inherit flag-o-matic eutils
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
if [[ ${CTARGET} == ${CHOST} ]] ; then
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
|
||||
|
||||
RPM=
|
||||
MY_PV=${PV}
|
||||
case ${PV} in
|
||||
*.*.*.*.*.*)
|
||||
# fedora version: gdb-6.8.50.20090302-8.fc11.src.rpm
|
||||
inherit versionator rpm
|
||||
gvcr() { get_version_component_range "$@"; }
|
||||
MY_PV=$(gvcr 1-4)
|
||||
RPM="${PN}-${MY_PV}-$(gvcr 5).fc$(gvcr 6).src.rpm"
|
||||
SRC_URI="mirror://fedora/development/source/SRPMS/${RPM}"
|
||||
;;
|
||||
*.*.50.*)
|
||||
# weekly snapshots
|
||||
SRC_URI="ftp://sources.redhat.com/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
|
||||
;;
|
||||
7.2 | 9999*)
|
||||
# live git tree
|
||||
EGIT_REPO_URI="http://git.chromium.org/chromiumos/third_party/gdb.git"
|
||||
EGIT_COMMIT=c4aa8d2c86b0fbfd969fd80fbc91727740a2dd27
|
||||
inherit git
|
||||
SRC_URI=""
|
||||
;;
|
||||
*)
|
||||
# Normal upstream release
|
||||
SRC_URI="http://ftp.gnu.org/gnu/gdb/${P}.tar.bz2
|
||||
ftp://sources.redhat.com/pub/gdb/releases/${P}.tar.bz2"
|
||||
;;
|
||||
esac
|
||||
|
||||
PATCH_VER=""
|
||||
DESCRIPTION="GNU debugger"
|
||||
HOMEPAGE="http://sourceware.org/gdb/"
|
||||
SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
|
||||
|
||||
LICENSE="GPL-2 LGPL-2"
|
||||
is_cross \
|
||||
&& SLOT="${CTARGET}" \
|
||||
|| SLOT="0"
|
||||
if [[ ${PV} != 9999* ]] ; then
|
||||
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~x86-fbsd"
|
||||
fi
|
||||
IUSE="expat multitarget nls python test vanilla mounted_sources"
|
||||
|
||||
RDEPEND=">=sys-libs/ncurses-5.2-r2
|
||||
sys-libs/readline
|
||||
expat? ( dev-libs/expat )
|
||||
python? ( =dev-lang/python-2* )"
|
||||
DEPEND="${RDEPEND}
|
||||
app-arch/xz-utils
|
||||
virtual/yacc
|
||||
test? ( dev-util/dejagnu )
|
||||
nls? ( sys-devel/gettext )"
|
||||
|
||||
S=${WORKDIR}/${PN}-${MY_PV}
|
||||
|
||||
src_unpack () {
|
||||
if use mounted_sources ; then
|
||||
: ${GDBDIR:=/usr/local/toolchain_root/gdb/gdb-7.2.x}
|
||||
if [[ ! -d ${GDBDIR} ]] ; then
|
||||
die "gdb dir not mounted/present at: ${GDBDIR}"
|
||||
fi
|
||||
cp -R ${GDBDIR} ${S}
|
||||
else
|
||||
git_src_unpack
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
[[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
|
||||
use vanilla || [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
|
||||
strip-linguas -u bfd/po opcodes/po
|
||||
}
|
||||
|
||||
gdb_branding() {
|
||||
printf "Gentoo ${PV} "
|
||||
if [[ -n ${PATCH_VER} ]] ; then
|
||||
printf "p${PATCH_VER}"
|
||||
else
|
||||
printf "vanilla"
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
strip-unsupported-flags
|
||||
econf \
|
||||
--with-pkgversion="$(gdb_branding)" \
|
||||
--with-bugurl='http://bugs.gentoo.org/' \
|
||||
--disable-werror \
|
||||
--enable-64-bit-bfd \
|
||||
--with-system-readline \
|
||||
--with-separate-debug-dir=/usr/lib/debug \
|
||||
$(is_cross && echo --with-sysroot=/usr/${CTARGET}) \
|
||||
$(use_with expat) \
|
||||
$(use_enable nls) \
|
||||
$(use multitarget && echo --enable-targets=all) \
|
||||
$(use_with python python "${EPREFIX}/usr/bin/python2")
|
||||
}
|
||||
|
||||
src_test() {
|
||||
emake check || ewarn "tests failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake \
|
||||
DESTDIR="${D}" \
|
||||
{include,lib}dir=/nukeme/pretty/pretty/please \
|
||||
install || die
|
||||
rm -r "${D}"/nukeme || die
|
||||
|
||||
# Don't install docs when building a cross-gdb
|
||||
if [[ ${CTARGET} != ${CHOST} ]] ; then
|
||||
rm -r "${D}"/usr/share
|
||||
return 0
|
||||
fi
|
||||
|
||||
dodoc README
|
||||
docinto gdb
|
||||
dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
|
||||
gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
|
||||
docinto sim
|
||||
dodoc sim/ChangeLog sim/MAINTAINERS sim/README-HACKING
|
||||
|
||||
if [[ -n ${PATCH_VER} ]] ; then
|
||||
dodoc "${WORKDIR}"/extra/gdbinit.sample
|
||||
fi
|
||||
|
||||
# Remove shared info pages
|
||||
rm -f "${D}"/usr/share/info/{annotate,bfd,configure,standards}.info*
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
# portage sucks and doesnt unmerge files in /etc
|
||||
rm -vf "${ROOT}"/etc/skel/.gdbinit
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
# Copyright 1999-2011 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-devel/gdb/gdb-9999.ebuild,v 1.3 2011/08/23 16:21:56 vapier Exp $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
inherit flag-o-matic eutils
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
if [[ ${CTARGET} == ${CHOST} ]] ; then
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
|
||||
|
||||
RPM=
|
||||
MY_PV=${PV}
|
||||
case ${PV} in
|
||||
*.*.*.*.*.*)
|
||||
# fedora version: gdb-6.8.50.20090302-8.fc11.src.rpm
|
||||
inherit versionator rpm
|
||||
gvcr() { get_version_component_range "$@"; }
|
||||
MY_PV=$(gvcr 1-4)
|
||||
RPM="${PN}-${MY_PV}-$(gvcr 5).fc$(gvcr 6).src.rpm"
|
||||
SRC_URI="mirror://fedora/development/source/SRPMS/${RPM}"
|
||||
;;
|
||||
*.*.50.*)
|
||||
# weekly snapshots
|
||||
SRC_URI="ftp://sources.redhat.com/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.bz2"
|
||||
;;
|
||||
*)
|
||||
# live git tree
|
||||
EGIT_REPO_URI="http://git.chromium.org/chromiumos/third_party/gdb.git"
|
||||
EGIT_COMMIT=c4aa8d2c86b0fbfd969fd80fbc91727740a2dd27
|
||||
inherit git
|
||||
SRC_URI=""
|
||||
;;
|
||||
*)
|
||||
# Normal upstream release
|
||||
SRC_URI="http://ftp.gnu.org/gnu/gdb/${P}.tar.bz2
|
||||
ftp://sources.redhat.com/pub/gdb/releases/${P}.tar.bz2"
|
||||
;;
|
||||
esac
|
||||
|
||||
PATCH_VER=""
|
||||
DESCRIPTION="GNU debugger"
|
||||
HOMEPAGE="http://sourceware.org/gdb/"
|
||||
SRC_URI="${SRC_URI} ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz}"
|
||||
|
||||
LICENSE="GPL-2 LGPL-2"
|
||||
is_cross \
|
||||
&& SLOT="${CTARGET}" \
|
||||
|| SLOT="0"
|
||||
if [[ ${PV} != 9999* ]] ; then
|
||||
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~x86-fbsd"
|
||||
fi
|
||||
IUSE="expat multitarget nls python test vanilla mounted_sources"
|
||||
|
||||
RDEPEND=">=sys-libs/ncurses-5.2-r2
|
||||
sys-libs/readline
|
||||
expat? ( dev-libs/expat )
|
||||
python? ( =dev-lang/python-2* )"
|
||||
DEPEND="${RDEPEND}
|
||||
app-arch/xz-utils
|
||||
virtual/yacc
|
||||
test? ( dev-util/dejagnu )
|
||||
nls? ( sys-devel/gettext )"
|
||||
|
||||
S=${WORKDIR}/${PN}-${MY_PV}
|
||||
|
||||
src_unpack () {
|
||||
if use mounted_sources ; then
|
||||
: ${GDBDIR:=/usr/local/toolchain_root/gdb/gdb-7.2.x}
|
||||
if [[ ! -d ${GDBDIR} ]] ; then
|
||||
die "gdb dir not mounted/present at: ${GDBDIR}"
|
||||
fi
|
||||
cp -R ${GDBDIR} ${S}
|
||||
else
|
||||
git_src_unpack
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
[[ -n ${RPM} ]] && rpm_spec_epatch "${WORKDIR}"/gdb.spec
|
||||
use vanilla || [[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
|
||||
strip-linguas -u bfd/po opcodes/po
|
||||
}
|
||||
|
||||
gdb_branding() {
|
||||
printf "Gentoo ${PV} "
|
||||
if [[ -n ${PATCH_VER} ]] ; then
|
||||
printf "p${PATCH_VER}"
|
||||
else
|
||||
printf "vanilla"
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
strip-unsupported-flags
|
||||
econf \
|
||||
--with-pkgversion="$(gdb_branding)" \
|
||||
--with-bugurl='http://bugs.gentoo.org/' \
|
||||
--disable-werror \
|
||||
--enable-64-bit-bfd \
|
||||
--with-system-readline \
|
||||
--with-separate-debug-dir=/usr/lib/debug \
|
||||
$(is_cross && echo --with-sysroot=/usr/${CTARGET}) \
|
||||
$(use_with expat) \
|
||||
$(use_enable nls) \
|
||||
$(use multitarget && echo --enable-targets=all) \
|
||||
$(use_with python python "${EPREFIX}/usr/bin/python2")
|
||||
}
|
||||
|
||||
src_test() {
|
||||
emake check || ewarn "tests failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake \
|
||||
DESTDIR="${D}" \
|
||||
{include,lib}dir=/nukeme/pretty/pretty/please \
|
||||
install || die
|
||||
rm -r "${D}"/nukeme || die
|
||||
|
||||
# Don't install docs when building a cross-gdb
|
||||
if [[ ${CTARGET} != ${CHOST} ]] ; then
|
||||
rm -r "${D}"/usr/share
|
||||
return 0
|
||||
fi
|
||||
|
||||
dodoc README
|
||||
docinto gdb
|
||||
dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \
|
||||
gdb/NEWS gdb/ChangeLog gdb/PROBLEMS
|
||||
docinto sim
|
||||
dodoc sim/ChangeLog sim/MAINTAINERS sim/README-HACKING
|
||||
|
||||
if [[ -n ${PATCH_VER} ]] ; then
|
||||
dodoc "${WORKDIR}"/extra/gdbinit.sample
|
||||
fi
|
||||
|
||||
# Remove shared info pages
|
||||
rm -f "${D}"/usr/share/info/{annotate,bfd,configure,standards}.info*
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
# portage sucks and doesnt unmerge files in /etc
|
||||
rm -vf "${ROOT}"/etc/skel/.gdbinit
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
DIST gentoo-headers-3.4-1.tar.xz 3524 SHA256 96575df8c65d749b832880d41db4b694ccaa76a6386eef80e4e9cd123625bfee SHA512 29baad764311d100815c2572e1ba868cf75f0fbf8a1ae38e047daf729b305e059fb94a8c521b88735f5d4678316c314a191e066efa96263347c2c7612a5ab6ee WHIRLPOOL 0160261bc0397a101fefaf66c1e647d7696fe64203b288f358ff8448c49c22e4e37eae7411dde3c11decd578355c825c27bd959e41b209f029d688e184da784e
|
||||
DIST gentoo-headers-base-3.4.tar.xz 5115932 SHA256 c1aceea837dc6c05c869f41897e393cc14ef4b8b3e77440b40ae1684360fc154 SHA512 2400cb99d275c6d3be8fa9d3e5a4e2e1db9377227b1ae561ac3511659f10c7d1dc667d5fd5b43b9acde8d69bd299273b03b2413a98de70e6f79f0df210cf8ee2 WHIRLPOOL 5d0039e1bfdea386c20d58e84a170c69db48876fc31c09843dd48583c4fc095d15cc19a353c162b709536c8893740175ba86dca5c4e7322c36fa036cc510e50b
|
@ -1,50 +0,0 @@
|
||||
From eb12f7626253e47c8a3394bd07c8460d4775eae7 Mon Sep 17 00:00:00 2001
|
||||
From: Sean Paul <seanpaul@chromium.org>
|
||||
Date: Wed, 20 Jun 2012 11:39:22 -0400
|
||||
Subject: [PATCH] v4l: Add DMABUF as a memory type
|
||||
|
||||
Adds DMABUF memory type to v4l framework. Also adds the related file
|
||||
descriptor in v4l2_plane and v4l2_buffer.
|
||||
|
||||
Change-Id: If6b8d3e16bf487d87352008f9ac5d3bdad5ab732
|
||||
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
|
||||
[original work in the PoC for buffer sharing]
|
||||
Signed-off-by: Sumit Semwal <sumit.semwal@ti.com>
|
||||
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
|
||||
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
||||
Signed-off-by: Sean Paul <seanpaul@chromium.org>
|
||||
---
|
||||
include/linux/videodev2.h | 3 +++
|
||||
1 files changed, 3 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
|
||||
index 7915525..92a495d 100644
|
||||
--- a/include/linux/videodev2.h
|
||||
+++ b/include/linux/videodev2.h
|
||||
@@ -185,6 +185,7 @@ enum v4l2_memory {
|
||||
V4L2_MEMORY_MMAP = 1,
|
||||
V4L2_MEMORY_USERPTR = 2,
|
||||
V4L2_MEMORY_OVERLAY = 3,
|
||||
+ V4L2_MEMORY_DMABUF = 4,
|
||||
};
|
||||
|
||||
/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
|
||||
@@ -617,6 +618,7 @@ struct v4l2_plane {
|
||||
union {
|
||||
__u32 mem_offset;
|
||||
unsigned long userptr;
|
||||
+ int fd;
|
||||
} m;
|
||||
__u32 data_offset;
|
||||
__u32 reserved[11];
|
||||
@@ -667,6 +669,7 @@ struct v4l2_buffer {
|
||||
__u32 offset;
|
||||
unsigned long userptr;
|
||||
struct v4l2_plane *planes;
|
||||
+ int fd;
|
||||
} m;
|
||||
__u32 length;
|
||||
__u32 input;
|
||||
--
|
||||
1.7.7.3
|
||||
|
@ -1,48 +0,0 @@
|
||||
sheu@chromium.org: trimmed from 3.4 kernel patch
|
||||
|
||||
From e5b2998def807693aa5796112423117022318db2 Mon Sep 17 00:00:00 2001
|
||||
From: John Sheu <sheu@chromium.org>
|
||||
Date: Fri, 4 Jan 2013 19:08:53 -0800
|
||||
Subject: [PATCH] CHROMIUM: v4l2/exynos: move CID enums into videodev2.h
|
||||
|
||||
Move some #defines for V4L_CID_* values out of gsc-core.h and into
|
||||
videodev2.h, where they belong, as they are part of the userspace API.
|
||||
|
||||
Signed-off-by: John Sheu <sheu@google.com>
|
||||
|
||||
BUG=chromium-os:37294
|
||||
BUG=chrome-os-partner:10057
|
||||
TEST=local build, run on snow
|
||||
|
||||
Change-Id: Ib06cd97f8c294a0d5f42f0b2adfefe4d761b256f
|
||||
---
|
||||
drivers/media/video/exynos/gsc/gsc-core.h | 12 ------------
|
||||
include/linux/videodev2.h | 13 ++++++++++++-
|
||||
2 files changed, 12 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
|
||||
index 09f7f6d..405313f 100644
|
||||
--- a/include/linux/videodev2.h
|
||||
+++ b/include/linux/videodev2.h
|
||||
@@ -1342,6 +1342,18 @@ enum v4l2_colorfx {
|
||||
/* last CID + 1 */
|
||||
#define V4L2_CID_LASTP1 (V4L2_CID_BASE+42)
|
||||
|
||||
+#define V4L2_CID_CACHEABLE (V4L2_CID_LASTP1 + 1)
|
||||
+#define V4L2_CID_TV_LAYER_BLEND_ENABLE (V4L2_CID_LASTP1 + 2)
|
||||
+#define V4L2_CID_TV_LAYER_BLEND_ALPHA (V4L2_CID_LASTP1 + 3)
|
||||
+#define V4L2_CID_TV_PIXEL_BLEND_ENABLE (V4L2_CID_LASTP1 + 4)
|
||||
+#define V4L2_CID_TV_CHROMA_ENABLE (V4L2_CID_LASTP1 + 5)
|
||||
+#define V4L2_CID_TV_CHROMA_VALUE (V4L2_CID_LASTP1 + 6)
|
||||
+/* for color space conversion equation selection */
|
||||
+#define V4L2_CID_CSC_EQ_MODE (V4L2_CID_LASTP1 + 8)
|
||||
+#define V4L2_CID_CSC_EQ (V4L2_CID_LASTP1 + 9)
|
||||
+#define V4L2_CID_CSC_RANGE (V4L2_CID_LASTP1 + 10)
|
||||
+#define V4L2_CID_GLOBAL_ALPHA (V4L2_CID_LASTP1 + 11)
|
||||
+#define V4L2_CID_CODEC_DISPLAY_STATUS (V4L2_CID_LASTP1 + 12)
|
||||
|
||||
/* MPEG-class control IDs defined by V4L2 */
|
||||
#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
|
||||
--
|
||||
1.7.8.6
|
||||
|
@ -1,609 +0,0 @@
|
||||
sheu@chromium.org: trimmed from 3.4 kernel patch
|
||||
|
||||
From 122c0bd18b7df7d40e28be846d57eba291fae955 Mon Sep 17 00:00:00 2001
|
||||
From: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
|
||||
Date: Wed, 23 May 2012 10:21:26 +0100
|
||||
Subject: [PATCH] MFC: update MFC v4l2 driver to support MFC6.x
|
||||
|
||||
Multi Format Codec 6.x is a hardware video coding acceleration
|
||||
module fount in new Exynos5 SoC series.
|
||||
It is capable of handling a range of video codecs and this driver
|
||||
provides a V4L2 interface for video decoding and encoding.
|
||||
|
||||
Change-Id: I69854c51ef20599add4e17b5d4df338785b5432f
|
||||
Signed-off-by: Jeongtae Park <jtp.park@xxxxxxxxxxx>
|
||||
Singed-off-by: Janghyuck Kim <janghyuck.kim@xxxxxxxxxxx>
|
||||
Singed-off-by: Jaeryul Oh <jaeryul.oh@xxxxxxxxxxx>
|
||||
Cc: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
|
||||
Cc: Kamil Debski <k.debski@xxxxxxxxxxx>
|
||||
---
|
||||
drivers/media/video/Kconfig | 26 +-
|
||||
drivers/media/video/s5p-mfc/Makefile | 7 +-
|
||||
drivers/media/video/s5p-mfc/regs-mfc-v6.h | 671 ++++++++++
|
||||
drivers/media/video/s5p-mfc/regs-mfc.h | 29 +
|
||||
drivers/media/video/s5p-mfc/s5p_mfc.c | 192 ++-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_cmd.c | 4 +-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_cmd.h | 3 +
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_cmd_v6.c | 130 ++
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_common.h | 125 ++-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c | 161 ++-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_dec.c | 237 +++-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_dec.h | 1 +
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 374 +++++--
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_enc.h | 1 +
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_opr.c | 266 +++--
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_opr.h | 20 +-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.c | 1677 ++++++++++++++++++++++++++
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.h | 137 +++
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_pm.c | 6 +-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_shm.c | 27 +-
|
||||
drivers/media/video/s5p-mfc/s5p_mfc_shm.h | 13 +-
|
||||
include/linux/videodev2.h | 364 +++++-
|
||||
22 files changed, 4015 insertions(+), 456 deletions(-)
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/Makefile
|
||||
create mode 100644 drivers/media/video/s5p-mfc/regs-mfc-v6.h
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/regs-mfc.h
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/s5p_mfc.c
|
||||
create mode 100644 drivers/media/video/s5p-mfc/s5p_mfc_cmd_v6.c
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/s5p_mfc_common.h
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/s5p_mfc_dec.c
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/s5p_mfc_enc.c
|
||||
create mode 100755 drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.c
|
||||
create mode 100644 drivers/media/video/s5p-mfc/s5p_mfc_opr_v6.h
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/s5p_mfc_pm.c
|
||||
mode change 100644 => 100755 drivers/media/video/s5p-mfc/s5p_mfc_shm.h
|
||||
|
||||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
|
||||
index 320ce9c..a58bdd1 100644
|
||||
--- a/include/linux/videodev2.h
|
||||
+++ b/include/linux/videodev2.h
|
||||
@@ -289,12 +289,12 @@ struct v4l2_capability {
|
||||
* V I D E O I M A G E F O R M A T
|
||||
*/
|
||||
struct v4l2_pix_format {
|
||||
- __u32 width;
|
||||
+ __u32 width;
|
||||
__u32 height;
|
||||
__u32 pixelformat;
|
||||
- enum v4l2_field field;
|
||||
- __u32 bytesperline; /* for padding, zero if unused */
|
||||
- __u32 sizeimage;
|
||||
+ enum v4l2_field field;
|
||||
+ __u32 bytesperline; /* for padding, zero if unused */
|
||||
+ __u32 sizeimage;
|
||||
enum v4l2_colorspace colorspace;
|
||||
__u32 priv; /* private data, depends on pixelformat */
|
||||
};
|
||||
@@ -359,6 +359,7 @@ struct v4l2_pix_format {
|
||||
|
||||
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
|
||||
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
|
||||
+#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
|
||||
|
||||
/* three non contiguous planes - Y, Cb, Cr */
|
||||
@@ -392,13 +393,23 @@ struct v4l2_pix_format {
|
||||
#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
|
||||
#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
|
||||
#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
|
||||
+#define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */
|
||||
#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
|
||||
#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
|
||||
#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
|
||||
+#define V4L2_PIX_FMT_MPEG12 v4l2_fourcc('M', 'P', '1', '2') /* MPEG-1/2 */
|
||||
#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */
|
||||
+#define V4L2_PIX_FMT_FIMV v4l2_fourcc('F', 'I', 'M', 'V') /* FIMV */
|
||||
+#define V4L2_PIX_FMT_FIMV1 v4l2_fourcc('F', 'I', 'M', '1') /* FIMV1 */
|
||||
+#define V4L2_PIX_FMT_FIMV2 v4l2_fourcc('F', 'I', 'M', '2') /* FIMV2 */
|
||||
+#define V4L2_PIX_FMT_FIMV3 v4l2_fourcc('F', 'I', 'M', '3') /* FIMV3 */
|
||||
+#define V4L2_PIX_FMT_FIMV4 v4l2_fourcc('F', 'I', 'M', '4') /* FIMV4 */
|
||||
#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
|
||||
#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
|
||||
#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
|
||||
+#define V4L2_PIX_FMT_VC1 v4l2_fourcc('V', 'C', '1', 'A') /* VC-1 */
|
||||
+#define V4L2_PIX_FMT_VC1_RCV v4l2_fourcc('V', 'C', '1', 'R') /* VC-1 RCV */
|
||||
+#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
|
||||
|
||||
/* Vendor-specific formats */
|
||||
#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
|
||||
@@ -859,7 +870,7 @@ typedef __u64 v4l2_std_id;
|
||||
V4L2_STD_NTSC_M_JP |\
|
||||
V4L2_STD_NTSC_M_KR)
|
||||
/* Secam macros */
|
||||
-#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
|
||||
+#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
|
||||
V4L2_STD_SECAM_K |\
|
||||
V4L2_STD_SECAM_K1)
|
||||
/* All Secam Standards */
|
||||
@@ -1162,8 +1173,9 @@ struct v4l2_ext_controls {
|
||||
#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
|
||||
#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
|
||||
#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
|
||||
-#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
|
||||
-#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
|
||||
+#define V4L2_CTRL_CLASS_CODEC 0x009c0000 /* Codec control class */
|
||||
+#define V4L2_CTRL_CLASS_FLASH 0x009d0000 /* Camera flash controls */
|
||||
+#define V4L2_CTRL_CLASS_JPEG 0x009e0000 /* JPEG-compression controls */
|
||||
|
||||
#define V4L2_CTRL_ID_MASK (0x0fffffff)
|
||||
|
||||
@@ -1206,11 +1218,11 @@ struct v4l2_querymenu {
|
||||
/* Control flags */
|
||||
#define V4L2_CTRL_FLAG_DISABLED 0x0001
|
||||
#define V4L2_CTRL_FLAG_GRABBED 0x0002
|
||||
-#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
|
||||
-#define V4L2_CTRL_FLAG_UPDATE 0x0008
|
||||
-#define V4L2_CTRL_FLAG_INACTIVE 0x0010
|
||||
-#define V4L2_CTRL_FLAG_SLIDER 0x0020
|
||||
-#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
|
||||
+#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
|
||||
+#define V4L2_CTRL_FLAG_UPDATE 0x0008
|
||||
+#define V4L2_CTRL_FLAG_INACTIVE 0x0010
|
||||
+#define V4L2_CTRL_FLAG_SLIDER 0x0020
|
||||
+#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
|
||||
#define V4L2_CTRL_FLAG_VOLATILE 0x0080
|
||||
|
||||
/* Query flag, to be ORed with the control ID */
|
||||
@@ -1223,7 +1235,7 @@ struct v4l2_querymenu {
|
||||
/* IDs reserved for driver specific controls */
|
||||
#define V4L2_CID_PRIVATE_BASE 0x08000000
|
||||
|
||||
-#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
|
||||
+#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
|
||||
#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
|
||||
#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
|
||||
#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
|
||||
@@ -1261,21 +1273,21 @@ enum v4l2_power_line_frequency {
|
||||
#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
|
||||
#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
|
||||
#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
|
||||
-#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
|
||||
-#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
|
||||
-#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
|
||||
+#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
|
||||
+#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
|
||||
+#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
|
||||
#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
|
||||
enum v4l2_colorfx {
|
||||
V4L2_COLORFX_NONE = 0,
|
||||
V4L2_COLORFX_BW = 1,
|
||||
V4L2_COLORFX_SEPIA = 2,
|
||||
- V4L2_COLORFX_NEGATIVE = 3,
|
||||
- V4L2_COLORFX_EMBOSS = 4,
|
||||
- V4L2_COLORFX_SKETCH = 5,
|
||||
- V4L2_COLORFX_SKY_BLUE = 6,
|
||||
+ V4L2_COLORFX_NEGATIVE = 3,
|
||||
+ V4L2_COLORFX_EMBOSS = 4,
|
||||
+ V4L2_COLORFX_SKETCH = 5,
|
||||
+ V4L2_COLORFX_SKY_BLUE = 6,
|
||||
V4L2_COLORFX_GRASS_GREEN = 7,
|
||||
V4L2_COLORFX_SKIN_WHITEN = 8,
|
||||
- V4L2_COLORFX_VIVID = 9,
|
||||
+ V4L2_COLORFX_VIVID = 9,
|
||||
};
|
||||
#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
|
||||
#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
|
||||
@@ -1310,13 +1322,13 @@ enum v4l2_mpeg_stream_type {
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
|
||||
V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
|
||||
};
|
||||
-#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
|
||||
-#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
|
||||
-#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
|
||||
-#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
|
||||
-#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
|
||||
-#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
|
||||
-#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
|
||||
+#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
|
||||
+#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
|
||||
+#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
|
||||
+#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
|
||||
+#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
|
||||
+#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
|
||||
+#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
|
||||
enum v4l2_mpeg_stream_vbi_fmt {
|
||||
V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
|
||||
V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
|
||||
@@ -1329,7 +1341,7 @@ enum v4l2_mpeg_audio_sampling_freq {
|
||||
V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
|
||||
V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
|
||||
+#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
|
||||
enum v4l2_mpeg_audio_encoding {
|
||||
V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
|
||||
V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
|
||||
@@ -1337,7 +1349,7 @@ enum v4l2_mpeg_audio_encoding {
|
||||
V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
|
||||
V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
|
||||
+#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
|
||||
enum v4l2_mpeg_audio_l1_bitrate {
|
||||
V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
|
||||
V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
|
||||
@@ -1371,7 +1383,7 @@ enum v4l2_mpeg_audio_l2_bitrate {
|
||||
V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
|
||||
V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
|
||||
+#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
|
||||
enum v4l2_mpeg_audio_l3_bitrate {
|
||||
V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
|
||||
V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
|
||||
@@ -1388,32 +1400,32 @@ enum v4l2_mpeg_audio_l3_bitrate {
|
||||
V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
|
||||
V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
|
||||
+#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
|
||||
enum v4l2_mpeg_audio_mode {
|
||||
V4L2_MPEG_AUDIO_MODE_STEREO = 0,
|
||||
V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
|
||||
V4L2_MPEG_AUDIO_MODE_DUAL = 2,
|
||||
V4L2_MPEG_AUDIO_MODE_MONO = 3,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
|
||||
+#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
|
||||
enum v4l2_mpeg_audio_mode_extension {
|
||||
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
|
||||
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
|
||||
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
|
||||
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
|
||||
+#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
|
||||
enum v4l2_mpeg_audio_emphasis {
|
||||
V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
|
||||
V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
|
||||
V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
|
||||
+#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
|
||||
enum v4l2_mpeg_audio_crc {
|
||||
V4L2_MPEG_AUDIO_CRC_NONE = 0,
|
||||
V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
|
||||
+#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
|
||||
#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
|
||||
#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
|
||||
enum v4l2_mpeg_audio_ac3_bitrate {
|
||||
@@ -1449,33 +1461,33 @@ enum v4l2_mpeg_audio_dec_playback {
|
||||
#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
|
||||
|
||||
/* MPEG video controls specific to multiplexed streams */
|
||||
-#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
|
||||
+#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
|
||||
enum v4l2_mpeg_video_encoding {
|
||||
V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
|
||||
V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
|
||||
V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
|
||||
+#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
|
||||
enum v4l2_mpeg_video_aspect {
|
||||
V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
|
||||
V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
|
||||
V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
|
||||
V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
|
||||
-#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
|
||||
-#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
|
||||
-#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
|
||||
-#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
|
||||
+#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
|
||||
+#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
|
||||
+#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
|
||||
+#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
|
||||
+#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
|
||||
enum v4l2_mpeg_video_bitrate_mode {
|
||||
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
|
||||
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
|
||||
};
|
||||
-#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
|
||||
-#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
|
||||
+#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
|
||||
+#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
|
||||
#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
|
||||
-#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
|
||||
-#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
|
||||
+#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
|
||||
+#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
|
||||
#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
|
||||
#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
|
||||
#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
|
||||
@@ -1489,16 +1501,20 @@ enum v4l2_mpeg_video_header_mode {
|
||||
#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
|
||||
#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
|
||||
#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
|
||||
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BITS (V4L2_CID_MPEG_BASE+219)
|
||||
#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
|
||||
#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
|
||||
enum v4l2_mpeg_video_multi_slice_mode {
|
||||
V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
|
||||
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
|
||||
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
|
||||
+ V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB = 1,
|
||||
+ V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BITS = 2,
|
||||
};
|
||||
#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
|
||||
#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
|
||||
#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
|
||||
+#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225)
|
||||
|
||||
#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
|
||||
#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
|
||||
@@ -1589,6 +1605,46 @@ enum v4l2_mpeg_video_h264_vui_sar_idc {
|
||||
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
|
||||
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
|
||||
};
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING (V4L2_CID_MPEG_BASE+368)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 (V4L2_CID_MPEG_BASE+369)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (V4L2_CID_MPEG_BASE+370)
|
||||
+enum v4l2_mpeg_video_h264_sei_fp_arrangement_type {
|
||||
+ V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHEKERBOARD = 0,
|
||||
+ V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN = 1,
|
||||
+ V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_ROW = 2,
|
||||
+ V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_SIDE_BY_SIDE = 3,
|
||||
+ V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM = 4,
|
||||
+ V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL = 5,
|
||||
+};
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_BASE+371)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_BASE+372)
|
||||
+enum v4l2_mpeg_video_h264_fmo_map_type {
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0,
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1,
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2,
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3,
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4,
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5,
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6,
|
||||
+};
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP (V4L2_CID_MPEG_BASE+373)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (V4L2_CID_MPEG_BASE+374)
|
||||
+enum v4l2_mpeg_video_h264_fmo_change_dir {
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0,
|
||||
+ V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1,
|
||||
+};
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE (V4L2_CID_MPEG_BASE+375)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH (V4L2_CID_MPEG_BASE+376)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_ASO (V4L2_CID_MPEG_BASE+377)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER (V4L2_CID_MPEG_BASE+378)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING (V4L2_CID_MPEG_BASE+379)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (V4L2_CID_MPEG_BASE+380)
|
||||
+enum v4l2_mpeg_video_h264_hierarchical_coding_type {
|
||||
+ V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0,
|
||||
+ V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1,
|
||||
+};
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_MPEG_BASE+381)
|
||||
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE+382)
|
||||
#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
|
||||
#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
|
||||
#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
|
||||
@@ -1683,6 +1739,220 @@ enum v4l2_mpeg_mfc51_video_force_frame_type {
|
||||
#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
|
||||
#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
|
||||
|
||||
+#define V4L2_CID_CODEC_BASE (V4L2_CTRL_CLASS_CODEC | 0x900)
|
||||
+#define V4L2_CID_CODEC_CLASS (V4L2_CTRL_CLASS_CODEC | 1)
|
||||
+
|
||||
+/* Codec class control IDs specific to the MFC5X driver */
|
||||
+#define V4L2_CID_CODEC_MFC5X_BASE (V4L2_CTRL_CLASS_CODEC | 0x1000)
|
||||
+
|
||||
+/* For both decoding and encoding */
|
||||
+
|
||||
+/* For decoding */
|
||||
+
|
||||
+#define V4L2_CID_CODEC_LOOP_FILTER_MPEG4_ENABLE (V4L2_CID_CODEC_BASE + 110)
|
||||
+#define V4L2_CID_CODEC_DISPLAY_DELAY (V4L2_CID_CODEC_BASE + 137)
|
||||
+#define V4L2_CID_CODEC_REQ_NUM_BUFS (V4L2_CID_CODEC_BASE + 140)
|
||||
+#define V4L2_CID_CODEC_SLICE_INTERFACE (V4L2_CID_CODEC_BASE + 141)
|
||||
+#define V4L2_CID_CODEC_PACKED_PB (V4L2_CID_CODEC_BASE + 142)
|
||||
+#define V4L2_CID_CODEC_FRAME_TAG (V4L2_CID_CODEC_BASE + 143)
|
||||
+#define V4L2_CID_CODEC_CRC_ENABLE (V4L2_CID_CODEC_BASE + 144)
|
||||
+#define V4L2_CID_CODEC_CRC_DATA_LUMA (V4L2_CID_CODEC_BASE + 145)
|
||||
+#define V4L2_CID_CODEC_CRC_DATA_CHROMA (V4L2_CID_CODEC_BASE + 146)
|
||||
+#define V4L2_CID_CODEC_CRC_DATA_LUMA_BOT (V4L2_CID_CODEC_BASE + 147)
|
||||
+#define V4L2_CID_CODEC_CRC_DATA_CHROMA_BOT (V4L2_CID_CODEC_BASE + 148)
|
||||
+#define V4L2_CID_CODEC_CRC_GENERATED (V4L2_CID_CODEC_BASE + 149)
|
||||
+#define V4L2_CID_CODEC_FRAME_TYPE (V4L2_CID_CODEC_BASE + 154)
|
||||
+#define V4L2_CID_CODEC_CHECK_STATE (V4L2_CID_CODEC_BASE + 155)
|
||||
+#define V4L2_CID_CODEC_DISPLAY_STATUS (V4L2_CID_CODEC_BASE + 156)
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_SEI_PARSE (V4L2_CID_CODEC_BASE + 157)
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_SEI_AVAIL (V4L2_CID_CODEC_BASE + 158)
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_ID (V4L2_CID_CODEC_BASE + 159)
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_SEI_INFO (V4L2_CID_CODEC_BASE + 160)
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_GRID_POS (V4L2_CID_CODEC_BASE + 161)
|
||||
+
|
||||
+/* For encoding */
|
||||
+#define V4L2_CID_CODEC_LOOP_FILTER_H264 (V4L2_CID_CODEC_BASE + 9)
|
||||
+enum v4l2_cid_codec_loop_filter_h264 {
|
||||
+ V4L2_CID_CODEC_LOOP_FILTER_H264_ENABLE = 0,
|
||||
+ V4L2_CID_CODEC_LOOP_FILTER_H264_DISABLE = 1,
|
||||
+ V4L2_CID_CODEC_LOOP_FILTER_H264_DISABLE_AT_BOUNDARY = 2,
|
||||
+};
|
||||
+
|
||||
+#define V4L2_CID_CODEC_FRAME_INSERTION (V4L2_CID_CODEC_BASE + 10)
|
||||
+enum v4l2_cid_codec_frame_insertion {
|
||||
+ V4L2_CID_CODEC_FRAME_INSERT_NONE = 0x0,
|
||||
+ V4L2_CID_CODEC_FRAME_INSERT_I_FRAME = 0x1,
|
||||
+ V4L2_CID_CODEC_FRAME_INSERT_NOT_CODED = 0x2,
|
||||
+};
|
||||
+
|
||||
+#define V4L2_CID_CODEC_ENCODED_LUMA_ADDR (V4L2_CID_CODEC_BASE + 11)
|
||||
+#define V4L2_CID_CODEC_ENCODED_CHROMA_ADDR (V4L2_CID_CODEC_BASE + 12)
|
||||
+
|
||||
+#define V4L2_CID_CODEC_ENCODED_I_PERIOD_CH V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE
|
||||
+#define V4L2_CID_CODEC_ENCODED_FRAME_RATE_CH V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_RATE
|
||||
+#define V4L2_CID_CODEC_ENCODED_BIT_RATE_CH V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE
|
||||
+
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_SEI_GEN (V4L2_CID_CODEC_BASE + 13)
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG (V4L2_CID_CODEC_BASE + 14)
|
||||
+enum v4l2_codec_mfc5x_enc_flag {
|
||||
+ V4L2_CODEC_MFC5X_ENC_FLAG_DISABLE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FLAG_ENABLE = 1,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE (V4L2_CID_CODEC_BASE + 15)
|
||||
+enum v4l2_codec_mfc5x_enc_frame_pack_arrgment_type {
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_PACK_SIDE_BY_SIDE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_PACK_TOP_AND_BOT = 1,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_PACK_TMP_INTER = 2,
|
||||
+};
|
||||
+
|
||||
+/* common */
|
||||
+enum v4l2_codec_mfc5x_enc_switch {
|
||||
+ V4L2_CODEC_MFC5X_ENC_SW_DISABLE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_SW_ENABLE = 1,
|
||||
+};
|
||||
+enum v4l2_codec_mfc5x_enc_switch_inv {
|
||||
+ V4L2_CODEC_MFC5X_ENC_SW_INV_ENABLE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_SW_INV_DISABLE = 1,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE (V4L2_CID_CODEC_MFC5X_BASE+300)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE (V4L2_CID_CODEC_MFC5X_BASE+301)
|
||||
+enum v4l2_codec_mfc5x_enc_multi_slice_mode {
|
||||
+ V4L2_CODEC_MFC5X_ENC_MULTI_SLICE_MODE_DISABLE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_MULTI_SLICE_MODE_MACROBLOCK_COUNT = 1,
|
||||
+ V4L2_CODEC_MFC5X_ENC_MULTI_SLICE_MODE_BIT_COUNT = 3,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB (V4L2_CID_CODEC_MFC5X_BASE+302)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT (V4L2_CID_CODEC_MFC5X_BASE+303)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB (V4L2_CID_CODEC_MFC5X_BASE+304)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+305)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE (V4L2_CID_CODEC_MFC5X_BASE+306)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE (V4L2_CID_CODEC_MFC5X_BASE+307)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE (V4L2_CID_CODEC_MFC5X_BASE+308)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+309)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE (V4L2_CID_CODEC_MFC5X_BASE+310)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF (V4L2_CID_CODEC_MFC5X_BASE+311)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_STREAM_SIZE (V4L2_CID_CODEC_MFC5X_BASE+312)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_COUNT (V4L2_CID_CODEC_MFC5X_BASE+313)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_TYPE (V4L2_CID_CODEC_MFC5X_BASE+314)
|
||||
+enum v4l2_codec_mfc5x_enc_frame_type {
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_NOT_CODED = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_I_FRAME = 1,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_P_FRAME = 2,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_B_FRAME = 3,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_SKIPPED = 4,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_OTHERS = 5,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_FORCE_FRAME_TYPE (V4L2_CID_CODEC_MFC5X_BASE+315)
|
||||
+enum v4l2_codec_mfc5x_enc_force_frame_type {
|
||||
+ V4L2_CODEC_MFC5X_ENC_FORCE_FRAME_TYPE_I_FRAME = 1,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FORCE_FRAME_TYPE_NOT_CODED = 2,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE (V4L2_CID_CODEC_MFC5X_BASE+316)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE (V4L2_CID_CODEC_MFC5X_BASE+317)
|
||||
+enum v4l2_codec_mfc5x_enc_seq_hdr_mode {
|
||||
+ V4L2_CODEC_MFC5X_ENC_SEQ_HDR_MODE_SEQ = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_SEQ_HDR_MODE_SEQ_FRAME = 1,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE (V4L2_CID_CODEC_MFC5X_BASE+318)
|
||||
+enum v4l2_codec_mfc5x_enc_frame_skip_mode {
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL = 1,
|
||||
+ V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE = 2,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT (V4L2_CID_CODEC_MFC5X_BASE+319)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_DELTA (V4L2_CID_CODEC_MFC5X_BASE+320)
|
||||
+
|
||||
+/* codec specific */
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_B_FRAMES (V4L2_CID_CODEC_MFC5X_BASE+400)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_PROFILE (V4L2_CID_CODEC_MFC5X_BASE+401)
|
||||
+enum v4l2_codec_mfc5x_enc_h264_profile {
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_PROFILE_MAIN = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_PROFILE_HIGH = 1,
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_PROFILE_BASELINE = 2,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_LEVEL (V4L2_CID_CODEC_MFC5X_BASE+402)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_INTERLACE (V4L2_CID_CODEC_MFC5X_BASE+403)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_MODE (V4L2_CID_CODEC_MFC5X_BASE+404)
|
||||
+enum v4l2_codec_mfc5x_enc_h264_loop_filter {
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_LOOP_FILTER_ENABLE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_LOOP_FILTER_DISABLE = 1,
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_LOOP_FILTER_DISABLE_AT_BOUNDARY = 2,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_ALPHA (V4L2_CID_CODEC_MFC5X_BASE+405)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_BETA (V4L2_CID_CODEC_MFC5X_BASE+406)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ENTROPY_MODE (V4L2_CID_CODEC_MFC5X_BASE+407)
|
||||
+enum v4l2_codec_mfc5x_enc_h264_entropy_mode {
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_ENTROPY_MODE_CAVLC = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_H264_ENTROPY_MODE_CABAC = 1,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_MAX_REF_PIC (V4L2_CID_CODEC_MFC5X_BASE+408)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_NUM_REF_PIC_4P (V4L2_CID_CODEC_MFC5X_BASE+409)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_8X8_TRANSFORM (V4L2_CID_CODEC_MFC5X_BASE+410)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+411)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_RATE (V4L2_CID_CODEC_MFC5X_BASE+412)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+413)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MIN_QP (V4L2_CID_CODEC_MFC5X_BASE+414)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MAX_QP (V4L2_CID_CODEC_MFC5X_BASE+415)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_DARK (V4L2_CID_CODEC_MFC5X_BASE+416)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_SMOOTH (V4L2_CID_CODEC_MFC5X_BASE+417)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_STATIC (V4L2_CID_CODEC_MFC5X_BASE+418)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ACTIVITY (V4L2_CID_CODEC_MFC5X_BASE+419)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_P_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+420)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_B_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+421)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+422)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_IDC (V4L2_CID_CODEC_MFC5X_BASE+423)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_WIDTH (V4L2_CID_CODEC_MFC5X_BASE+424)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_HEIGHT (V4L2_CID_CODEC_MFC5X_BASE+425)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_OPEN_GOP (V4L2_CID_CODEC_MFC5X_BASE+426)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_I_PERIOD (V4L2_CID_CODEC_MFC5X_BASE+427)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+428)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP (V4L2_CID_CODEC_MFC5X_BASE+429)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP (V4L2_CID_CODEC_MFC5X_BASE+430)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP (V4L2_CID_CODEC_MFC5X_BASE+431)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+432)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+433)
|
||||
+
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_B_FRAMES (V4L2_CID_CODEC_MFC5X_BASE+440)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_PROFILE (V4L2_CID_CODEC_MFC5X_BASE+441)
|
||||
+enum v4l2_codec_mfc5x_enc_mpeg4_profile {
|
||||
+ V4L2_CODEC_MFC5X_ENC_MPEG4_PROFILE_SIMPLE = 0,
|
||||
+ V4L2_CODEC_MFC5X_ENC_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
|
||||
+};
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_LEVEL (V4L2_CID_CODEC_MFC5X_BASE+442)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+443)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MIN_QP (V4L2_CID_CODEC_MFC5X_BASE+444)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MAX_QP (V4L2_CID_CODEC_MFC5X_BASE+445)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_QUARTER_PIXEL (V4L2_CID_CODEC_MFC5X_BASE+446)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_P_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+447)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_B_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+448)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_TIME_RES (V4L2_CID_CODEC_MFC5X_BASE+449)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_FRM_DELTA (V4L2_CID_CODEC_MFC5X_BASE+450)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MB_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+451)
|
||||
+
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_RATE (V4L2_CID_CODEC_MFC5X_BASE+460)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+461)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MIN_QP (V4L2_CID_CODEC_MFC5X_BASE+462)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MAX_QP (V4L2_CID_CODEC_MFC5X_BASE+463)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_P_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+464)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MB_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+465)
|
||||
+
|
||||
+/* FMO/ASO parameters */
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_MAP_TYPE (V4L2_CID_CODEC_MFC5X_BASE+480)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SLICE_NUM (V4L2_CID_CODEC_MFC5X_BASE+481)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1 (V4L2_CID_CODEC_MFC5X_BASE+482)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2 (V4L2_CID_CODEC_MFC5X_BASE+483)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3 (V4L2_CID_CODEC_MFC5X_BASE+484)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4 (V4L2_CID_CODEC_MFC5X_BASE+485)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR (V4L2_CID_CODEC_MFC5X_BASE+486)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE (V4L2_CID_CODEC_MFC5X_BASE+487)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_0 (V4L2_CID_CODEC_MFC5X_BASE+488)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_1 (V4L2_CID_CODEC_MFC5X_BASE+489)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_2 (V4L2_CID_CODEC_MFC5X_BASE+490)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_3 (V4L2_CID_CODEC_MFC5X_BASE+491)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_4 (V4L2_CID_CODEC_MFC5X_BASE+492)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_5 (V4L2_CID_CODEC_MFC5X_BASE+493)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_6 (V4L2_CID_CODEC_MFC5X_BASE+494)
|
||||
+#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_7 (V4L2_CID_CODEC_MFC5X_BASE+495)
|
||||
/* Camera class control IDs */
|
||||
#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
|
||||
#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
|
||||
--
|
||||
1.7.8.6
|
||||
|
@ -1,38 +0,0 @@
|
||||
sheu@chromium.org: trimmed from 3.4 kernel patch
|
||||
|
||||
From a282f22565b9e0d1aefdbe1b2956d11c21b81810 Mon Sep 17 00:00:00 2001
|
||||
From: Subash Patel <subash.ramaswamy@linaro.org>
|
||||
Date: Tue, 22 May 2012 20:18:30 +0100
|
||||
Subject: [PATCH] Media: Exynos: Header file support for G-Scaler driver
|
||||
|
||||
This commit adds the header files required to define the controls
|
||||
of the new G-Scaler driver.
|
||||
|
||||
Change-Id: Iea9d01e18870501758326750c3b0051df9ec139f
|
||||
Signed-off-by: Subash Patel <subash.ramaswamy@linaro.org>
|
||||
Signed-off-by: Kiran AVND <kiran.avnd@samsung.com>
|
||||
---
|
||||
arch/arm/mach-exynos/include/mach/videonode.h | 32 +++++++++++++++++++++++++
|
||||
include/linux/videodev2.h | 2 +
|
||||
2 files changed, 34 insertions(+), 0 deletions(-)
|
||||
create mode 100644 arch/arm/mach-exynos/include/mach/videonode.h
|
||||
|
||||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
|
||||
index 9bbd3b3..17715dd 100644
|
||||
--- a/include/linux/videodev2.h
|
||||
+++ b/include/linux/videodev2.h
|
||||
@@ -361,9 +361,11 @@ struct v4l2_pix_format {
|
||||
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */
|
||||
#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
|
||||
+#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */
|
||||
|
||||
/* three non contiguous planes - Y, Cb, Cr */
|
||||
#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
|
||||
+#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'V', 'U', 'M') /* 12 YVU420 planar */
|
||||
|
||||
/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
|
||||
#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
|
||||
--
|
||||
1.7.8.6
|
||||
|
@ -1,68 +0,0 @@
|
||||
sheu@chromium.org: trimmed from 3.4 kernel patch
|
||||
|
||||
From ddbbf176f4e8cafcb4bd5cf215b82d30c721ed83 Mon Sep 17 00:00:00 2001
|
||||
From: Tomasz Stanislawski <t.stanislaws@samsung.com>
|
||||
Date: Thu, 14 Jun 2012 16:32:23 +0200
|
||||
Subject: [PATCH] v4l: add buffer exporting via dmabuf
|
||||
|
||||
This patch adds extension to V4L2 api. It allow to export a mmap buffer as file
|
||||
descriptor. New ioctl VIDIOC_EXPBUF is added. It takes a buffer offset used by
|
||||
mmap and return a file descriptor on success.
|
||||
|
||||
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
|
||||
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
|
||||
---
|
||||
drivers/media/video/v4l2-compat-ioctl32.c | 1 +
|
||||
drivers/media/video/v4l2-dev.c | 1 +
|
||||
drivers/media/video/v4l2-ioctl.c | 6 ++++++
|
||||
include/linux/videodev2.h | 26 ++++++++++++++++++++++++++
|
||||
include/media/v4l2-ioctl.h | 2 ++
|
||||
5 files changed, 36 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
|
||||
index d884d4a..52f2aa0 100644
|
||||
--- a/include/linux/videodev2.h
|
||||
+++ b/include/linux/videodev2.h
|
||||
@@ -679,6 +679,31 @@ struct v4l2_buffer {
|
||||
#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
|
||||
#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
|
||||
|
||||
+/**
|
||||
+ * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
|
||||
+ *
|
||||
+ * @fd: file descriptor associated with DMABUF (set by driver)
|
||||
+ * @mem_offset: buffer memory offset as returned by VIDIOC_QUERYBUF in struct
|
||||
+ * v4l2_buffer::m.offset (for single-plane formats) or
|
||||
+ * v4l2_plane::m.offset (for multi-planar formats)
|
||||
+ * @flags: flags for newly created file, currently only O_CLOEXEC is
|
||||
+ * supported, refer to manual of open syscall for more details
|
||||
+ *
|
||||
+ * Contains data used for exporting a video buffer as DMABUF file descriptor.
|
||||
+ * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF
|
||||
+ * (identical to the cookie used to mmap() the buffer to userspace). All
|
||||
+ * reserved fields must be set to zero. The field reserved0 is expected to
|
||||
+ * become a structure 'type' allowing an alternative layout of the structure
|
||||
+ * content. Therefore this field should not be used for any other extensions.
|
||||
+ */
|
||||
+struct v4l2_exportbuffer {
|
||||
+ __u32 fd;
|
||||
+ __u32 reserved0;
|
||||
+ __u32 mem_offset;
|
||||
+ __u32 flags;
|
||||
+ __u32 reserved[12];
|
||||
+};
|
||||
+
|
||||
/*
|
||||
* O V E R L A Y P R E V I E W
|
||||
*/
|
||||
@@ -2326,6 +2351,7 @@ struct v4l2_create_buffers {
|
||||
#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
|
||||
#define VIDIOC_OVERLAY _IOW('V', 14, int)
|
||||
#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
|
||||
+#define VIDIOC_EXPBUF _IOWR('V', 16, struct v4l2_exportbuffer)
|
||||
#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
|
||||
#define VIDIOC_STREAMON _IOW('V', 18, int)
|
||||
#define VIDIOC_STREAMOFF _IOW('V', 19, int)
|
||||
--
|
||||
1.7.8.6
|
||||
|
@ -1 +0,0 @@
|
||||
linux-headers-3.4.ebuild
|
@ -1,57 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/linux-headers/linux-headers-3.4.ebuild,v 1.1 2012/05/22 03:21:59 vapier Exp $
|
||||
|
||||
EAPI="3"
|
||||
|
||||
ETYPE="headers"
|
||||
H_SUPPORTEDARCH="alpha amd64 arm bfin cris hppa m68k mips ia64 ppc ppc64 s390 sh sparc x86"
|
||||
inherit kernel-2
|
||||
detect_version
|
||||
|
||||
PATCH_VER="1"
|
||||
SRC_URI="mirror://gentoo/gentoo-headers-base-${PV}.tar.xz
|
||||
${PATCH_VER:+mirror://gentoo/gentoo-headers-${PV}-${PATCH_VER}.tar.xz}"
|
||||
|
||||
KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86 ~amd64-linux ~x86-linux"
|
||||
|
||||
DEPEND="app-arch/xz-utils
|
||||
dev-lang/perl"
|
||||
RDEPEND=""
|
||||
|
||||
S=${WORKDIR}/gentoo-headers-base-${PV}
|
||||
|
||||
src_unpack() {
|
||||
unpack ${A}
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
[[ -n ${PATCH_VER} ]] && EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/${PV}
|
||||
epatch ${FILESDIR}/3.4-v4l-Add-DMABUF-as-a-memory-type.patch
|
||||
epatch ${FILESDIR}/3.4-v4l-Media-Exynos-Header-file-support-for-G-Scaler-driver.patch
|
||||
epatch ${FILESDIR}/3.4-v4l-MFC-update-MFC-v4l2-driver-to-support-MFC6.x.patch
|
||||
epatch ${FILESDIR}/3.4-v4l-CHROMIUM-v4l2-exynos-move-CID-enums-into-videodev2.h.patch
|
||||
epatch ${FILESDIR}/3.4-v4l-add-buffer-exporting-via-dmabuf.patch
|
||||
}
|
||||
|
||||
src_install() {
|
||||
kernel-2_src_install
|
||||
cd "${D}"
|
||||
egrep -r \
|
||||
-e '(^|[[:space:](])(asm|volatile|inline)[[:space:](]' \
|
||||
-e '\<([us](8|16|32|64))\>' \
|
||||
.
|
||||
headers___fix $(find -type f)
|
||||
|
||||
egrep -l -r -e '__[us](8|16|32|64)' "${D}" | xargs grep -L linux/types.h
|
||||
|
||||
# hrm, build system sucks
|
||||
find "${D}" '(' -name '.install' -o -name '*.cmd' ')' -print0 | xargs -0 rm -f
|
||||
|
||||
# provided by libdrm (for now?)
|
||||
rm -rf "${D}"/$(kernel_header_destdir)/drm
|
||||
}
|
||||
|
||||
src_test() {
|
||||
emake ARCH=$(tc-arch-kernel) headers_check || die
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
DIST glibc-2.15-patches-22.tar.bz2 118537 SHA256 7a16c17f98b3efc8ceee8330dc54bbfd9efc7196404de25779aa944f0aa411c7 SHA512 1d594fab08e57f09dc2ca4e5fd5cf48a161b719f263d7da4b02697bd4a1cfac1b22e976f6c8517fc185c8ebf0474c6d0881380fa53a62192e97bb23c789a22a9 WHIRLPOOL 910f257be93577fcfb050ab979322b4767a5a52fb9969393c821cf67338910d7a0e2e8010f91809a1a4cd5a01b84808c8632098ec4bb17a83dcdb26a217f54a2
|
||||
DIST glibc-2.15.tar.xz 10280176 SHA256 321ec482abdc27b03244f7b345ee22dc431bc55daf9c000a4e7b040fbdbecb50 SHA512 fc8bc407cd9edfd79bd286d28c84e0b8224e1f57c1d318e73da098a9693257d78970178fd59f487f0321a079fcb772e8e78473fab52f091b2addb0a48fe8dcf7 WHIRLPOOL 061fc0c9915bd821dc31c2fea8e4f9a75b6c7ec0c935ea713d8c087408a8bf3c600179273438f3d9748fe40b946866b2f160e6da6fee4da51e549a30d0f0ebbc
|
||||
DIST glibc-2.16.0-patches-8.tar.bz2 88635 SHA256 3dc60b033be747320e06d2cbe938beccfe5a781636d2285642066e42757475fa SHA512 c0d772492bd491633a6c84735f8efb4d0f3a3cc54a3eebe38cc7c75179fc69f9355ebe2b12746ece4db688980388a8df26c4bf9f814e4a598a1c5de1ce31670d WHIRLPOOL 3dae9f63fece0046becdf7044b6a2b39857363eb96fc31d6d239b664b0f03ea2d4903dabd6a2b6f671e9ff98fb65be67ddea29c8e69e56f4eea6dc3694433f86
|
||||
DIST glibc-2.16.0.tar.xz 9990512 SHA256 1edc36aa2a6cb7127971fce8e02eecffe9c7956297ad3ef10dd4c09f486d5924 SHA512 be9acc11b77ab3c01d5766fe626a6a51bc3192ac98f9554fbb5c37120cfc6f636c0b7a80beddc180f13b32ad06051d24c1999fa2e64eeb724d55a9498f0f634e WHIRLPOOL 9bfd4358a4488080e12e08deca5fca59c1555853d1c1978b7d1bb3b480eb8fb125dccab38c55644248ae5e18b0167aec85f8a7850bab9e11f980aae6f171eac3
|
||||
DIST glibc-ports-2.15.tar.xz 421820 SHA256 fcc271fcc3a808bf0f3aa1d144bc39b8d0d5f730aed6e206b883961515f0d1b9 SHA512 fc3c80a9a7ede0f35054e5be043fff4b967e6ef6678f42e617dd1dd498920edb4e4c785cf8e3cd97fc2914a35a892e0fd7e1aab24f0c3c8d207765a131bf3744 WHIRLPOOL a8a617eacb326615265832f86a7ef39678364b5b65d5c16d58680ec0debfbca6780018b7da9c1a86bdfffcde58aa1258b96ea4bd50b114901b522e62d48ae4a5
|
||||
DIST glibc-ports-2.16.0.tar.xz 925916 SHA256 93a10ac3b9ab70ccc59dfe50a4747d48a7e92f9481656f8a37558a2767ac02f3 SHA512 8653ad9f5cf239a55eb2e236f9510ba227e910168efefd74df8e4951f2e1e4bca69598bc23daa6581e0ba94fe334ac625524fb22f0d38c2a07e373eda1db821b WHIRLPOOL 60b0cb559e28bcab9c6625ccd24a13ecfc301cc055d7e18d1324627912b528ca8cc7c2f999e1e979d2685e407879b1bfffdb61f1536d91fa143cffb7ded72a8a
|
@ -1,315 +0,0 @@
|
||||
/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* Copyright (C) 2006-2008 Gentoo Foundation Inc.
|
||||
* License terms as above.
|
||||
*
|
||||
* Hardened Gentoo SSP and FORTIFY handler
|
||||
*
|
||||
* An SSP failure handler that does not use functions from the rest of
|
||||
* glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures
|
||||
* no possibility of recursion into the handler.
|
||||
*
|
||||
* Direct all bug reports to http://bugs.gentoo.org/
|
||||
*
|
||||
* Re-written from the glibc-2.3 Hardened Gentoo SSP handler
|
||||
* by Kevin F. Quinn - <kevquinn[@]gentoo.org>
|
||||
*
|
||||
* The following people contributed to the glibc-2.3 Hardened
|
||||
* Gentoo SSP and FORTIFY handler, from which this implementation draws much:
|
||||
*
|
||||
* Ned Ludd - <solar[@]gentoo.org>
|
||||
* Alexander Gabert - <pappy[@]gentoo.org>
|
||||
* The PaX Team - <pageexec[@]freemail.hu>
|
||||
* Peter S. Mazinger - <ps.m[@]gmx.net>
|
||||
* Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
|
||||
* Robert Connolly - <robert[@]linuxfromscratch.org>
|
||||
* Cory Visi <cory[@]visi.name>
|
||||
* Mike Frysinger <vapier[@]gentoo.org>
|
||||
* Magnus Granberg <zorry[@]ume.nu>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <bp-checks.h>
|
||||
|
||||
#include <kernel-features.h>
|
||||
|
||||
#include <alloca.h>
|
||||
/* from sysdeps */
|
||||
#include <socketcall.h>
|
||||
/* for the stuff in bits/socket.h */
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
/* Sanity check on SYSCALL macro names - force compilation
|
||||
* failure if the names used here do not exist
|
||||
*/
|
||||
#if !defined __NR_socketcall && !defined __NR_socket
|
||||
# error Cannot do syscall socket or socketcall
|
||||
#endif
|
||||
#if !defined __NR_socketcall && !defined __NR_connect
|
||||
# error Cannot do syscall connect or socketcall
|
||||
#endif
|
||||
#ifndef __NR_write
|
||||
# error Cannot do syscall write
|
||||
#endif
|
||||
#ifndef __NR_close
|
||||
# error Cannot do syscall close
|
||||
#endif
|
||||
#ifndef __NR_getpid
|
||||
# error Cannot do syscall getpid
|
||||
#endif
|
||||
#ifndef __NR_kill
|
||||
# error Cannot do syscall kill
|
||||
#endif
|
||||
#ifndef __NR_exit
|
||||
# error Cannot do syscall exit
|
||||
#endif
|
||||
#ifdef SSP_SMASH_DUMPS_CORE
|
||||
# define ENABLE_SSP_SMASH_DUMPS_CORE 1
|
||||
# if !defined _KERNEL_NSIG && !defined _NSIG
|
||||
# error No _NSIG or _KERNEL_NSIG for rt_sigaction
|
||||
# endif
|
||||
# if !defined __NR_sigaction && !defined __NR_rt_sigaction
|
||||
# error Cannot do syscall sigaction or rt_sigaction
|
||||
# endif
|
||||
/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
|
||||
* of the _kernel_ sigset_t which is not the same as the user sigset_t.
|
||||
* Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
|
||||
* some reason.
|
||||
*/
|
||||
# ifdef _KERNEL_NSIG
|
||||
# define _SSP_NSIG _KERNEL_NSIG
|
||||
# else
|
||||
# define _SSP_NSIG _NSIG
|
||||
# endif
|
||||
#else
|
||||
# define _SSP_NSIG 0
|
||||
# define ENABLE_SSP_SMASH_DUMPS_CORE 0
|
||||
#endif
|
||||
|
||||
/* Define DO_SIGACTION - default to newer rt signal interface but
|
||||
* fallback to old as needed.
|
||||
*/
|
||||
#ifdef __NR_rt_sigaction
|
||||
# define DO_SIGACTION(signum, act, oldact) \
|
||||
INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8)
|
||||
#else
|
||||
# define DO_SIGACTION(signum, act, oldact) \
|
||||
INLINE_SYSCALL(sigaction, 3, signum, act, oldact)
|
||||
#endif
|
||||
|
||||
/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */
|
||||
#if defined(__NR_socket) && defined(__NR_connect)
|
||||
# define USE_OLD_SOCKETCALL 0
|
||||
#else
|
||||
# define USE_OLD_SOCKETCALL 1
|
||||
#endif
|
||||
|
||||
/* stub out the __NR_'s so we can let gcc optimize away dead code */
|
||||
#ifndef __NR_socketcall
|
||||
# define __NR_socketcall 0
|
||||
#endif
|
||||
#ifndef __NR_socket
|
||||
# define __NR_socket 0
|
||||
#endif
|
||||
#ifndef __NR_connect
|
||||
# define __NR_connect 0
|
||||
#endif
|
||||
#define DO_SOCKET(result, domain, type, protocol) \
|
||||
do { \
|
||||
if (USE_OLD_SOCKETCALL) { \
|
||||
socketargs[0] = domain; \
|
||||
socketargs[1] = type; \
|
||||
socketargs[2] = protocol; \
|
||||
socketargs[3] = 0; \
|
||||
result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \
|
||||
} else \
|
||||
result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \
|
||||
} while (0)
|
||||
#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \
|
||||
do { \
|
||||
if (USE_OLD_SOCKETCALL) { \
|
||||
socketargs[0] = sockfd; \
|
||||
socketargs[1] = (unsigned long int)serv_addr; \
|
||||
socketargs[2] = addrlen; \
|
||||
socketargs[3] = 0; \
|
||||
result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \
|
||||
} else \
|
||||
result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \
|
||||
} while (0)
|
||||
|
||||
#ifndef _PATH_LOG
|
||||
# define _PATH_LOG "/dev/log"
|
||||
#endif
|
||||
|
||||
static const char path_log[] = _PATH_LOG;
|
||||
|
||||
/* For building glibc with SSP switched on, define __progname to a
|
||||
* constant if building for the run-time loader, to avoid pulling
|
||||
* in more of libc.so into ld.so
|
||||
*/
|
||||
#ifdef IS_IN_rtld
|
||||
static char *__progname = "<rtld>";
|
||||
#else
|
||||
extern char *__progname;
|
||||
#endif
|
||||
|
||||
/* Common handler code, used by chk_fail
|
||||
* Inlined to ensure no self-references to the handler within itself.
|
||||
* Data static to avoid putting more than necessary on the stack,
|
||||
* to aid core debugging.
|
||||
*/
|
||||
__attribute__ ((__noreturn__ , __always_inline__))
|
||||
static inline void
|
||||
__hardened_gentoo_chk_fail(char func[], int damaged)
|
||||
{
|
||||
#define MESSAGE_BUFSIZ 256
|
||||
static pid_t pid;
|
||||
static int plen, i;
|
||||
static char message[MESSAGE_BUFSIZ];
|
||||
static const char msg_ssa[] = ": buffer overflow attack";
|
||||
static const char msg_inf[] = " in function ";
|
||||
static const char msg_ssd[] = "*** buffer overflow detected ***: ";
|
||||
static const char msg_terminated[] = " - terminated\n";
|
||||
static const char msg_report[] = "Report to http://bugs.gentoo.org/\n";
|
||||
static const char msg_unknown[] = "<unknown>";
|
||||
static int log_socket, connect_result;
|
||||
static struct sockaddr_un sock;
|
||||
static unsigned long int socketargs[4];
|
||||
|
||||
/* Build socket address
|
||||
*/
|
||||
sock.sun_family = AF_UNIX;
|
||||
i = 0;
|
||||
while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1))) {
|
||||
sock.sun_path[i] = path_log[i];
|
||||
i++;
|
||||
}
|
||||
sock.sun_path[i] = '\0';
|
||||
|
||||
/* Try SOCK_DGRAM connection to syslog */
|
||||
connect_result = -1;
|
||||
DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0);
|
||||
if (log_socket != -1)
|
||||
DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
|
||||
if (connect_result == -1) {
|
||||
if (log_socket != -1)
|
||||
INLINE_SYSCALL(close, 1, log_socket);
|
||||
/* Try SOCK_STREAM connection to syslog */
|
||||
DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0);
|
||||
if (log_socket != -1)
|
||||
DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
|
||||
}
|
||||
|
||||
/* Build message. Messages are generated both in the old style and new style,
|
||||
* so that log watchers that are configured for the old-style message continue
|
||||
* to work.
|
||||
*/
|
||||
#define strconcat(str) \
|
||||
{i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \
|
||||
{\
|
||||
message[plen+i]=str[i];\
|
||||
i++;\
|
||||
}\
|
||||
plen+=i;}
|
||||
|
||||
/* R.Henderson post-gcc-4 style message */
|
||||
plen = 0;
|
||||
strconcat(msg_ssd);
|
||||
if (__progname != (char *)0)
|
||||
strconcat(__progname)
|
||||
else
|
||||
strconcat(msg_unknown);
|
||||
strconcat(msg_terminated);
|
||||
|
||||
/* Write out error message to STDERR, to syslog if open */
|
||||
INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
|
||||
if (connect_result != -1)
|
||||
INLINE_SYSCALL(write, 3, log_socket, message, plen);
|
||||
|
||||
/* Dr. Etoh pre-gcc-4 style message */
|
||||
plen = 0;
|
||||
if (__progname != (char *)0)
|
||||
strconcat(__progname)
|
||||
else
|
||||
strconcat(msg_unknown);
|
||||
strconcat(msg_ssa);
|
||||
strconcat(msg_inf);
|
||||
if (func != NULL)
|
||||
strconcat(func)
|
||||
else
|
||||
strconcat(msg_unknown);
|
||||
strconcat(msg_terminated);
|
||||
/* Write out error message to STDERR, to syslog if open */
|
||||
INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
|
||||
if (connect_result != -1)
|
||||
INLINE_SYSCALL(write, 3, log_socket, message, plen);
|
||||
|
||||
/* Direct reports to bugs.gentoo.org */
|
||||
plen=0;
|
||||
strconcat(msg_report);
|
||||
message[plen++]='\0';
|
||||
|
||||
/* Write out error message to STDERR, to syslog if open */
|
||||
INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
|
||||
if (connect_result != -1)
|
||||
INLINE_SYSCALL(write, 3, log_socket, message, plen);
|
||||
|
||||
if (log_socket != -1)
|
||||
INLINE_SYSCALL(close, 1, log_socket);
|
||||
|
||||
/* Suicide */
|
||||
pid = INLINE_SYSCALL(getpid, 0);
|
||||
|
||||
if (ENABLE_SSP_SMASH_DUMPS_CORE) {
|
||||
static struct sigaction default_abort_act;
|
||||
/* Remove any user-supplied handler for SIGABRT, before using it */
|
||||
default_abort_act.sa_handler = SIG_DFL;
|
||||
default_abort_act.sa_sigaction = NULL;
|
||||
__sigfillset(&default_abort_act.sa_mask);
|
||||
default_abort_act.sa_flags = 0;
|
||||
if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0)
|
||||
INLINE_SYSCALL(kill, 2, pid, SIGABRT);
|
||||
}
|
||||
|
||||
/* Note; actions cannot be added to SIGKILL */
|
||||
INLINE_SYSCALL(kill, 2, pid, SIGKILL);
|
||||
|
||||
/* In case the kill didn't work, exit anyway
|
||||
* The loop prevents gcc thinking this routine returns
|
||||
*/
|
||||
while (1)
|
||||
INLINE_SYSCALL(exit, 0);
|
||||
}
|
||||
|
||||
__attribute__ ((__noreturn__))
|
||||
void __chk_fail(void)
|
||||
{
|
||||
__hardened_gentoo_chk_fail(NULL, 0);
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
Prevent default-fPIE from confusing configure into thinking
|
||||
PIC code is default. This causes glibc to build both PIC and
|
||||
non-PIC code as normal, which on the hardened compiler generates
|
||||
PIC and PIE.
|
||||
|
||||
Patch by Kevin F. Quinn <kevquinn@gentoo.org>
|
||||
Fixed for glibc 2.10 by Magnus Granberg <zorry@ume.nu>
|
||||
|
||||
--- configure.in
|
||||
+++ configure.in
|
||||
@@ -2145,7 +2145,7 @@
|
||||
# error PIC is default.
|
||||
#endif
|
||||
EOF
|
||||
-if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
|
||||
+if eval "${CC-cc} -fno-PIE -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
|
||||
libc_cv_pic_default=no
|
||||
fi
|
||||
rm -f conftest.*])
|
||||
--- configure
|
||||
+++ configure
|
||||
@@ -7698,7 +7698,7 @@
|
||||
# error PIC is default.
|
||||
#endif
|
||||
EOF
|
||||
-if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
|
||||
+if eval "${CC-cc} -fno-PIE -S conftest.c 2>&5 1>&5"; then
|
||||
libc_cv_pic_default=no
|
||||
fi
|
||||
rm -f conftest.*
|
@ -1,274 +0,0 @@
|
||||
When building glibc PIE (which is not something upstream support),
|
||||
several modifications are necessary to the glibc build process.
|
||||
|
||||
First, any syscalls in PIEs must be of the PIC variant, otherwise
|
||||
textrels ensue. Then, any syscalls made before the initialisation
|
||||
of the TLS will fail on i386, as the sysenter variant on i386 uses
|
||||
the TLS, giving rise to a chicken-and-egg situation. This patch
|
||||
defines a PIC syscall variant that doesn't use sysenter, even when the sysenter
|
||||
version is normally used, and uses the non-sysenter version for the brk
|
||||
syscall that is performed by the TLS initialisation. Further, the TLS
|
||||
initialisation is moved in this case prior to the initialisation of
|
||||
dl_osversion, as that requires further syscalls.
|
||||
|
||||
csu/libc-start.c: Move initial TLS initialization to before the
|
||||
initialisation of dl_osversion, when INTERNAL_SYSCALL_NOSYSENTER is defined
|
||||
|
||||
csu/libc-tls.c: Use the no-sysenter version of sbrk when
|
||||
INTERNAL_SYSCALL_NOSYSENTER is defined.
|
||||
|
||||
misc/sbrk.c: Define a no-sysenter version of sbrk, using the no-sysenter
|
||||
version of brk - if INTERNAL_SYSCALL_NOSYSENTER is defined.
|
||||
|
||||
misc/brk.c: Define a no-sysenter version of brk if
|
||||
INTERNAL_SYSCALL_NOSYSENTER is defined.
|
||||
|
||||
sysdeps/unix/sysv/linux/i386/sysdep.h: Define INTERNAL_SYSCALL_NOSYSENTER
|
||||
Make INTERNAL_SYSCALL always use the PIC variant, even if not SHARED.
|
||||
|
||||
Patch by Kevin F. Quinn <kevquinn@gentoo.org>
|
||||
Fixed for 2.10 by Magnus Granberg <zorry@ume.nu>
|
||||
|
||||
--- csu/libc-start.c
|
||||
+++ csu/libc-start.c
|
||||
@@ -28,6 +28,7 @@
|
||||
extern int __libc_multiple_libcs;
|
||||
|
||||
#include <tls.h>
|
||||
+#include <sysdep.h>
|
||||
#ifndef SHARED
|
||||
# include <dl-osinfo.h>
|
||||
extern void __pthread_initialize_minimal (void);
|
||||
@@ -129,6 +130,11 @@
|
||||
# endif
|
||||
_dl_aux_init (auxvec);
|
||||
# endif
|
||||
+# ifdef INTERNAL_SYSCALL_NOSYSENTER
|
||||
+ /* Do the initial TLS initialization before _dl_osversion,
|
||||
+ since the latter uses the uname syscall. */
|
||||
+ __pthread_initialize_minimal ();
|
||||
+# endif
|
||||
# ifdef DL_SYSDEP_OSCHECK
|
||||
if (!__libc_multiple_libcs)
|
||||
{
|
||||
@@ -138,10 +144,12 @@
|
||||
}
|
||||
# endif
|
||||
|
||||
+# ifndef INTERNAL_SYSCALL_NOSYSENTER
|
||||
/* Initialize the thread library at least a bit since the libgcc
|
||||
functions are using thread functions if these are available and
|
||||
we need to setup errno. */
|
||||
__pthread_initialize_minimal ();
|
||||
+# endif
|
||||
|
||||
/* Set up the stack checker's canary. */
|
||||
uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
|
||||
--- csu/libc-tls.c
|
||||
+++ csu/libc-tls.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
+#include <sysdep.h>
|
||||
|
||||
|
||||
#ifdef SHARED
|
||||
@@ -29,6 +30,9 @@
|
||||
#error makefile bug, this file is for static only
|
||||
#endif
|
||||
|
||||
+#ifdef INTERNAL_SYSCALL_NOSYSENTER
|
||||
+extern void *__sbrk_nosysenter (intptr_t __delta);
|
||||
+#endif
|
||||
extern ElfW(Phdr) *_dl_phdr;
|
||||
extern size_t _dl_phnum;
|
||||
|
||||
@@ -141,14 +145,26 @@
|
||||
|
||||
The initialized value of _dl_tls_static_size is provided by dl-open.c
|
||||
to request some surplus that permits dynamic loading of modules with
|
||||
- IE-model TLS. */
|
||||
+ IE-model TLS.
|
||||
+
|
||||
+ Where the normal sbrk would use a syscall that needs the TLS (i386)
|
||||
+ use the special non-sysenter version instead. */
|
||||
#if TLS_TCB_AT_TP
|
||||
tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
|
||||
+# ifdef INTERNAL_SYSCALL_NOSYSENTER
|
||||
+ tlsblock = __sbrk_nosysenter (tcb_offset + tcbsize + max_align);
|
||||
+# else
|
||||
tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
|
||||
+# endif
|
||||
#elif TLS_DTV_AT_TP
|
||||
tcb_offset = roundup (tcbsize, align ?: 1);
|
||||
+# ifdef INTERNAL_SYSCALL_NOSYSENTER
|
||||
+ tlsblock = __sbrk_nosysenter (tcb_offset + memsz + max_align
|
||||
+ + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
|
||||
+# else
|
||||
tlsblock = __sbrk (tcb_offset + memsz + max_align
|
||||
+ TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
|
||||
+# endif
|
||||
tlsblock += TLS_PRE_TCB_SIZE;
|
||||
#else
|
||||
/* In case a model with a different layout for the TCB and DTV
|
||||
--- misc/sbrk.c
|
||||
+++ misc/sbrk.c
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
+#include <sysdep.h>
|
||||
|
||||
/* Defined in brk.c. */
|
||||
extern void *__curbrk;
|
||||
@@ -29,6 +30,35 @@
|
||||
/* Extend the process's data space by INCREMENT.
|
||||
If INCREMENT is negative, shrink data space by - INCREMENT.
|
||||
Return start of new space allocated, or -1 for errors. */
|
||||
+#ifdef INTERNAL_SYSCALL_NOSYSENTER
|
||||
+/* This version is used by csu/libc-tls.c whem initialising the TLS
|
||||
+ if the SYSENTER version requires the TLS (which it does on i386).
|
||||
+ Obviously using the TLS before it is initialised is broken. */
|
||||
+extern int __brk_nosysenter (void *addr);
|
||||
+void *
|
||||
+__sbrk_nosysenter (intptr_t increment)
|
||||
+{
|
||||
+ void *oldbrk;
|
||||
+
|
||||
+ /* If this is not part of the dynamic library or the library is used
|
||||
+ via dynamic loading in a statically linked program update
|
||||
+ __curbrk from the kernel's brk value. That way two separate
|
||||
+ instances of __brk and __sbrk can share the heap, returning
|
||||
+ interleaved pieces of it. */
|
||||
+ if (__curbrk == NULL || __libc_multiple_libcs)
|
||||
+ if (__brk_nosysenter (0) < 0) /* Initialize the break. */
|
||||
+ return (void *) -1;
|
||||
+
|
||||
+ if (increment == 0)
|
||||
+ return __curbrk;
|
||||
+
|
||||
+ oldbrk = __curbrk;
|
||||
+ if (__brk_nosysenter (oldbrk + increment) < 0)
|
||||
+ return (void *) -1;
|
||||
+
|
||||
+ return oldbrk;
|
||||
+}
|
||||
+#endif
|
||||
void *
|
||||
__sbrk (intptr_t increment)
|
||||
{
|
||||
--- sysdeps/unix/sysv/linux/i386/brk.c
|
||||
+++ sysdeps/unix/sysv/linux/i386/brk.c
|
||||
@@ -31,6 +31,30 @@
|
||||
linker. */
|
||||
weak_alias (__curbrk, ___brk_addr)
|
||||
|
||||
+#ifdef INTERNAL_SYSCALL_NOSYSENTER
|
||||
+/* This version is used by csu/libc-tls.c whem initialising the TLS
|
||||
+ * if the SYSENTER version requires the TLS (which it does on i386).
|
||||
+ * Obviously using the TLS before it is initialised is broken. */
|
||||
+int
|
||||
+__brk_nosysenter (void *addr)
|
||||
+{
|
||||
+ void *__unbounded newbrk;
|
||||
+
|
||||
+ INTERNAL_SYSCALL_DECL (err);
|
||||
+ newbrk = (void *__unbounded) INTERNAL_SYSCALL_NOSYSENTER (brk, err, 1,
|
||||
+ __ptrvalue (addr));
|
||||
+
|
||||
+ __curbrk = newbrk;
|
||||
+
|
||||
+ if (newbrk < addr)
|
||||
+ {
|
||||
+ __set_errno (ENOMEM);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
int
|
||||
__brk (void *addr)
|
||||
{
|
||||
--- sysdeps/unix/sysv/linux/i386/sysdep.h
|
||||
+++ sysdeps/unix/sysv/linux/i386/sysdep.h
|
||||
@@ -187,7 +187,7 @@
|
||||
/* The original calling convention for system calls on Linux/i386 is
|
||||
to use int $0x80. */
|
||||
#ifdef I386_USE_SYSENTER
|
||||
-# ifdef SHARED
|
||||
+# if defined SHARED || defined __PIC__
|
||||
# define ENTER_KERNEL call *%gs:SYSINFO_OFFSET
|
||||
# else
|
||||
# define ENTER_KERNEL call *_dl_sysinfo
|
||||
@@ -358,7 +358,7 @@
|
||||
possible to use more than four parameters. */
|
||||
#undef INTERNAL_SYSCALL
|
||||
#ifdef I386_USE_SYSENTER
|
||||
-# ifdef SHARED
|
||||
+# if defined SHARED || defined __PIC__
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
({ \
|
||||
register unsigned int resultvar; \
|
||||
@@ -384,6 +384,18 @@
|
||||
: "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
|
||||
ASMFMT_##nr(args) : "memory", "cc"); \
|
||||
(int) resultvar; })
|
||||
+# define INTERNAL_SYSCALL_NOSYSENTER(name, err, nr, args...) \
|
||||
+ ({ \
|
||||
+ register unsigned int resultvar; \
|
||||
+ EXTRAVAR_##nr \
|
||||
+ asm volatile ( \
|
||||
+ LOADARGS_NOSYSENTER_##nr \
|
||||
+ "movl %1, %%eax\n\t" \
|
||||
+ "int $0x80\n\t" \
|
||||
+ RESTOREARGS_NOSYSENTER_##nr \
|
||||
+ : "=a" (resultvar) \
|
||||
+ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \
|
||||
+ (int) resultvar; })
|
||||
# else
|
||||
# define INTERNAL_SYSCALL(name, err, nr, args...) \
|
||||
({ \
|
||||
@@ -447,12 +459,20 @@
|
||||
|
||||
#define LOADARGS_0
|
||||
#ifdef __PIC__
|
||||
-# if defined I386_USE_SYSENTER && defined SHARED
|
||||
+# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
|
||||
# define LOADARGS_1 \
|
||||
"bpushl .L__X'%k3, %k3\n\t"
|
||||
# define LOADARGS_5 \
|
||||
"movl %%ebx, %4\n\t" \
|
||||
"movl %3, %%ebx\n\t"
|
||||
+# define LOADARGS_NOSYSENTER_1 \
|
||||
+ "bpushl .L__X'%k2, %k2\n\t"
|
||||
+# define LOADARGS_NOSYSENTER_2 LOADARGS_NOSYSENTER_1
|
||||
+# define LOADARGS_NOSYSENTER_3 LOADARGS_3
|
||||
+# define LOADARGS_NOSYSENTER_4 LOADARGS_3
|
||||
+# define LOADARGS_NOSYSENTER_5 \
|
||||
+ "movl %%ebx, %3\n\t" \
|
||||
+ "movl %2, %%ebx\n\t"
|
||||
# else
|
||||
# define LOADARGS_1 \
|
||||
"bpushl .L__X'%k2, %k2\n\t"
|
||||
@@ -474,11 +495,18 @@
|
||||
|
||||
#define RESTOREARGS_0
|
||||
#ifdef __PIC__
|
||||
-# if defined I386_USE_SYSENTER && defined SHARED
|
||||
+# if defined I386_USE_SYSENTER && ( defined SHARED || defined __PIC__ )
|
||||
# define RESTOREARGS_1 \
|
||||
"bpopl .L__X'%k3, %k3\n\t"
|
||||
# define RESTOREARGS_5 \
|
||||
"movl %4, %%ebx"
|
||||
+# define RESTOREARGS_NOSYSENTER_1 \
|
||||
+ "bpopl .L__X'%k2, %k2\n\t"
|
||||
+# define RESTOREARGS_NOSYSENTER_2 RESTOREARGS_NOSYSENTER_1
|
||||
+# define RESTOREARGS_NOSYSENTER_3 RESTOREARGS_3
|
||||
+# define RESTOREARGS_NOSYSENTER_4 RESTOREARGS_3
|
||||
+# define RESTOREARGS_NOSYSENTER_5 \
|
||||
+ "movl %3, %%ebx"
|
||||
# else
|
||||
# define RESTOREARGS_1 \
|
||||
"bpopl .L__X'%k2, %k2\n\t"
|
@ -1,31 +0,0 @@
|
||||
Disable memset warning that happens when the fill-value of memset is a non-zero
|
||||
constant and the size parameter is zero.
|
||||
|
||||
This warning is triggered when certain functions containing memset calls are
|
||||
inlined, example:
|
||||
|
||||
https://bugs.webkit.org/show_bug.cgi?id=78513
|
||||
|
||||
Warnings are treated as errors in the Chromium build.
|
||||
|
||||
|
||||
--- string/bits/string3.h 2012-02-17 14:32:47.830600426 -0800
|
||||
+++ string/bits/string3.h 2012-02-17 14:32:47.830600426 -0800
|
||||
@@ -20,9 +20,6 @@
|
||||
# error "Never use <bits/string3.h> directly; include <string.h> instead."
|
||||
#endif
|
||||
|
||||
-__warndecl (__warn_memset_zero_len,
|
||||
- "memset used with constant zero length parameter; this could be due to transposed parameters");
|
||||
-
|
||||
#ifndef __cplusplus
|
||||
/* XXX This is temporarily. We should not redefine any of the symbols
|
||||
and instead integrate the error checking into the original
|
||||
@@ -79,7 +76,6 @@
|
||||
if (__builtin_constant_p (__len) && __len == 0
|
||||
&& (!__builtin_constant_p (__ch) || __ch != 0))
|
||||
{
|
||||
- __warn_memset_zero_len ();
|
||||
return __dest;
|
||||
}
|
||||
return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
|
@ -1,10 +0,0 @@
|
||||
--- ./glibc-2.11.1/csu/Makefile 2012-02-15 19:52:31.597382895 -0800
|
||||
+++ ./glibc-2.11.1/csu/Makefile 2012-02-15 19:53:24.557242505 -0800
|
||||
@@ -93,7 +93,7 @@
|
||||
$(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h
|
||||
$(compile.S) -g0 $(ASFLAGS-.os) -o $@
|
||||
|
||||
-CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
|
||||
+CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time) -fno-record-gcc-switches
|
||||
|
||||
vpath initfini.c $(sysdirs)
|
@ -1,124 +0,0 @@
|
||||
This is a pending upstream change.
|
||||
http://sourceware.org/ml/libc-alpha/2012-06/msg00571.html
|
||||
Allow an option to specify DNS timeout in milliseconds instead
|
||||
of seconds.
|
||||
---
|
||||
v3 changes:
|
||||
* Handle situations where the ns shift would have overflowed INT_MAX
|
||||
* Removed RES_MINWAIT_MS; using 1 second universally, since this is now an
|
||||
unlikely exceptional condition.
|
||||
|
||||
resolv/res_debug.c | 1 +
|
||||
resolv/res_init.c | 9 +++++++++
|
||||
resolv/res_send.c | 26 ++++++++++++++++++++++----
|
||||
resolv/resolv.h | 2 ++
|
||||
4 files changed, 34 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
|
||||
index 3daa44e..e4915f8 100644
|
||||
--- a/resolv/res_debug.c
|
||||
+++ b/resolv/res_debug.c
|
||||
@@ -589,6 +589,7 @@ p_option(u_long option) {
|
||||
case RES_USE_EDNS0: return "edns0";
|
||||
case RES_USE_DNSSEC: return "dnssec";
|
||||
case RES_NOTLDQUERY: return "no-tld-query";
|
||||
+ case RES_TIMEOUT_MS: return "timeout-in-milliseconds";
|
||||
/* XXX nonreentrant */
|
||||
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
|
||||
return (nbuf);
|
||||
diff --git a/resolv/res_init.c b/resolv/res_init.c
|
||||
index c58c763..d00a7b0 100644
|
||||
--- a/resolv/res_init.c
|
||||
+++ b/resolv/res_init.c
|
||||
@@ -501,11 +501,20 @@ res_setoptions(res_state statp, const char *options, const char *source) {
|
||||
printf(";;\tndots=%d\n", statp->ndots);
|
||||
#endif
|
||||
} else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) {
|
||||
+ statp->options &= ~RES_TIMEOUT_MS;
|
||||
i = atoi(cp + sizeof("timeout:") - 1);
|
||||
if (i <= RES_MAXRETRANS)
|
||||
statp->retrans = i;
|
||||
else
|
||||
statp->retrans = RES_MAXRETRANS;
|
||||
+ } else if (!strncmp(cp, "timeout-ms:",
|
||||
+ sizeof("timeout-ms:") - 1)) {
|
||||
+ statp->options |= RES_TIMEOUT_MS;
|
||||
+ i = atoi(cp + sizeof("timeout-ms:") - 1);
|
||||
+ if (i <= RES_MAXRETRANS * 1000)
|
||||
+ statp->retrans = i;
|
||||
+ else
|
||||
+ statp->retrans = RES_MAXRETRANS * 1000;
|
||||
} else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){
|
||||
i = atoi(cp + sizeof("attempts:") - 1);
|
||||
if (i <= RES_MAXRETRY)
|
||||
diff --git a/resolv/res_send.c b/resolv/res_send.c
|
||||
index 0a28cd7..4d45335 100644
|
||||
--- a/resolv/res_send.c
|
||||
+++ b/resolv/res_send.c
|
||||
@@ -1008,11 +1008,29 @@ send_dg(res_state statp,
|
||||
/*
|
||||
* Compute time for the total operation.
|
||||
*/
|
||||
- int seconds = (statp->retrans << ns);
|
||||
+ int operation_time;
|
||||
+ if (statp->retrans > (INT_MAX >> ns)) {
|
||||
+ /*
|
||||
+ * Saturate operation_time if it would have exceeded INT_MAX
|
||||
+ */
|
||||
+ operation_time = INT_MAX;
|
||||
+ } else {
|
||||
+ operation_time = (statp->retrans << ns);
|
||||
+ }
|
||||
if (ns > 0)
|
||||
- seconds /= statp->nscount;
|
||||
- if (seconds <= 0)
|
||||
+ operation_time /= statp->nscount;
|
||||
+ time_t seconds;
|
||||
+ long milliseconds;
|
||||
+ if (operation_time <= 0) {
|
||||
seconds = 1;
|
||||
+ milliseconds = 0;
|
||||
+ } else if ((statp->options & RES_TIMEOUT_MS) != 0) {
|
||||
+ seconds = operation_time / 1000;
|
||||
+ milliseconds = operation_time % 1000;
|
||||
+ } else {
|
||||
+ seconds = operation_time;
|
||||
+ milliseconds = 0;
|
||||
+ }
|
||||
bool single_request = (statp->options & RES_SNGLKUP) != 0;
|
||||
bool single_request_reopen = (statp->options & RES_SNGLKUPREOP) != 0;
|
||||
int save_gotsomewhere = *gotsomewhere;
|
||||
@@ -1025,7 +1043,7 @@ send_dg(res_state statp,
|
||||
return retval;
|
||||
retry:
|
||||
evNowTime(&now);
|
||||
- evConsTime(&timeout, seconds, 0);
|
||||
+ evConsTime(&timeout, seconds, milliseconds * 1000000L);
|
||||
evAddTime(&finish, &now, &timeout);
|
||||
int need_recompute = 0;
|
||||
int nwritten = 0;
|
||||
diff --git a/resolv/resolv.h b/resolv/resolv.h
|
||||
index ed15a70..f09754a 100644
|
||||
--- a/resolv/resolv.h
|
||||
+++ b/resolv/resolv.h
|
||||
@@ -97,7 +97,7 @@ typedef res_sendhookact (*res_send_rhook
|
||||
# define MAXRESOLVSORT 10 /* number of net to sort on */
|
||||
# define RES_MAXNDOTS 15 /* should reflect bit field size */
|
||||
# define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */
|
||||
-# define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */
|
||||
+# define RES_MAXRETRY 15 /* only for resolv.conf/RES_OPTIONS */
|
||||
# define RES_DFLRETRY 2 /* Default #/tries. */
|
||||
# define RES_MAXTIME 65535 /* Infinity, in milliseconds. */
|
||||
|
||||
@@ -221,6 +221,8 @@ struct res_sym {
|
||||
#define RES_USE_DNSSEC 0x00800000 /* use DNSSEC using OK bit in OPT */
|
||||
#define RES_NOTLDQUERY 0x01000000 /* Do not look up unqualified name
|
||||
as a TLD. */
|
||||
+#define RES_TIMEOUT_MS 0x02000000 /* Timeout is specified in
|
||||
+ milliseconds instead of seconds. */
|
||||
|
||||
#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
|
||||
|
||||
--
|
||||
1.7.7.3
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 86b7236edcb4e1719a0da7273128286b3fda20eb Mon Sep 17 00:00:00 2001
|
||||
From: Ahmad Sharif <asharif@chromium.org>
|
||||
Date: Tue, 24 Apr 2012 11:19:19 -0700
|
||||
Subject: [PATCH] Added TLS size to stack size if it's lower than 16 *
|
||||
TLS_SIZE.
|
||||
|
||||
Under normal circumstances, the TLS size is substracted from the stack size
|
||||
before allocaton. This can cause the application to crash if the TLS size is
|
||||
close to the stack size.
|
||||
---
|
||||
nptl/allocatestack.c | 3 +++
|
||||
1 files changed, 3 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
|
||||
index 79c4531..7864c8c 100644
|
||||
--- a/nptl/allocatestack.c
|
||||
+++ b/nptl/allocatestack.c
|
||||
@@ -463,6 +463,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
|
||||
size += pagesize_m1 + 1;
|
||||
#endif
|
||||
|
||||
+ if (size < 16 * __static_tls_size)
|
||||
+ size = roundup (size + __static_tls_size, pagesize_m1 + 1);
|
||||
+
|
||||
/* Adjust the stack size for alignment. */
|
||||
size &= ~__static_tls_align_m1;
|
||||
assert (size != 0);
|
||||
--
|
||||
1.7.7.3
|
||||
|
@ -1,39 +0,0 @@
|
||||
2010-08-11 Magnus Granberg <zorry@ume.nu>
|
||||
|
||||
#332331
|
||||
* Makeconfig (+link): Set to +link-pie.
|
||||
(+link-static): Change $(static-start-installed-name) to
|
||||
S$(static-start-installed-name).
|
||||
(+prector): Set to +prectorS.
|
||||
(+postctor): Set to +postctorS.
|
||||
|
||||
--- libc/Makeconfig
|
||||
+++ libc/Makeconfig
|
||||
@@ -447,11 +447,12 @@
|
||||
$(common-objpfx)libc% $(+postinit),$^) \
|
||||
$(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
|
||||
endif
|
||||
++link = $(+link-pie)
|
||||
# Command for statically linking programs with the C library.
|
||||
ifndef +link-static
|
||||
+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
|
||||
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||||
- $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
|
||||
+ $(addprefix $(csu-objpfx),S$(static-start-installed-name)) \
|
||||
$(+preinit) $(+prector) \
|
||||
$(filter-out $(addprefix $(csu-objpfx),start.o \
|
||||
$(start-installed-name))\
|
||||
@@ -549,11 +550,10 @@
|
||||
ifeq ($(elf),yes)
|
||||
+preinit = $(addprefix $(csu-objpfx),crti.o)
|
||||
+postinit = $(addprefix $(csu-objpfx),crtn.o)
|
||||
-+prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o`
|
||||
-+postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
|
||||
-# Variants of the two previous definitions for linking PIE programs.
|
||||
+prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o`
|
||||
+postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
|
||||
++prector = $(+prectorS)
|
||||
++postctor = $(+postctorS)
|
||||
+interp = $(addprefix $(elf-objpfx),interp.os)
|
||||
endif
|
||||
csu-objpfx = $(common-objpfx)csu/
|
@ -1,321 +0,0 @@
|
||||
/* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* Copyright (C) 2006-2007 Gentoo Foundation Inc.
|
||||
* License terms as above.
|
||||
*
|
||||
* Hardened Gentoo SSP handler
|
||||
*
|
||||
* An SSP failure handler that does not use functions from the rest of
|
||||
* glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures
|
||||
* no possibility of recursion into the handler.
|
||||
*
|
||||
* Direct all bug reports to http://bugs.gentoo.org/
|
||||
*
|
||||
* Re-written from the glibc-2.3 Hardened Gentoo SSP handler
|
||||
* by Kevin F. Quinn - <kevquinn[@]gentoo.org>
|
||||
*
|
||||
* The following people contributed to the glibc-2.3 Hardened
|
||||
* Gentoo SSP handler, from which this implementation draws much:
|
||||
*
|
||||
* Ned Ludd - <solar[@]gentoo.org>
|
||||
* Alexander Gabert - <pappy[@]gentoo.org>
|
||||
* The PaX Team - <pageexec[@]freemail.hu>
|
||||
* Peter S. Mazinger - <ps.m[@]gmx.net>
|
||||
* Yoann Vandoorselaere - <yoann[@]prelude-ids.org>
|
||||
* Robert Connolly - <robert[@]linuxfromscratch.org>
|
||||
* Cory Visi <cory[@]visi.name>
|
||||
* Mike Frysinger <vapier[@]gentoo.org>
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sysdep-cancel.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <bp-checks.h>
|
||||
|
||||
#include <kernel-features.h>
|
||||
|
||||
#include <alloca.h>
|
||||
/* from sysdeps */
|
||||
#include <socketcall.h>
|
||||
/* for the stuff in bits/socket.h */
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
|
||||
/* Sanity check on SYSCALL macro names - force compilation
|
||||
* failure if the names used here do not exist
|
||||
*/
|
||||
#if !defined __NR_socketcall && !defined __NR_socket
|
||||
# error Cannot do syscall socket or socketcall
|
||||
#endif
|
||||
#if !defined __NR_socketcall && !defined __NR_connect
|
||||
# error Cannot do syscall connect or socketcall
|
||||
#endif
|
||||
#ifndef __NR_write
|
||||
# error Cannot do syscall write
|
||||
#endif
|
||||
#ifndef __NR_close
|
||||
# error Cannot do syscall close
|
||||
#endif
|
||||
#ifndef __NR_getpid
|
||||
# error Cannot do syscall getpid
|
||||
#endif
|
||||
#ifndef __NR_kill
|
||||
# error Cannot do syscall kill
|
||||
#endif
|
||||
#ifndef __NR_exit
|
||||
# error Cannot do syscall exit
|
||||
#endif
|
||||
#ifdef SSP_SMASH_DUMPS_CORE
|
||||
# define ENABLE_SSP_SMASH_DUMPS_CORE 1
|
||||
# if !defined _KERNEL_NSIG && !defined _NSIG
|
||||
# error No _NSIG or _KERNEL_NSIG for rt_sigaction
|
||||
# endif
|
||||
# if !defined __NR_sigaction && !defined __NR_rt_sigaction
|
||||
# error Cannot do syscall sigaction or rt_sigaction
|
||||
# endif
|
||||
/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size
|
||||
* of the _kernel_ sigset_t which is not the same as the user sigset_t.
|
||||
* Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for
|
||||
* some reason.
|
||||
*/
|
||||
# ifdef _KERNEL_NSIG
|
||||
# define _SSP_NSIG _KERNEL_NSIG
|
||||
# else
|
||||
# define _SSP_NSIG _NSIG
|
||||
# endif
|
||||
#else
|
||||
# define _SSP_NSIG 0
|
||||
# define ENABLE_SSP_SMASH_DUMPS_CORE 0
|
||||
#endif
|
||||
|
||||
/* Define DO_SIGACTION - default to newer rt signal interface but
|
||||
* fallback to old as needed.
|
||||
*/
|
||||
#ifdef __NR_rt_sigaction
|
||||
# define DO_SIGACTION(signum, act, oldact) \
|
||||
INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8)
|
||||
#else
|
||||
# define DO_SIGACTION(signum, act, oldact) \
|
||||
INLINE_SYSCALL(sigaction, 3, signum, act, oldact)
|
||||
#endif
|
||||
|
||||
/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */
|
||||
#if defined(__NR_socket) && defined(__NR_connect)
|
||||
# define USE_OLD_SOCKETCALL 0
|
||||
#else
|
||||
# define USE_OLD_SOCKETCALL 1
|
||||
#endif
|
||||
/* stub out the __NR_'s so we can let gcc optimize away dead code */
|
||||
#ifndef __NR_socketcall
|
||||
# define __NR_socketcall 0
|
||||
#endif
|
||||
#ifndef __NR_socket
|
||||
# define __NR_socket 0
|
||||
#endif
|
||||
#ifndef __NR_connect
|
||||
# define __NR_connect 0
|
||||
#endif
|
||||
#define DO_SOCKET(result, domain, type, protocol) \
|
||||
do { \
|
||||
if (USE_OLD_SOCKETCALL) { \
|
||||
socketargs[0] = domain; \
|
||||
socketargs[1] = type; \
|
||||
socketargs[2] = protocol; \
|
||||
socketargs[3] = 0; \
|
||||
result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \
|
||||
} else \
|
||||
result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \
|
||||
} while (0)
|
||||
#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \
|
||||
do { \
|
||||
if (USE_OLD_SOCKETCALL) { \
|
||||
socketargs[0] = sockfd; \
|
||||
socketargs[1] = (unsigned long int)serv_addr; \
|
||||
socketargs[2] = addrlen; \
|
||||
socketargs[3] = 0; \
|
||||
result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \
|
||||
} else \
|
||||
result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \
|
||||
} while (0)
|
||||
|
||||
#ifndef _PATH_LOG
|
||||
# define _PATH_LOG "/dev/log"
|
||||
#endif
|
||||
|
||||
static const char path_log[] = _PATH_LOG;
|
||||
|
||||
/* For building glibc with SSP switched on, define __progname to a
|
||||
* constant if building for the run-time loader, to avoid pulling
|
||||
* in more of libc.so into ld.so
|
||||
*/
|
||||
#ifdef IS_IN_rtld
|
||||
static char *__progname = "<rtld>";
|
||||
#else
|
||||
extern char *__progname;
|
||||
#endif
|
||||
|
||||
|
||||
/* Common handler code, used by stack_chk_fail and __stack_smash_handler
|
||||
* Inlined to ensure no self-references to the handler within itself.
|
||||
* Data static to avoid putting more than necessary on the stack,
|
||||
* to aid core debugging.
|
||||
*/
|
||||
__attribute__ ((__noreturn__ , __always_inline__))
|
||||
static inline void
|
||||
__hardened_gentoo_stack_chk_fail(char func[], int damaged)
|
||||
{
|
||||
#define MESSAGE_BUFSIZ 256
|
||||
static pid_t pid;
|
||||
static int plen, i;
|
||||
static char message[MESSAGE_BUFSIZ];
|
||||
static const char msg_ssa[] = ": stack smashing attack";
|
||||
static const char msg_inf[] = " in function ";
|
||||
static const char msg_ssd[] = "*** stack smashing detected ***: ";
|
||||
static const char msg_terminated[] = " - terminated\n";
|
||||
static const char msg_report[] = "Report to http://bugs.gentoo.org/\n";
|
||||
static const char msg_unknown[] = "<unknown>";
|
||||
static int log_socket, connect_result;
|
||||
static struct sockaddr_un sock;
|
||||
static unsigned long int socketargs[4];
|
||||
|
||||
/* Build socket address
|
||||
*/
|
||||
sock.sun_family = AF_UNIX;
|
||||
i = 0;
|
||||
while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1))) {
|
||||
sock.sun_path[i] = path_log[i];
|
||||
i++;
|
||||
}
|
||||
sock.sun_path[i] = '\0';
|
||||
|
||||
/* Try SOCK_DGRAM connection to syslog */
|
||||
connect_result = -1;
|
||||
DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0);
|
||||
if (log_socket != -1)
|
||||
DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
|
||||
if (connect_result == -1) {
|
||||
if (log_socket != -1)
|
||||
INLINE_SYSCALL(close, 1, log_socket);
|
||||
/* Try SOCK_STREAM connection to syslog */
|
||||
DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0);
|
||||
if (log_socket != -1)
|
||||
DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock));
|
||||
}
|
||||
|
||||
/* Build message. Messages are generated both in the old style and new style,
|
||||
* so that log watchers that are configured for the old-style message continue
|
||||
* to work.
|
||||
*/
|
||||
#define strconcat(str) \
|
||||
{i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \
|
||||
{\
|
||||
message[plen+i]=str[i];\
|
||||
i++;\
|
||||
}\
|
||||
plen+=i;}
|
||||
|
||||
/* R.Henderson post-gcc-4 style message */
|
||||
plen = 0;
|
||||
strconcat(msg_ssd);
|
||||
if (__progname != (char *)0)
|
||||
strconcat(__progname)
|
||||
else
|
||||
strconcat(msg_unknown);
|
||||
strconcat(msg_terminated);
|
||||
|
||||
/* Write out error message to STDERR, to syslog if open */
|
||||
INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
|
||||
if (connect_result != -1)
|
||||
INLINE_SYSCALL(write, 3, log_socket, message, plen);
|
||||
|
||||
/* Dr. Etoh pre-gcc-4 style message */
|
||||
plen = 0;
|
||||
if (__progname != (char *)0)
|
||||
strconcat(__progname)
|
||||
else
|
||||
strconcat(msg_unknown);
|
||||
strconcat(msg_ssa);
|
||||
strconcat(msg_inf);
|
||||
if (func != NULL)
|
||||
strconcat(func)
|
||||
else
|
||||
strconcat(msg_unknown);
|
||||
strconcat(msg_terminated);
|
||||
/* Write out error message to STDERR, to syslog if open */
|
||||
INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
|
||||
if (connect_result != -1)
|
||||
INLINE_SYSCALL(write, 3, log_socket, message, plen);
|
||||
|
||||
/* Direct reports to bugs.gentoo.org */
|
||||
plen=0;
|
||||
strconcat(msg_report);
|
||||
message[plen++]='\0';
|
||||
|
||||
/* Write out error message to STDERR, to syslog if open */
|
||||
INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen);
|
||||
if (connect_result != -1)
|
||||
INLINE_SYSCALL(write, 3, log_socket, message, plen);
|
||||
|
||||
if (log_socket != -1)
|
||||
INLINE_SYSCALL(close, 1, log_socket);
|
||||
|
||||
/* Suicide */
|
||||
pid = INLINE_SYSCALL(getpid, 0);
|
||||
|
||||
if (ENABLE_SSP_SMASH_DUMPS_CORE) {
|
||||
static struct sigaction default_abort_act;
|
||||
/* Remove any user-supplied handler for SIGABRT, before using it */
|
||||
default_abort_act.sa_handler = SIG_DFL;
|
||||
default_abort_act.sa_sigaction = NULL;
|
||||
__sigfillset(&default_abort_act.sa_mask);
|
||||
default_abort_act.sa_flags = 0;
|
||||
if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0)
|
||||
INLINE_SYSCALL(kill, 2, pid, SIGABRT);
|
||||
}
|
||||
|
||||
/* Note; actions cannot be added to SIGKILL */
|
||||
INLINE_SYSCALL(kill, 2, pid, SIGKILL);
|
||||
|
||||
/* In case the kill didn't work, exit anyway
|
||||
* The loop prevents gcc thinking this routine returns
|
||||
*/
|
||||
while (1)
|
||||
INLINE_SYSCALL(exit, 0);
|
||||
}
|
||||
|
||||
__attribute__ ((__noreturn__))
|
||||
void __stack_chk_fail(void)
|
||||
{
|
||||
__hardened_gentoo_stack_chk_fail(NULL, 0);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_OLD_SSP_COMPAT
|
||||
__attribute__ ((__noreturn__))
|
||||
void __stack_smash_handler(char func[], int damaged)
|
||||
{
|
||||
__hardened_gentoo_stack_chk_fail(func, damaged);
|
||||
}
|
||||
#endif
|
@ -1,313 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/common.eblit,v 1.28 2012/08/10 19:44:47 vapier Exp $
|
||||
|
||||
alt_prefix() {
|
||||
is_crosscompile && echo /usr/${CTARGET}
|
||||
}
|
||||
|
||||
# We need to be able to set alternative headers for
|
||||
# compiling for non-native platform
|
||||
# Will also become useful for testing kernel-headers without screwing up
|
||||
# the whole system.
|
||||
# note: intentionally undocumented.
|
||||
alt_headers() {
|
||||
echo ${ALT_HEADERS:=$(alt_prefix)/usr/include}
|
||||
}
|
||||
alt_build_headers() {
|
||||
if [[ -z ${ALT_BUILD_HEADERS} ]] ; then
|
||||
ALT_BUILD_HEADERS=$(alt_headers)
|
||||
if tc-is-cross-compiler ; then
|
||||
ALT_BUILD_HEADERS=${ROOT}$(alt_headers)
|
||||
if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then
|
||||
local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h')
|
||||
ALT_BUILD_HEADERS=${header_path%/linux/version.h}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "${ALT_BUILD_HEADERS}"
|
||||
}
|
||||
|
||||
alt_libdir() {
|
||||
echo $(alt_prefix)/$(get_libdir)
|
||||
}
|
||||
alt_usrlibdir() {
|
||||
echo $(alt_prefix)/usr/$(get_libdir)
|
||||
}
|
||||
|
||||
setup_target_flags() {
|
||||
# This largely mucks with compiler flags. None of which should matter
|
||||
# when building up just the headers.
|
||||
just_headers && return 0
|
||||
|
||||
# Needed as workaround to fix:
|
||||
# http://code.google.com/p/chromium-os/issues/detail?id=22373
|
||||
# Can be removed when we emerge glibc to the target:
|
||||
# http://code.google.com/p/chromium-os/issues/detail?id=20792
|
||||
append-cflags "-ggdb"
|
||||
|
||||
if ! use cros_host ; then
|
||||
# ChromiumOS: Need to unset the SYSROOT value so that the
|
||||
# compiler uses the default sysroot when building glibc. This
|
||||
# is because the glibc startup objects are needed to configure
|
||||
# glibc. We don't want to bootstrap libc again.
|
||||
export SYSROOT=""
|
||||
fi
|
||||
|
||||
# Never use gold to build glibc. Manually force GNU ld, whatever the actual settings are.
|
||||
# Glibc does not link with gold because of missing features. It also doesn't pass the
|
||||
# configure check.
|
||||
export CC="$(tc-getCC ${CTARGET}) -B$(get_binutils_path_ld ${CTARGET})"
|
||||
|
||||
case $(tc-arch) in
|
||||
x86)
|
||||
# -march needed for #185404 #199334
|
||||
if ! glibc_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then
|
||||
local t=${CTARGET_OPT:-${CTARGET}}
|
||||
t=${t%%-*}
|
||||
filter-flags '-march=*'
|
||||
export CFLAGS="-march=${t} ${CFLAGS}"
|
||||
einfo "Auto adding -march=${t} to CFLAGS #185404"
|
||||
fi
|
||||
;;
|
||||
amd64)
|
||||
# -march needed for #185404 #199334
|
||||
if ! glibc_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then
|
||||
local t=${CTARGET_OPT:-${CTARGET}}
|
||||
t=${t%%-*}
|
||||
filter-flags '-march=*'
|
||||
# ugly, ugly, ugly. ugly.
|
||||
CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}")
|
||||
export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
|
||||
einfo "Auto adding -march=${t} to CFLAGS_x86 #185404"
|
||||
fi
|
||||
;;
|
||||
ppc)
|
||||
append-flags "-freorder-blocks"
|
||||
;;
|
||||
sparc)
|
||||
# Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though.
|
||||
filter-flags "-fcall-used-g7"
|
||||
append-flags "-fcall-used-g6"
|
||||
filter-flags "-mvis"
|
||||
|
||||
GLIBCMAJOR=$(get_version_component_range 1 ${PV})
|
||||
GLIBCMINOR=$(get_version_component_range 2 ${PV})
|
||||
|
||||
# set CTARGET_OPT so glibc can use cpu-specific .S files for better performance
|
||||
# - UltraSPARC T1 (niagara) support requires >= glibc 2.8
|
||||
# - UltraSPARC T2 (niagara2) support requires >= glibc 2.7
|
||||
|
||||
if is_crosscompile || [[ ${PROFILE_ARCH} == "sparc64" ]] || { has_multilib_profile && ! tc-is-cross-compiler; } ; then
|
||||
case ${ABI}:${CTARGET} in
|
||||
sparc64:*|\
|
||||
default:sparc64*)
|
||||
filter-flags -Wa,-xarch -Wa,-A
|
||||
|
||||
if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
|
||||
CTARGET_OPT="sparc64v2-unknown-linux-gnu"
|
||||
append-flags "-Wa,-xarch=v9b"
|
||||
export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
|
||||
elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
|
||||
CTARGET_OPT="sparc64v-unknown-linux-gnu"
|
||||
append-flags "-Wa,-xarch=v9b"
|
||||
export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
|
||||
elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
|
||||
CTARGET_OPT="sparc64b-unknown-linux-gnu"
|
||||
append-flags "-Wa,-xarch=v9b"
|
||||
export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9b"
|
||||
else
|
||||
CTARGET_OPT="sparc64-unknown-linux-gnu"
|
||||
append-flags "-Wa,-xarch=v9a"
|
||||
export ASFLAGS="${ASFLAGS} -Wa,-xarch=v9a"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
|
||||
CTARGET_OPT="sparcv9v2-unknown-linux-gnu"
|
||||
elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
|
||||
CTARGET_OPT="sparcv9v-unknown-linux-gnu"
|
||||
elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
|
||||
CTARGET_OPT="sparcv9b-unknown-linux-gnu"
|
||||
else
|
||||
CTARGET_OPT="sparcv9-unknown-linux-gnu"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
if is-flagq "-mcpu=niagara2" && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.7 ]] ; then
|
||||
CTARGET_OPT="sparcv9v2-unknown-linux-gnu"
|
||||
elif { is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2" ; } && [[ ${GLIBCMAJOR}.${GLIBCMINOR} > 2.6 ]] ; then
|
||||
CTARGET_OPT="sparcv9v-unknown-linux-gnu"
|
||||
elif is-flagq "-mcpu=ultrasparc3" || is-flagq "-mcpu=niagara" || is-flagq "-mcpu=niagara2"; then
|
||||
CTARGET_OPT="sparcv9b-unknown-linux-gnu"
|
||||
elif { is_crosscompile && want_nptl; } || is-flagq "-mcpu=ultrasparc2" || is-flagq "-mcpu=ultrasparc"; then
|
||||
CTARGET_OPT="sparcv9-unknown-linux-gnu"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
setup_flags() {
|
||||
# Make sure host make.conf doesn't pollute us
|
||||
if is_crosscompile || tc-is-cross-compiler ; then
|
||||
CHOST=${CTARGET} strip-unsupported-flags
|
||||
fi
|
||||
|
||||
# Store our CFLAGS because it's changed depending on which CTARGET
|
||||
# we are building when pulling glibc on a multilib profile
|
||||
CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}}
|
||||
CFLAGS=${CFLAGS_BASE}
|
||||
CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}}
|
||||
CXXFLAGS=${CXXFLAGS_BASE}
|
||||
ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}}
|
||||
ASFLAGS=${ASFLAGS_BASE}
|
||||
|
||||
# Over-zealous CFLAGS can often cause problems. What may work for one
|
||||
# person may not work for another. To avoid a large influx of bugs
|
||||
# relating to failed builds, we strip most CFLAGS out to ensure as few
|
||||
# problems as possible.
|
||||
strip-flags
|
||||
strip-unsupported-flags
|
||||
filter-flags -m32 -m64 -mabi=*
|
||||
|
||||
unset CBUILD_OPT CTARGET_OPT
|
||||
if has_multilib_profile ; then
|
||||
CTARGET_OPT=$(get_abi_CTARGET)
|
||||
[[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST)
|
||||
fi
|
||||
|
||||
setup_target_flags
|
||||
|
||||
if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then
|
||||
CBUILD_OPT=${CTARGET_OPT}
|
||||
fi
|
||||
|
||||
# Lock glibc at -O2 -- linuxthreads needs it and we want to be
|
||||
# conservative here. -fno-strict-aliasing is to work around #155906
|
||||
filter-flags -O?
|
||||
append-flags -O2 -fno-strict-aliasing
|
||||
|
||||
# Can't build glibc itself with fortify code. Newer versions add
|
||||
# this flag for us, so no need to do it manually.
|
||||
version_is_at_least 2.16 ${PV} || append-cppflags -U_FORTIFY_SOURCE
|
||||
|
||||
# Undefine USE_NSCD to disable of the use of nscd implementation
|
||||
# in glibc functions (crosbug.com/21924).
|
||||
append-cppflags -UUSE_NSCD
|
||||
|
||||
# building glibc with SSP is fraught with difficulty, especially
|
||||
# due to __stack_chk_fail_local which would mean significant changes
|
||||
# to the glibc build process. See bug #94325 #293721
|
||||
use hardened && gcc-ssp && append-cflags $(test-flags-CC -fno-stack-protector)
|
||||
|
||||
if use hardened && gcc-pie; then
|
||||
# Force PIC macro definition for all compilations since they're all
|
||||
# either -fPIC or -fPIE with the default-PIE compiler.
|
||||
append-cppflags -DPIC
|
||||
else
|
||||
# Don't build -fPIE without the default-PIE compiler and the
|
||||
# hardened-pie patch
|
||||
filter-flags -fPIE
|
||||
fi
|
||||
}
|
||||
|
||||
want_nptl() {
|
||||
[[ -z ${LT_VER} ]] && return 0
|
||||
want_tls || return 1
|
||||
use nptl || return 1
|
||||
|
||||
# Only list the arches that cannot do NPTL
|
||||
case $(tc-arch) in
|
||||
m68k) return 1;;
|
||||
sparc)
|
||||
# >= v9 is needed for nptl.
|
||||
[[ ${PROFILE_ARCH} == "sparc" ]] && return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
want_linuxthreads() {
|
||||
[[ -z ${LT_VER} ]] && return 1
|
||||
use linuxthreads
|
||||
}
|
||||
|
||||
want_tls() {
|
||||
# Archs that can use TLS (Thread Local Storage)
|
||||
case $(tc-arch) in
|
||||
x86)
|
||||
# requires i486 or better #106556
|
||||
[[ ${CTARGET} == i[4567]86* ]] && return 0
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
want__thread() {
|
||||
want_tls || return 1
|
||||
|
||||
# For some reason --with-tls --with__thread is causing segfaults on sparc32.
|
||||
[[ ${PROFILE_ARCH} == "sparc" ]] && return 1
|
||||
|
||||
[[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD}
|
||||
|
||||
# only test gcc -- cant test linking yet
|
||||
tc-has-tls -c ${CTARGET}
|
||||
WANT__THREAD=$?
|
||||
|
||||
return ${WANT__THREAD}
|
||||
}
|
||||
|
||||
use_multiarch() {
|
||||
# Make sure binutils is new enough to support indirect functions #336792
|
||||
local bver nver
|
||||
bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}')
|
||||
case $(tc-arch ${CTARGET}) in
|
||||
amd64|x86) nver="2.20" ;;
|
||||
sparc) nver="2.21" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
version_is_at_least ${nver} ${bver}
|
||||
}
|
||||
|
||||
# Setup toolchain variables that had historically
|
||||
# been defined in the profiles for these archs.
|
||||
setup_env() {
|
||||
# silly users
|
||||
unset LD_RUN_PATH
|
||||
|
||||
multilib_env ${CTARGET_OPT:-${CTARGET}}
|
||||
if is_crosscompile || tc-is-cross-compiler ; then
|
||||
if ! use multilib ; then
|
||||
MULTILIB_ABIS=${DEFAULT_ABI}
|
||||
else
|
||||
MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}}
|
||||
fi
|
||||
|
||||
# If the user has CFLAGS_<CTARGET> in their make.conf, use that,
|
||||
# and fall back on CFLAGS.
|
||||
local VAR=CFLAGS_${CTARGET//[-.]/_}
|
||||
CFLAGS=${!VAR-${CFLAGS}}
|
||||
fi
|
||||
|
||||
setup_flags
|
||||
|
||||
export ABI=${ABI:-${DEFAULT_ABI:-default}}
|
||||
|
||||
local VAR=CFLAGS_${ABI}
|
||||
# We need to export CFLAGS with abi information in them because glibc's
|
||||
# configure script checks CFLAGS for some targets (like mips). Keep
|
||||
# around the original clean value to avoid appending multiple ABIs on
|
||||
# top of each other.
|
||||
: ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})}
|
||||
export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}"
|
||||
}
|
||||
|
||||
just_headers() {
|
||||
is_crosscompile && use crosscompile_opts_headers-only
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_postinst.eblit,v 1.2 2012/04/15 20:04:44 vapier Exp $
|
||||
|
||||
eblit-glibc-pkg_postinst() {
|
||||
# nothing to do if just installing headers
|
||||
just_headers && return
|
||||
|
||||
if ! tc-is-cross-compiler && [[ -x ${ROOT}/usr/sbin/iconvconfig ]] ; then
|
||||
# Generate fastloading iconv module configuration file.
|
||||
"${ROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}"
|
||||
fi
|
||||
|
||||
if ! is_crosscompile && [[ ${ROOT} == "/" ]] ; then
|
||||
# Reload init ... if in a chroot or a diff init package, ignore
|
||||
# errors from this step #253697
|
||||
/sbin/telinit U 2>/dev/null
|
||||
|
||||
# if the host locales.gen contains no entries, we'll install everything
|
||||
local locale_list="${ROOT}etc/locale.gen"
|
||||
if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
|
||||
ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
|
||||
locale_list="${ROOT}usr/share/i18n/SUPPORTED"
|
||||
fi
|
||||
locale-gen -j $(makeopts_jobs) --config "${locale_list}"
|
||||
fi
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_preinst.eblit,v 1.6 2012/10/02 07:12:17 vapier Exp $
|
||||
|
||||
eblit-glibc-pkg_preinst() {
|
||||
# nothing to do if just installing headers
|
||||
just_headers && return
|
||||
|
||||
# prepare /etc/ld.so.conf.d/ for files
|
||||
mkdir -p "${ROOT}"/etc/ld.so.conf.d
|
||||
|
||||
# Default /etc/hosts.conf:multi to on for systems with small dbs.
|
||||
if [[ $(wc -l < "${ROOT}"/etc/hosts) -lt 1000 ]] ; then
|
||||
sed -i '/^multi off/s:off:on:' "${D}"/etc/host.conf
|
||||
elog "Defaulting /etc/host.conf:multi to on"
|
||||
fi
|
||||
|
||||
# simple test to make sure our new glibc isnt completely broken.
|
||||
# make sure we don't test with statically built binaries since
|
||||
# they will fail. also, skip if this glibc is a cross compiler.
|
||||
[[ ${ROOT} != "/" ]] && return 0
|
||||
[[ -d ${D}/$(get_libdir) ]] || return 0
|
||||
cd / #228809
|
||||
local x striptest
|
||||
for x in date env ls true uname ; do
|
||||
x=$(type -p ${x})
|
||||
[[ -z ${x} ]] && continue
|
||||
striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null)
|
||||
[[ -z ${striptest} ]] && continue
|
||||
[[ ${striptest} == *"statically linked"* ]] && continue
|
||||
# we enter ${D} so to avoid trouble if the path contains
|
||||
# special characters; for instance if the path contains the
|
||||
# colon character (:), then the linker will try to split it
|
||||
# and look for the libraries in an unexpected place. This can
|
||||
# lead to unsafe code execution if the generated prefix is
|
||||
# within a world-writable directory
|
||||
# (e.g. /var/tmp/portage:${HOSTNAME})
|
||||
pushd "${D}"/$(get_libdir) 2>/dev/null
|
||||
./ld-*.so --library-path . ${x} > /dev/null \
|
||||
|| die "simple run test (${x}) failed"
|
||||
popd 2>/dev/null
|
||||
done
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
# Copyright 1999-2011 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_setup.eblit,v 1.10 2011/12/14 16:42:46 vapier Exp $
|
||||
|
||||
glibc_compile_test() {
|
||||
local ret save_cflags=${CFLAGS}
|
||||
CFLAGS+=" $1"
|
||||
shift
|
||||
|
||||
pushd "${T}" >/dev/null
|
||||
|
||||
rm -f glibc-test*
|
||||
printf '%b' "$*" > glibc-test.c
|
||||
|
||||
emake -s glibc-test
|
||||
ret=$?
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
CFLAGS=${save_cflags}
|
||||
return ${ret}
|
||||
}
|
||||
|
||||
glibc_run_test() {
|
||||
local ret
|
||||
|
||||
if [[ ${EMERGE_FROM} == "binary" ]] ; then
|
||||
# ignore build failures when installing a binary package #324685
|
||||
glibc_compile_test "" "$@" 2>/dev/null || return 0
|
||||
else
|
||||
if ! glibc_compile_test "" "$@" ; then
|
||||
ewarn "Simple build failed ... assuming this is desired #324685"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
pushd "${T}" >/dev/null
|
||||
|
||||
./glibc-test
|
||||
ret=$?
|
||||
rm -f glibc-test*
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
return ${ret}
|
||||
}
|
||||
|
||||
eblit-glibc-pkg_setup() {
|
||||
# prevent native builds from downgrading ... maybe update to allow people
|
||||
# to change between diff -r versions ? (2.3.6-r4 -> 2.3.6-r2)
|
||||
if [[ ${ROOT} == "/" ]] && [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
|
||||
if has_version '>'${CATEGORY}/${PF} ; then
|
||||
eerror "Sanity check to keep you from breaking your system:"
|
||||
eerror " Downgrading glibc is not supported and a sure way to destruction"
|
||||
die "aborting to save your system"
|
||||
fi
|
||||
|
||||
if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n'
|
||||
then
|
||||
eerror "Your patched vendor kernel is broken. You need to get an"
|
||||
eerror "update from whoever is providing the kernel to you."
|
||||
eerror "http://sourceware.org/bugzilla/show_bug.cgi?id=5227"
|
||||
eerror "http://bugs.gentoo.org/262698"
|
||||
die "keeping your system alive, say thank you"
|
||||
fi
|
||||
|
||||
if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n'
|
||||
then
|
||||
eerror "Your old kernel is broken. You need to update it to"
|
||||
eerror "a newer version as syscall(<bignum>) will break."
|
||||
eerror "http://bugs.gentoo.org/279260"
|
||||
die "keeping your system alive, say thank you"
|
||||
fi
|
||||
fi
|
||||
|
||||
# users have had a chance to phase themselves, time to give em the boot
|
||||
if [[ -e ${ROOT}/etc/locale.gen ]] && [[ -e ${ROOT}/etc/locales.build ]] ; then
|
||||
eerror "You still haven't deleted ${ROOT}/etc/locales.build."
|
||||
eerror "Do so now after making sure ${ROOT}/etc/locale.gen is kosher."
|
||||
die "lazy upgrader detected"
|
||||
fi
|
||||
|
||||
if [[ ${CTARGET} == i386-* ]] ; then
|
||||
eerror "i386 CHOSTs are no longer supported."
|
||||
eerror "Chances are you don't actually want/need i386."
|
||||
eerror "Please read http://www.gentoo.org/doc/en/change-chost.xml"
|
||||
die "please fix your CHOST"
|
||||
fi
|
||||
|
||||
if [[ -e /proc/xen ]] && [[ $(tc-arch) == "x86" ]] && ! is-flag -mno-tls-direct-seg-refs ; then
|
||||
ewarn "You are using Xen but don't have -mno-tls-direct-seg-refs in your CFLAGS."
|
||||
ewarn "This will result in a 50% performance penalty when running with a 32bit"
|
||||
ewarn "hypervisor, which is probably not what you want."
|
||||
fi
|
||||
|
||||
use hardened && ! gcc-specs-pie && \
|
||||
ewarn "PIE hardening not applied, as your compiler doesn't default to PIE"
|
||||
|
||||
# Make sure host system is up to date #394453
|
||||
if has_version '<sys-libs/glibc-2.13' && \
|
||||
[[ -n $(scanelf -qys__guard -F'#s%F' "${ROOT}"/lib*/l*-*.so) ]]
|
||||
then
|
||||
ebegin "Scanning system for __guard to see if you need to rebuild first ..."
|
||||
local files=$(
|
||||
scanelf -qys__guard -F'#s%F' \
|
||||
"${ROOT}"/*bin/ \
|
||||
"${ROOT}"/lib* \
|
||||
"${ROOT}"/usr/*bin/ \
|
||||
"${ROOT}"/usr/lib* | \
|
||||
egrep -v \
|
||||
-e "^${ROOT}/lib.*/(libc|ld)-2.*.so$" \
|
||||
-e "^${ROOT}/sbin/(ldconfig|sln)$"
|
||||
)
|
||||
[[ -z ${files} ]]
|
||||
if ! eend $? ; then
|
||||
eerror "Your system still has old SSP __guard symbols. You need to"
|
||||
eerror "rebuild all the packages that provide these files first:"
|
||||
eerror "${files}"
|
||||
die "old __guard detected"
|
||||
fi
|
||||
fi
|
||||
}
|
@ -1,236 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_compile.eblit,v 1.29 2012/11/18 08:06:49 vapier Exp $
|
||||
|
||||
glibc_do_configure() {
|
||||
local myconf
|
||||
|
||||
einfo "Configuring GLIBC for $1"
|
||||
|
||||
# set addons
|
||||
pushd "${S}" > /dev/null
|
||||
local ADDONS=$(echo */configure | sed \
|
||||
-e 's:/configure::g' \
|
||||
-e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \
|
||||
-e 's: \+$::' \
|
||||
-e 's! !,!g' \
|
||||
-e 's!^!,!' \
|
||||
-e '/^,\*$/d')
|
||||
[[ -d ports ]] && ADDONS="${ADDONS},ports"
|
||||
popd > /dev/null
|
||||
|
||||
myconf="${myconf} $(use_enable hardened stackguard-randomization)"
|
||||
if has_version '<sys-libs/glibc-2.13' ; then
|
||||
myconf="${myconf} --enable-old-ssp-compat"
|
||||
fi
|
||||
|
||||
[[ ${CTARGET//_/-} == *-softfloat-* ]] && myconf="${myconf} --without-fp"
|
||||
|
||||
if [[ $1 == "linuxthreads" ]] ; then
|
||||
if want_tls ; then
|
||||
myconf="${myconf} --with-tls"
|
||||
|
||||
if ! want__thread || use glibc-compat20 || [[ ${LT_KER_VER} == 2.[02].* ]] ; then
|
||||
myconf="${myconf} --without-__thread"
|
||||
else
|
||||
myconf="${myconf} --with-__thread"
|
||||
fi
|
||||
else
|
||||
myconf="${myconf} --without-tls --without-__thread"
|
||||
fi
|
||||
|
||||
myconf="${myconf} --disable-sanity-checks"
|
||||
myconf="${myconf} --enable-add-ons=linuxthreads${ADDONS}"
|
||||
myconf="${myconf} --enable-kernel=${LT_KER_VER}"
|
||||
elif [[ $1 == "nptl" ]] ; then
|
||||
myconf="${myconf} --enable-add-ons=nptl${ADDONS}"
|
||||
myconf="${myconf} --enable-kernel=${NPTL_KERN_VER}"
|
||||
else
|
||||
die "invalid pthread option"
|
||||
fi
|
||||
|
||||
# Since SELinux support is only required for nscd, only enable it if:
|
||||
# 1. USE selinux
|
||||
# 2. only for the primary ABI on multilib systems
|
||||
# 3. Not a crosscompile
|
||||
if ! is_crosscompile && use selinux ; then
|
||||
if use multilib || has_multilib_profile ; then
|
||||
if is_final_abi ; then
|
||||
myconf="${myconf} --with-selinux"
|
||||
else
|
||||
myconf="${myconf} --without-selinux"
|
||||
fi
|
||||
else
|
||||
myconf="${myconf} --with-selinux"
|
||||
fi
|
||||
else
|
||||
myconf="${myconf} --without-selinux"
|
||||
fi
|
||||
|
||||
myconf="${myconf}
|
||||
--without-cvs
|
||||
--enable-bind-now
|
||||
--build=${CBUILD_OPT:-${CBUILD}}
|
||||
--host=${CTARGET_OPT:-${CTARGET}}
|
||||
$(use_enable profile)
|
||||
$(use_with gd)
|
||||
--with-headers=$(alt_build_headers)
|
||||
--prefix=/usr
|
||||
--libdir=/usr/$(get_libdir)
|
||||
--mandir=/usr/share/man
|
||||
--infodir=/usr/share/info
|
||||
--libexecdir=/usr/$(get_libdir)/misc/glibc
|
||||
$(use_multiarch || echo --disable-multi-arch)
|
||||
--enable-obsolete-rpc
|
||||
$(in_iuse systemtap && use_enable systemtap)
|
||||
${EXTRA_ECONF}"
|
||||
|
||||
# There is no configure option for this and we need to export it
|
||||
# since the glibc build will re-run configure on itself
|
||||
export libc_cv_slibdir=/$(get_libdir)
|
||||
|
||||
# We take care of patching our binutils to use both hash styles,
|
||||
# and many people like to force gnu hash style only, so disable
|
||||
# this overriding check. #347761
|
||||
export libc_cv_hashstyle=no
|
||||
|
||||
local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-$1
|
||||
mkdir -p "${GBUILDDIR}"
|
||||
cd "${GBUILDDIR}"
|
||||
echo "${S}"/configure ${myconf}
|
||||
"${S}"/configure ${myconf} || die "failed to configure glibc"
|
||||
|
||||
# ia64 static cross-compilers are a pita in so much that they
|
||||
# can't produce static ELFs (as the libgcc.a is broken). so
|
||||
# disable building of the programs for those targets if it
|
||||
# doesn't work.
|
||||
# XXX: We could turn this into a compiler test, but ia64 is
|
||||
# the only one that matters, so this should be fine for now.
|
||||
if is_crosscompile && [[ ${CTARGET} == ia64* ]] ; then
|
||||
sed -i '1i+link-static = touch $@' config.make
|
||||
fi
|
||||
}
|
||||
|
||||
toolchain-glibc_src_compile() {
|
||||
echo
|
||||
local v
|
||||
for v in ABI CBUILD CHOST CTARGET CBUILD_OPT CTARGET_OPT CC {AS,C,CPP,CXX,LD}FLAGS ; do
|
||||
einfo " $(printf '%15s' ${v}:) ${!v}"
|
||||
done
|
||||
export CC=$(tc-getCC ${CTARGET})
|
||||
# At this stage, gcc adds hardened options regardless of "use hardened"
|
||||
# or not. So for arm glibc compile, currently manually disable stack
|
||||
# protector and pie for every c and assembly file.
|
||||
# Note - change to CFLAGS is not enough - at configuring time, $(CC)
|
||||
# will be tested whether "PIC" by default is enabled, we have to disable
|
||||
# this at first time (configuration time).
|
||||
if [[ "$CTARGET" == arm* ]]; then
|
||||
CC="$CC -fno-stack-protector"
|
||||
# We have to live with both vanilla gcc (has no option -nopie)
|
||||
# and hardened gcc (has option -nopie).
|
||||
CC="$CC $(test-flags-CC -nopie)"
|
||||
CC="$CC $(test-flags-CC -fno-pie)"
|
||||
fi
|
||||
einfo " $(printf '%15s' 'Manual CC:') ${CC}"
|
||||
echo
|
||||
|
||||
if want_linuxthreads ; then
|
||||
glibc_do_configure linuxthreads
|
||||
emake || die "make for ${ABI} failed"
|
||||
fi
|
||||
if want_nptl ; then
|
||||
# ... and then do the optional nptl build
|
||||
unset LD_ASSUME_KERNEL
|
||||
glibc_do_configure nptl
|
||||
emake || die "make for ${ABI} failed"
|
||||
fi
|
||||
}
|
||||
|
||||
toolchain-glibc_headers_compile() {
|
||||
local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
|
||||
mkdir -p "${GBUILDDIR}"
|
||||
cd "${GBUILDDIR}"
|
||||
|
||||
# if we don't have a compiler yet, we cant really test it now ...
|
||||
# hopefully they don't affect header geneation, so let's hope for
|
||||
# the best here ...
|
||||
export \
|
||||
ac_cv_header_cpuid_h=yes \
|
||||
libc_cv_{386,390,alpha,arm,hppa,ia64,mips,{powerpc,sparc}{32,64},sh,x86_64}_tls=yes \
|
||||
libc_cv_asm_cfi_directives=yes \
|
||||
libc_cv_broken_visibility_attribute=no \
|
||||
libc_cv_gcc___thread=yes \
|
||||
libc_cv_mlong_double_128=yes \
|
||||
libc_cv_mlong_double_128ibm=yes \
|
||||
libc_cv_ppc_machine=yes \
|
||||
libc_cv_ppc_rel16=yes \
|
||||
libc_cv_predef_{fortify_source,stack_protector}=no \
|
||||
libc_cv_visibility_attribute=yes \
|
||||
libc_cv_z_combreloc=yes \
|
||||
libc_cv_z_execstack=yes \
|
||||
libc_cv_z_initfirst=yes \
|
||||
libc_cv_z_nodelete=yes \
|
||||
libc_cv_z_nodlopen=yes \
|
||||
libc_cv_z_relro=yes
|
||||
|
||||
# Pick out the correct location for build headers
|
||||
local ports="" myconf="--disable-sanity-checks --enable-hacker-mode"
|
||||
[[ -d ${S}/ports ]] && ports=",ports"
|
||||
myconf="${myconf}
|
||||
--enable-add-ons=nptl${ports}
|
||||
--without-cvs
|
||||
--enable-bind-now
|
||||
--build=${CBUILD_OPT:-${CBUILD}}
|
||||
--host=${CTARGET_OPT:-${CTARGET}}
|
||||
--with-headers=$(alt_build_headers)
|
||||
--prefix=/usr
|
||||
${EXTRA_ECONF}"
|
||||
|
||||
# Nothing is compiled here which would affect the headers for the target.
|
||||
# so forcing CC/CFLAGS is sane. unless you dont have `gcc`. then i
|
||||
# dont care :p.
|
||||
echo "${S}"/configure ${myconf}
|
||||
CC=gcc \
|
||||
CFLAGS="-O1 -pipe" \
|
||||
CPPFLAGS="-U_FORTIFY_SOURCE" \
|
||||
LDFLAGS="" \
|
||||
"${S}"/configure ${myconf} || die "failed to configure glibc"
|
||||
}
|
||||
|
||||
eblit-glibc-src_compile() {
|
||||
if is_crosscompile ; then
|
||||
export \
|
||||
libc_cv_c_cleanup=yes \
|
||||
libc_cv_forced_unwind=yes
|
||||
fi
|
||||
|
||||
if just_headers ; then
|
||||
export ABI=default
|
||||
toolchain-glibc_headers_compile
|
||||
return
|
||||
fi
|
||||
|
||||
setup_env
|
||||
|
||||
if [[ -z ${OABI} ]] ; then
|
||||
local abilist=""
|
||||
if has_multilib_profile ; then
|
||||
abilist=$(get_install_abis)
|
||||
elif is_crosscompile || tc-is-cross-compiler ; then
|
||||
abilist=${DEFAULT_ABI}
|
||||
fi
|
||||
einfo "Building glibc for ABIs: ${abilist}"
|
||||
if [[ -n ${abilist} ]] ; then
|
||||
OABI=${ABI}
|
||||
for ABI in ${abilist} ; do
|
||||
export ABI
|
||||
src_compile
|
||||
done
|
||||
ABI=${OABI}
|
||||
unset OABI
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
toolchain-glibc_src_compile
|
||||
}
|
@ -1,271 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_install.eblit,v 1.25 2012/11/11 07:24:55 vapier Exp $
|
||||
|
||||
toolchain-glibc_src_install() {
|
||||
local GBUILDDIR
|
||||
if want_linuxthreads ; then
|
||||
GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-linuxthreads
|
||||
else
|
||||
GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-nptl
|
||||
fi
|
||||
|
||||
local install_root="${D}$(alt_prefix)"
|
||||
if want_linuxthreads ; then
|
||||
cd "${WORKDIR}"/build-${ABI}-${CTARGET}-linuxthreads
|
||||
einfo "Installing GLIBC ${ABI} with linuxthreads ..."
|
||||
else
|
||||
cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
|
||||
einfo "Installing GLIBC ${ABI} with NPTL ..."
|
||||
fi
|
||||
emake install_root="${install_root}" install || die
|
||||
|
||||
if is_crosscompile ; then
|
||||
# punt all the junk not needed by a cross-compiler
|
||||
cd "${D}"/usr/${CTARGET} || die
|
||||
rm -rf ./{,usr/}{etc,share} ./{,usr/}*/misc
|
||||
|
||||
# Remove all executables except getent, ldd, and ldconfig.
|
||||
# See http://crosbug.com/1570
|
||||
find ./usr/bin -name getent -o -name ldd -o -type f -exec rm {} ';'
|
||||
find ./sbin -name ldconfig -o -type f -exec rm {} ';'
|
||||
rm -rf ./usr/sbin
|
||||
fi
|
||||
|
||||
if want_linuxthreads && want_nptl ; then
|
||||
einfo "Installing NPTL to $(alt_libdir)/tls/..."
|
||||
cd "${WORKDIR}"/build-${ABI}-${CTARGET}-nptl
|
||||
dodir $(alt_libdir)/tls $(alt_usrlibdir)/nptl
|
||||
|
||||
local l src_lib
|
||||
for l in libc libm librt libpthread libthread_db ; do
|
||||
# take care of shared lib first ...
|
||||
l=${l}.so
|
||||
if [[ -e ${l} ]] ; then
|
||||
src_lib=${l}
|
||||
else
|
||||
src_lib=$(eval echo */${l})
|
||||
fi
|
||||
cp -a ${src_lib} "${D}"$(alt_libdir)/tls/${l} || die "copying nptl ${l}"
|
||||
fperms a+rx $(alt_libdir)/tls/${l}
|
||||
dosym ${l} $(alt_libdir)/tls/$(scanelf -qSF'%S#F' ${src_lib})
|
||||
|
||||
# then grab the linker script or the symlink ...
|
||||
if [[ -L ${D}$(alt_usrlibdir)/${l} ]] ; then
|
||||
dosym $(alt_libdir)/tls/${l} $(alt_usrlibdir)/nptl/${l}
|
||||
else
|
||||
sed \
|
||||
-e "s:/${l}:/tls/${l}:g" \
|
||||
-e "s:/${l/%.so/_nonshared.a}:/nptl/${l/%.so/_nonshared.a}:g" \
|
||||
"${D}"$(alt_usrlibdir)/${l} > "${D}"$(alt_usrlibdir)/nptl/${l}
|
||||
fi
|
||||
|
||||
# then grab the static lib ...
|
||||
src_lib=${src_lib/%.so/.a}
|
||||
[[ ! -e ${src_lib} ]] && src_lib=${src_lib/%.a/_pic.a}
|
||||
cp -a ${src_lib} "${D}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
|
||||
src_lib=${src_lib/%.a/_nonshared.a}
|
||||
if [[ -e ${src_lib} ]] ; then
|
||||
cp -a ${src_lib} "${D}"$(alt_usrlibdir)/nptl/ || die "copying nptl ${src_lib}"
|
||||
fi
|
||||
done
|
||||
|
||||
# use the nptl linker instead of the linuxthreads one as the linuxthreads
|
||||
# one may lack TLS support and that can be really bad for business
|
||||
cp -a elf/ld.so "${D}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp"
|
||||
fi
|
||||
|
||||
# We'll take care of the cache ourselves
|
||||
rm -f "${D}"/etc/ld.so.cache
|
||||
|
||||
# Everything past this point just needs to be done once ...
|
||||
is_final_abi || return 0
|
||||
|
||||
# Make sure the non-native interp can be found on multilib systems even
|
||||
# if the main library set isn't installed into the right place. Maybe
|
||||
# we should query the active gcc for info instead of hardcoding it ?
|
||||
local i ldso_abi ldso_name
|
||||
local ldso_abi_list=(
|
||||
# x86
|
||||
amd64 /lib64/ld-linux-x86-64.so.2
|
||||
x32 /libx32/ld-linux-x32.so.2
|
||||
x86 /lib/ld-linux.so.2
|
||||
# mips
|
||||
o32 /lib/ld.so.1
|
||||
n32 /lib32/ld.so.1
|
||||
n64 /lib64/ld.so.1
|
||||
# powerpc
|
||||
ppc /lib/ld.so.1
|
||||
ppc64 /lib64/ld64.so.1
|
||||
# s390
|
||||
s390 /lib/ld.so.1
|
||||
s390x /lib/ld64.so.1
|
||||
# sparc
|
||||
sparc32 /lib/ld-linux.so.2
|
||||
sparc64 /lib64/ld-linux.so.2
|
||||
)
|
||||
if [[ ${SYMLINK_LIB} == "yes" ]] && [[ ! -e ${D}/$(alt_prefix)/lib ]] ; then
|
||||
dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) $(alt_prefix)/lib
|
||||
fi
|
||||
for (( i = 0; i < ${#ldso_abi_list[@]}; ++i )) ; do
|
||||
ldso_abi=${ldso_abi_list[i]}
|
||||
has ${ldso_abi} $(get_install_abis) || continue
|
||||
|
||||
ldso_name="$(alt_prefix)${ldso_abi_list[i+1]}"
|
||||
if [[ ! -L ${D}/${ldso_name} && ! -e ${D}/${ldso_name} ]] ; then
|
||||
dosym ../$(get_abi_LIBDIR ${ldso_abi})/${ldso_name##*/} ${ldso_name}
|
||||
fi
|
||||
done
|
||||
|
||||
#################################################################
|
||||
# EVERYTHING AFTER THIS POINT IS FOR NATIVE GLIBC INSTALLS ONLY #
|
||||
# Make sure we install some symlink hacks so that when we build
|
||||
# a 2nd stage cross-compiler, gcc finds the target system
|
||||
# headers correctly. See gcc/doc/gccinstall.info
|
||||
if is_crosscompile ; then
|
||||
# We need to make sure that /lib and /usr/lib always exists.
|
||||
# gcc likes to use relative paths to get to its multilibs like
|
||||
# /usr/lib/../lib64/. So while we don't install any files into
|
||||
# /usr/lib/, we do need it to exist.
|
||||
cd "${D}"$(alt_libdir)/..
|
||||
[[ -e lib ]] || mkdir lib
|
||||
cd "${D}"$(alt_usrlibdir)/..
|
||||
[[ -e lib ]] || mkdir lib
|
||||
|
||||
dosym usr/include $(alt_prefix)/sys-include
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Files for Debian-style locale updating
|
||||
dodir /usr/share/i18n
|
||||
sed \
|
||||
-e "/^#/d" \
|
||||
-e "/SUPPORTED-LOCALES=/d" \
|
||||
-e "s: \\\\::g" -e "s:/: :g" \
|
||||
"${S}"/localedata/SUPPORTED > "${D}"/usr/share/i18n/SUPPORTED \
|
||||
|| die "generating /usr/share/i18n/SUPPORTED failed"
|
||||
cd "${WORKDIR}"/extra/locale
|
||||
dosbin locale-gen || die
|
||||
doman *.[0-8]
|
||||
insinto /etc
|
||||
doins locale.gen || die
|
||||
|
||||
# Make sure all the ABI's can find the locales and so we only
|
||||
# have to generate one set
|
||||
local a
|
||||
keepdir /usr/$(get_libdir)/locale
|
||||
for a in $(get_install_abis) ; do
|
||||
if [[ ! -e ${D}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
|
||||
dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
|
||||
fi
|
||||
done
|
||||
|
||||
if ! has noinfo ${FEATURES} && [[ -n ${INFOPAGE_VER} ]] ; then
|
||||
einfo "Installing info pages..."
|
||||
|
||||
emake \
|
||||
-C "${GBUILDDIR}" \
|
||||
install_root="${install_root}" \
|
||||
info -i || die
|
||||
fi
|
||||
|
||||
if [[ -n ${MANPAGE_VER} ]] ; then
|
||||
einfo "Installing man pages..."
|
||||
|
||||
# Install linuxthreads man pages even if nptl is enabled
|
||||
cd "${WORKDIR}"/man
|
||||
doman *.3thr
|
||||
fi
|
||||
|
||||
cd "${S}"
|
||||
|
||||
# Install misc network config files
|
||||
insinto /etc
|
||||
doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die
|
||||
doins "${WORKDIR}"/extra/etc/*.conf || die
|
||||
doinitd "${WORKDIR}"/extra/etc/nscd || die
|
||||
|
||||
local nscd_args=(
|
||||
-e "s:@PIDFILE@:$(strings "${D}"/usr/sbin/nscd | grep nscd.pid):"
|
||||
)
|
||||
version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' )
|
||||
sed -i "${nscd_args[@]}" "${D}"/etc/init.d/nscd
|
||||
|
||||
echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
|
||||
doenvd "${T}"/00glibc || die
|
||||
|
||||
for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
|
||||
[[ -s ${d} ]] && dodoc ${d}
|
||||
done
|
||||
|
||||
# Prevent overwriting of the /etc/localtime symlink. We'll handle the
|
||||
# creation of the "factory" symlink in pkg_postinst().
|
||||
rm -f "${D}"/etc/localtime
|
||||
}
|
||||
|
||||
toolchain-glibc_headers_install() {
|
||||
local GBUILDDIR=${WORKDIR}/build-${ABI}-${CTARGET}-headers
|
||||
cd "${GBUILDDIR}"
|
||||
emake install_root="${D}$(alt_prefix)" install-headers || die
|
||||
if ! version_is_at_least 2.16 ; then
|
||||
insinto $(alt_headers)/bits
|
||||
doins bits/stdio_lim.h || die
|
||||
fi
|
||||
insinto $(alt_headers)/gnu
|
||||
doins "${S}"/include/gnu/stubs.h || die "doins include gnu"
|
||||
# Make sure we install the sys-include symlink so that when
|
||||
# we build a 2nd stage cross-compiler, gcc finds the target
|
||||
# system headers correctly. See gcc/doc/gccinstall.info
|
||||
dosym usr/include /usr/${CTARGET}/sys-include
|
||||
}
|
||||
|
||||
src_strip() {
|
||||
# gdb is lame and requires some debugging information to remain in
|
||||
# libpthread, so we need to strip it by hand. libthread_db makes no
|
||||
# sense stripped as it is only used when debugging.
|
||||
local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}")
|
||||
env \
|
||||
-uRESTRICT \
|
||||
CHOST=${CTARGET} \
|
||||
STRIP_MASK="/*/{,tls/}${pthread}*" \
|
||||
prepallstrip
|
||||
# if user has stripping enabled and does not have split debug turned on,
|
||||
# then leave the debugging sections in libpthread.
|
||||
if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then
|
||||
${STRIP:-${CTARGET}-strip} --strip-debug "${D}"/*/libpthread-*.so
|
||||
fi
|
||||
}
|
||||
|
||||
eblit-glibc-src_install() {
|
||||
if just_headers ; then
|
||||
export ABI=default
|
||||
toolchain-glibc_headers_install
|
||||
return
|
||||
fi
|
||||
|
||||
setup_env
|
||||
|
||||
if [[ -z ${OABI} ]] ; then
|
||||
local abilist=""
|
||||
if has_multilib_profile ; then
|
||||
abilist=$(get_install_abis)
|
||||
einfo "Installing multilib glibc for ABIs: ${abilist}"
|
||||
elif is_crosscompile || tc-is-cross-compiler ; then
|
||||
abilist=${DEFAULT_ABI}
|
||||
fi
|
||||
if [[ -n ${abilist} ]] ; then
|
||||
OABI=${ABI}
|
||||
for ABI in ${abilist} ; do
|
||||
export ABI
|
||||
eblit-glibc-src_install
|
||||
done
|
||||
ABI=${OABI}
|
||||
unset OABI
|
||||
src_strip
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
toolchain-glibc_src_install
|
||||
[[ -z ${OABI} ]] && src_strip
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_test.eblit,v 1.4 2010/08/10 08:08:05 vapier Exp $
|
||||
|
||||
toolchain-glibc_src_test() {
|
||||
cd "${WORKDIR}"/build-${ABI}-${CTARGET}-$1 || die "cd build-${ABI}-${CTARGET}-$1"
|
||||
unset LD_ASSUME_KERNEL
|
||||
emake -j1 check && return 0
|
||||
einfo "make check failed - re-running with --keep-going to get the rest of the results"
|
||||
emake -j1 -k check
|
||||
ewarn "make check failed for ${ABI}-${CTARGET}-$1"
|
||||
return 1
|
||||
}
|
||||
|
||||
eblit-glibc-src_test() {
|
||||
local ret=0
|
||||
|
||||
setup_env
|
||||
|
||||
# give tests more time to complete
|
||||
export TIMEOUTFACTOR=5
|
||||
|
||||
if [[ -z ${OABI} ]] && has_multilib_profile ; then
|
||||
OABI=${ABI}
|
||||
einfo "Testing multilib glibc for ABIs: $(get_install_abis)"
|
||||
for ABI in $(get_install_abis) ; do
|
||||
export ABI
|
||||
einfo " Testing ${ABI} glibc"
|
||||
src_test
|
||||
((ret+=$?))
|
||||
done
|
||||
ABI=${OABI}
|
||||
unset OABI
|
||||
[[ ${ret} -ne 0 ]] \
|
||||
&& die "tests failed" \
|
||||
|| return 0
|
||||
fi
|
||||
|
||||
want_linuxthreads && toolchain-glibc_src_test linuxthreads ; ((ret+=$?))
|
||||
want_nptl && toolchain-glibc_src_test nptl ; ((ret+=$?))
|
||||
return ${ret}
|
||||
}
|
@ -1,189 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/src_unpack.eblit,v 1.19 2012/11/11 07:24:55 vapier Exp $
|
||||
|
||||
int_to_KV() {
|
||||
local version=$1 major minor micro
|
||||
major=$((version / 65536))
|
||||
minor=$(((version % 65536) / 256))
|
||||
micro=$((version % 256))
|
||||
echo ${major}.${minor}.${micro}
|
||||
}
|
||||
|
||||
eend_KV() {
|
||||
[[ $(KV_to_int $1) -ge $(KV_to_int $2) ]]
|
||||
eend $?
|
||||
}
|
||||
|
||||
get_kheader_version() {
|
||||
printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \
|
||||
$(tc-getCPP ${CTARGET}) -I "$(alt_build_headers)" | \
|
||||
tail -n 1
|
||||
}
|
||||
|
||||
check_nptl_support() {
|
||||
# don't care about the compiler here as we arent using it
|
||||
just_headers && return
|
||||
|
||||
local run_kv build_kv want_kv
|
||||
run_kv=$(int_to_KV $(get_KV))
|
||||
build_kv=$(int_to_KV $(get_kheader_version))
|
||||
want_kv=${NPTL_KERN_VER}
|
||||
|
||||
ebegin "Checking gcc for __thread support"
|
||||
if ! eend $(want__thread ; echo $?) ; then
|
||||
echo
|
||||
eerror "Could not find a gcc that supports the __thread directive!"
|
||||
eerror "Please update your binutils/gcc and try again."
|
||||
die "No __thread support in gcc!"
|
||||
fi
|
||||
|
||||
if ! is_crosscompile && ! tc-is-cross-compiler ; then
|
||||
# Building fails on an non-supporting kernel
|
||||
ebegin "Checking kernel version (${run_kv} >= ${want_kv})"
|
||||
if ! eend_KV ${run_kv} ${want_kv} ; then
|
||||
echo
|
||||
eerror "You need a kernel of at least ${want_kv} for NPTL support!"
|
||||
die "Kernel version too low!"
|
||||
fi
|
||||
fi
|
||||
|
||||
ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})"
|
||||
if ! eend_KV ${build_kv} ${want_kv} ; then
|
||||
echo
|
||||
eerror "You need linux-headers of at least ${want_kv} for NPTL support!"
|
||||
die "linux-headers version too low!"
|
||||
fi
|
||||
}
|
||||
|
||||
unpack_pkg() {
|
||||
local a=${PN}
|
||||
[[ -n ${SNAP_VER} ]] && a="${a}-${RELEASE_VER}"
|
||||
[[ -n $1 ]] && a="${a}-$1"
|
||||
if [[ -n ${SNAP_VER} ]] ; then
|
||||
a="${a}-${SNAP_VER}"
|
||||
else
|
||||
if [[ -n $2 ]] ; then
|
||||
a="${a}-$2"
|
||||
else
|
||||
a="${a}-${RELEASE_VER}"
|
||||
fi
|
||||
fi
|
||||
if has ${a}.tar.xz ${A} ; then
|
||||
unpacker ${a}.tar.xz
|
||||
else
|
||||
unpack ${a}.tar.bz2
|
||||
fi
|
||||
[[ -n $1 ]] && { mv ${a} $1 || die ; }
|
||||
}
|
||||
|
||||
toolchain-glibc_src_unpack() {
|
||||
# Check NPTL support _before_ we unpack things to save some time
|
||||
want_nptl && check_nptl_support
|
||||
|
||||
if [[ -n ${EGIT_REPO_URIS} ]] ; then
|
||||
local i d
|
||||
for ((i=0; i<${#EGIT_REPO_URIS[@]}; ++i)) ; do
|
||||
EGIT_REPO_URI=${EGIT_REPO_URIS[$i]}
|
||||
EGIT_SOURCEDIR=${EGIT_SOURCEDIRS[$i]}
|
||||
git-2_src_unpack
|
||||
done
|
||||
else
|
||||
unpack_pkg
|
||||
fi
|
||||
|
||||
cd "${S}"
|
||||
touch locale/C-translit.h #185476 #218003
|
||||
[[ -n ${LT_VER} ]] && unpack_pkg linuxthreads ${LT_VER}
|
||||
[[ -n ${PORTS_VER} ]] && unpack_pkg ports ${PORTS_VER}
|
||||
[[ -n ${LIBIDN_VER} ]] && unpack_pkg libidn
|
||||
|
||||
if [[ -n ${PATCH_VER} ]] ; then
|
||||
cd "${WORKDIR}"
|
||||
unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
|
||||
# pull out all the addons
|
||||
local d
|
||||
for d in extra/*/configure ; do
|
||||
d=${d%/configure}
|
||||
[[ -d ${S}/${d} ]] && die "${d} already exists in \${S}"
|
||||
mv "${d}" "${S}" || die "moving ${d} failed"
|
||||
done
|
||||
fi
|
||||
|
||||
# XXX: We should do the branchupdate, before extracting the manpages and
|
||||
# infopages else it does not help much (mtimes change if there is a change
|
||||
# to them with branchupdate)
|
||||
if [[ -n ${BRANCH_UPDATE} ]] ; then
|
||||
cd "${S}"
|
||||
epatch "${DISTDIR}"/glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
|
||||
|
||||
# Snapshot date patch
|
||||
einfo "Patching version to display snapshot date ..."
|
||||
sed -i -e "s:\(#define RELEASE\).*:\1 \"${BRANCH_UPDATE}\":" version.h
|
||||
fi
|
||||
|
||||
if [[ -n ${MANPAGE_VER} ]] ; then
|
||||
cd "${WORKDIR}"
|
||||
unpack glibc-manpages-${MANPAGE_VER}.tar.bz2
|
||||
fi
|
||||
|
||||
if [[ -n ${INFOPAGE_VER} ]] ; then
|
||||
cd "${S}"
|
||||
unpack glibc-infopages-${INFOPAGE_VER}.tar.bz2
|
||||
fi
|
||||
|
||||
# tag, glibc is it
|
||||
cd "${S}"
|
||||
[[ -e csu/Banner ]] && die "need new banner location"
|
||||
[[ -n ${SNAP_VER} ]] && echo "Gentoo snapshot ${SNAP_VER}" >> csu/Banner
|
||||
[[ -n ${BRANCH_UPDATE} ]] && echo "Gentoo branch ${BRANCH_UPDATE}" >> csu/Banner
|
||||
if [[ -n ${PATCH_VER} ]] && ! use vanilla ; then
|
||||
cd "${S}"
|
||||
EPATCH_MULTI_MSG="Applying Gentoo Glibc Patchset ${RELEASE_VER}-${PATCH_VER} ..." \
|
||||
EPATCH_EXCLUDE=${GLIBC_PATCH_EXCLUDE} \
|
||||
EPATCH_SUFFIX="patch" \
|
||||
ARCH=$(tc-arch) \
|
||||
epatch "${WORKDIR}"/patches
|
||||
echo "Gentoo patchset ${PATCH_VER}" >> csu/Banner
|
||||
fi
|
||||
|
||||
if just_headers ; then
|
||||
if [[ -e ports/sysdeps/mips/preconfigure ]] ; then
|
||||
# mips peeps like to screw with us. if building headers,
|
||||
# we don't have a real compiler, so we can't let them
|
||||
# insert -mabi on us.
|
||||
sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die
|
||||
find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} +
|
||||
fi
|
||||
fi
|
||||
|
||||
epatch_user
|
||||
|
||||
gnuconfig_update
|
||||
}
|
||||
|
||||
eblit-glibc-src_unpack() {
|
||||
setup_env
|
||||
|
||||
toolchain-glibc_src_unpack
|
||||
|
||||
# Glibc is stupid sometimes, and doesn't realize that with a
|
||||
# static C-Only gcc, -lgcc_eh doesn't exist.
|
||||
# http://sources.redhat.com/ml/libc-alpha/2003-09/msg00100.html
|
||||
# http://sourceware.org/ml/libc-alpha/2005-02/msg00042.html
|
||||
# But! Finally fixed in recent versions:
|
||||
# http://sourceware.org/ml/libc-alpha/2012-05/msg01865.html
|
||||
if ! version_is_at_least 2.16 ; then
|
||||
echo 'int main(){}' > "${T}"/gcc_eh_test.c
|
||||
if ! $(tc-getCC ${CTARGET}) "${T}"/gcc_eh_test.c -lgcc_eh 2>/dev/null ; then
|
||||
sed -i -e 's:-lgcc_eh::' Makeconfig || die "sed gcc_eh"
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "${WORKDIR}"
|
||||
find . -type f '(' -size 0 -o -name "*.orig" ')' -exec rm -f {} \;
|
||||
find . -name configure -exec touch {} \;
|
||||
|
||||
# Fix permissions on some of the scripts
|
||||
chmod u+x "${S}"/scripts/*.sh
|
||||
}
|
@ -1,514 +0,0 @@
|
||||
Description: use PTR_MANGLE/PTR_DEMANGLE for FILE vtables. This adds inline
|
||||
functions to run the PTR_MANGLE at vtable assignment time and PTR_DEMANGLE
|
||||
at vtable dereference time so that the FILE structure's stored vtable
|
||||
pointer is not in the clear on the heap. To make sure nothing accidentally
|
||||
uses _IO_JUMPS or _IO_WIDE_JUMPS directly, the macros have been renamed to
|
||||
include the _RAW suffix.
|
||||
Author: Kees Cook <keescook@chromium.org>
|
||||
|
||||
diff -uNrp glibc-2.11.1~/debug/obprintf_chk.c glibc-2.11.1/debug/obprintf_chk.c
|
||||
--- glibc-2.11.1~/debug/obprintf_chk.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/debug/obprintf_chk.c 2012-01-05 12:08:38.135675971 -0800
|
||||
@@ -56,7 +56,7 @@ __obstack_vprintf_chk (struct obstack *o
|
||||
#endif
|
||||
|
||||
_IO_no_init (&new_f.ofile.file.file, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&new_f.ofile.file) = &_IO_obstack_jumps;
|
||||
+ _IO_JUMPS_SET (&new_f.ofile.file, &_IO_obstack_jumps);
|
||||
room = obstack_room (obstack);
|
||||
size = obstack_object_size (obstack) + room;
|
||||
if (size == 0)
|
||||
diff -uNrp glibc-2.11.1~/debug/vasprintf_chk.c glibc-2.11.1/debug/vasprintf_chk.c
|
||||
--- glibc-2.11.1~/debug/vasprintf_chk.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/debug/vasprintf_chk.c 2012-01-05 12:08:38.135675971 -0800
|
||||
@@ -54,7 +54,7 @@ __vasprintf_chk (char **result_ptr, int
|
||||
sf._sbf._f._lock = NULL;
|
||||
#endif
|
||||
_IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
|
||||
+ _IO_JUMPS_SET (&sf._sbf, &_IO_str_jumps);
|
||||
_IO_str_init_static_internal (&sf, string, init_string_size, string);
|
||||
sf._sbf._f._flags &= ~_IO_USER_BUF;
|
||||
sf._s._allocate_buffer = (_IO_alloc_type) malloc;
|
||||
diff -uNrp glibc-2.11.1~/debug/vdprintf_chk.c glibc-2.11.1/debug/vdprintf_chk.c
|
||||
--- glibc-2.11.1~/debug/vdprintf_chk.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/debug/vdprintf_chk.c 2012-01-05 12:08:38.135675971 -0800
|
||||
@@ -40,7 +40,7 @@ __vdprintf_chk (int d, int flags, const
|
||||
tmpfil.file._lock = NULL;
|
||||
#endif
|
||||
_IO_no_init (&tmpfil.file, _IO_USER_LOCK, 0, &wd, &_IO_wfile_jumps);
|
||||
- _IO_JUMPS (&tmpfil) = &_IO_file_jumps;
|
||||
+ _IO_JUMPS_SET (&tmpfil, &_IO_file_jumps);
|
||||
INTUSE(_IO_file_init) (&tmpfil);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
tmpfil.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/debug/vsnprintf_chk.c glibc-2.11.1/debug/vsnprintf_chk.c
|
||||
--- glibc-2.11.1~/debug/vsnprintf_chk.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/debug/vsnprintf_chk.c 2012-01-05 12:08:38.135675971 -0800
|
||||
@@ -53,7 +53,7 @@ ___vsnprintf_chk (char *s, size_t maxlen
|
||||
}
|
||||
|
||||
_IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&sf.f._sbf) = &_IO_strn_jumps;
|
||||
+ _IO_JUMPS_SET (&sf.f._sbf, &_IO_strn_jumps);
|
||||
s[0] = '\0';
|
||||
|
||||
/* For flags > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
|
||||
diff -uNrp glibc-2.11.1~/debug/vsprintf_chk.c glibc-2.11.1/debug/vsprintf_chk.c
|
||||
--- glibc-2.11.1~/debug/vsprintf_chk.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/debug/vsprintf_chk.c 2012-01-05 12:08:38.135675971 -0800
|
||||
@@ -75,7 +75,7 @@ ___vsprintf_chk (char *s, int flags, siz
|
||||
__chk_fail ();
|
||||
|
||||
_IO_no_init (&f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&f._sbf) = &_IO_str_chk_jumps;
|
||||
+ _IO_JUMPS_SET (&f._sbf, &_IO_str_chk_jumps);
|
||||
s[0] = '\0';
|
||||
_IO_str_init_static_internal (&f, s, slen - 1, s);
|
||||
|
||||
diff -uNrp glibc-2.11.1~/libio/fileops.c glibc-2.11.1/libio/fileops.c
|
||||
--- glibc-2.11.1~/libio/fileops.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/fileops.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -464,8 +464,8 @@ _IO_file_setbuf_mmap (fp, p, len)
|
||||
_IO_FILE *result;
|
||||
|
||||
/* Change the function table. */
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps;
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_file_jumps);
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps);
|
||||
|
||||
/* And perform the normal operation. */
|
||||
result = _IO_new_file_setbuf (fp, p, len);
|
||||
@@ -473,8 +473,8 @@ _IO_file_setbuf_mmap (fp, p, len)
|
||||
/* If the call failed, restore to using mmap. */
|
||||
if (result == NULL)
|
||||
{
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps_mmap;
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_file_jumps_mmap);
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps_mmap);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -713,10 +713,10 @@ mmap_remap_check (_IO_FILE *fp)
|
||||
fp->_IO_buf_base = fp->_IO_buf_end = NULL;
|
||||
_IO_setg (fp, NULL, NULL, NULL);
|
||||
if (fp->_mode <= 0)
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_file_jumps);
|
||||
else
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_wfile_jumps;
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_wfile_jumps);
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -793,10 +793,10 @@ decide_maybe_mmap (_IO_FILE *fp)
|
||||
fp->_offset = st.st_size;
|
||||
|
||||
if (fp->_mode <= 0)
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *)fp) = &_IO_file_jumps_mmap;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *)fp, &_IO_file_jumps_mmap);
|
||||
else
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *)fp) = &_IO_wfile_jumps_mmap;
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *)fp, &_IO_wfile_jumps_mmap);
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps_mmap);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -806,10 +806,10 @@ decide_maybe_mmap (_IO_FILE *fp)
|
||||
/* We couldn't use mmap, so revert to the vanilla file operations. */
|
||||
|
||||
if (fp->_mode <= 0)
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_file_jumps);
|
||||
else
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_wfile_jumps;
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_wfile_jumps);
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps);
|
||||
}
|
||||
|
||||
int
|
||||
diff -uNrp glibc-2.11.1~/libio/freopen64.c glibc-2.11.1/libio/freopen64.c
|
||||
--- glibc-2.11.1~/libio/freopen64.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/freopen64.c 2012-01-05 12:09:59.188744539 -0800
|
||||
@@ -51,9 +51,9 @@ freopen64 (filename, mode, fp)
|
||||
? fd_to_filename (fd) : filename);
|
||||
fp->_flags2 |= _IO_FLAGS2_NOCLOSE;
|
||||
INTUSE(_IO_file_close_it) (fp);
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_file_jumps);
|
||||
if (_IO_vtable_offset (fp) == 0 && fp->_wide_data != NULL)
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps);
|
||||
result = INTUSE(_IO_file_fopen) (fp, gfilename, mode, 0);
|
||||
fp->_flags2 &= ~_IO_FLAGS2_NOCLOSE;
|
||||
if (result != NULL)
|
||||
diff -uNrp glibc-2.11.1~/libio/freopen.c glibc-2.11.1/libio/freopen.c
|
||||
--- glibc-2.11.1~/libio/freopen.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/freopen.c 2012-01-05 12:11:29.601936735 -0800
|
||||
@@ -59,16 +59,16 @@ freopen (filename, mode, fp)
|
||||
to the old libio may be passed into shared C library and wind
|
||||
up here. */
|
||||
_IO_old_file_close_it (fp);
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_old_file_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_old_file_jumps);
|
||||
result = _IO_old_file_fopen (fp, gfilename, mode);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
INTUSE(_IO_file_close_it) (fp);
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_file_jumps);
|
||||
if (_IO_vtable_offset (fp) == 0 && fp->_wide_data != NULL)
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps);
|
||||
result = INTUSE(_IO_file_fopen) (fp, gfilename, mode, 1);
|
||||
if (result != NULL)
|
||||
result = __fopen_maybe_mmap (result);
|
||||
diff -uNrp glibc-2.11.1~/libio/genops.c glibc-2.11.1/libio/genops.c
|
||||
--- glibc-2.11.1~/libio/genops.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/genops.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -664,7 +664,7 @@ _IO_no_init (fp, flags, orientation, wd,
|
||||
fp->_wide_data->_IO_backup_base = NULL;
|
||||
fp->_wide_data->_IO_save_end = NULL;
|
||||
|
||||
- fp->_wide_data->_wide_vtable = jmp;
|
||||
+ _IO_WIDE_JUMPS_SET (fp, jmp);
|
||||
}
|
||||
#endif
|
||||
fp->_freeres_list = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/iofdopen.c glibc-2.11.1/libio/iofdopen.c
|
||||
--- glibc-2.11.1~/libio/iofdopen.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/iofdopen.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -154,11 +154,11 @@ _IO_new_fdopen (fd, mode)
|
||||
? &_IO_wfile_jumps_maybe_mmap :
|
||||
#endif
|
||||
&_IO_wfile_jumps);
|
||||
- _IO_JUMPS (&new_f->fp) =
|
||||
+ _IO_JUMPS_SET (&new_f->fp,
|
||||
#ifdef _G_HAVE_MMAP
|
||||
(use_mmap && (read_write & _IO_NO_WRITES)) ? &_IO_file_jumps_maybe_mmap :
|
||||
#endif
|
||||
- &_IO_file_jumps;
|
||||
+ &_IO_file_jumps);
|
||||
INTUSE(_IO_file_init) (&new_f->fp);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
new_f->fp.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/iofopen.c glibc-2.11.1/libio/iofopen.c
|
||||
--- glibc-2.11.1~/libio/iofopen.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/iofopen.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -50,10 +50,10 @@ __fopen_maybe_mmap (fp)
|
||||
vanilla file operations and reset the jump table accordingly. */
|
||||
|
||||
if (fp->_mode <= 0)
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps_maybe_mmap;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_file_jumps_maybe_mmap);
|
||||
else
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_wfile_jumps_maybe_mmap;
|
||||
- fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_maybe_mmap;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) fp, &_IO_wfile_jumps_maybe_mmap);
|
||||
+ _IO_WIDE_JUMPS_SET (fp, &_IO_wfile_jumps_maybe_mmap);
|
||||
}
|
||||
#endif
|
||||
return fp;
|
||||
@@ -85,7 +85,7 @@ __fopen_internal (filename, mode, is32)
|
||||
#else
|
||||
_IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL);
|
||||
#endif
|
||||
- _IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
|
||||
+ _IO_JUMPS_SET (&new_f->fp, &_IO_file_jumps);
|
||||
INTUSE(_IO_file_init) (&new_f->fp);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
new_f->fp.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/iofopncook.c glibc-2.11.1/libio/iofopncook.c
|
||||
--- glibc-2.11.1~/libio/iofopncook.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/iofopncook.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -147,7 +147,7 @@ _IO_cookie_init (struct _IO_cookie_file
|
||||
void *cookie, _IO_cookie_io_functions_t io_functions)
|
||||
{
|
||||
INTUSE(_IO_init) (&cfile->__fp.file, 0);
|
||||
- _IO_JUMPS (&cfile->__fp) = &_IO_cookie_jumps;
|
||||
+ _IO_JUMPS_SET (&cfile->__fp, &_IO_cookie_jumps);
|
||||
|
||||
cfile->__cookie = cookie;
|
||||
cfile->__io_functions = io_functions;
|
||||
@@ -272,7 +272,7 @@ _IO_old_fopencookie (cookie, mode, io_fu
|
||||
|
||||
ret = _IO_fopencookie (cookie, mode, io_functions);
|
||||
if (ret != NULL)
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) ret) = &_IO_old_cookie_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) ret, &_IO_old_cookie_jumps);
|
||||
|
||||
return ret;
|
||||
}
|
||||
diff -uNrp glibc-2.11.1~/libio/iopopen.c glibc-2.11.1/libio/iopopen.c
|
||||
--- glibc-2.11.1~/libio/iopopen.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/iopopen.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -304,7 +304,7 @@ _IO_new_popen (command, mode)
|
||||
#endif
|
||||
fp = &new_f->fpx.file.file;
|
||||
INTUSE(_IO_init) (fp, 0);
|
||||
- _IO_JUMPS (&new_f->fpx.file) = &_IO_proc_jumps;
|
||||
+ _IO_JUMPS_SET (&new_f->fpx.file, &_IO_proc_jumps);
|
||||
_IO_new_file_init (&new_f->fpx.file);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
new_f->fpx.file.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/iovdprintf.c glibc-2.11.1/libio/iovdprintf.c
|
||||
--- glibc-2.11.1~/libio/iovdprintf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/iovdprintf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -43,7 +43,7 @@ _IO_vdprintf (d, format, arg)
|
||||
tmpfil.file._lock = NULL;
|
||||
#endif
|
||||
_IO_no_init (&tmpfil.file, _IO_USER_LOCK, 0, &wd, &_IO_wfile_jumps);
|
||||
- _IO_JUMPS (&tmpfil) = &_IO_file_jumps;
|
||||
+ _IO_JUMPS_SET (&tmpfil, &_IO_file_jumps);
|
||||
INTUSE(_IO_file_init) (&tmpfil);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
tmpfil.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/iovsprintf.c glibc-2.11.1/libio/iovsprintf.c
|
||||
--- glibc-2.11.1~/libio/iovsprintf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/iovsprintf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -38,7 +38,7 @@ __IO_vsprintf (char *string, const char
|
||||
sf._sbf._f._lock = NULL;
|
||||
#endif
|
||||
_IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
|
||||
+ _IO_JUMPS_SET (&sf._sbf, &_IO_str_jumps);
|
||||
_IO_str_init_static_internal (&sf, string, -1, string);
|
||||
ret = INTUSE(_IO_vfprintf) (&sf._sbf._f, format, args);
|
||||
_IO_putc_unlocked ('\0', &sf._sbf._f);
|
||||
diff -uNrp glibc-2.11.1~/libio/iovsscanf.c glibc-2.11.1/libio/iovsscanf.c
|
||||
--- glibc-2.11.1~/libio/iovsscanf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/iovsscanf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -40,7 +40,7 @@ _IO_vsscanf (string, format, args)
|
||||
sf._sbf._f._lock = NULL;
|
||||
#endif
|
||||
_IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
|
||||
+ _IO_JUMPS_SET (&sf._sbf, &_IO_str_jumps);
|
||||
_IO_str_init_static_internal (&sf, (char*)string, 0, NULL);
|
||||
ret = INTUSE(_IO_vfscanf) (&sf._sbf._f, format, args, NULL);
|
||||
return ret;
|
||||
diff -uNrp glibc-2.11.1~/libio/libioP.h glibc-2.11.1/libio/libioP.h
|
||||
--- glibc-2.11.1~/libio/libioP.h 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/libioP.h 2012-01-05 12:13:24.243448752 -0800
|
||||
@@ -74,11 +74,11 @@ extern "C" {
|
||||
* The _IO_FILE type is used to implement the FILE type in GNU libc,
|
||||
* as well as the streambuf class in GNU iostreams for C++.
|
||||
* These are all the same, just used differently.
|
||||
- * An _IO_FILE (or FILE) object is allows followed by a pointer to
|
||||
- * a jump table (of pointers to functions). The pointer is accessed
|
||||
- * with the _IO_JUMPS macro. The jump table has a eccentric format,
|
||||
- * so as to be compatible with the layout of a C++ virtual function table.
|
||||
- * (as implemented by g++). When a pointer to a streambuf object is
|
||||
+ * An _IO_FILE (or FILE) object is allows followed by a pointer to a jump
|
||||
+ * table (of pointers to functions). The pointer is accessed with the
|
||||
+ * _IO_JUMPS_SET and _IO_JUMPS_FUNC macros. The jump table has a eccentric
|
||||
+ * format, so as to be compatible with the layout of a C++ virtual function
|
||||
+ * table (as implemented by g++). When a pointer to a streambuf object is
|
||||
* coerced to an (_IO_FILE*), then _IO_JUMPS on the result just
|
||||
* happens to point to the virtual function table of the streambuf.
|
||||
* Thus the _IO_JUMPS function table used for C stdio/libio does
|
||||
@@ -105,20 +105,40 @@ extern "C" {
|
||||
# define _IO_JUMPS_OFFSET 1
|
||||
#endif
|
||||
|
||||
-#define _IO_JUMPS(THIS) (THIS)->vtable
|
||||
-#define _IO_WIDE_JUMPS(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
|
||||
+static inline void
|
||||
+__mangle_vtable(const struct _IO_jump_t **vtable, const struct _IO_jump_t *table)
|
||||
+{
|
||||
+ struct _IO_jump_t *ptr;
|
||||
+ ptr = (struct _IO_jump_t *)table;
|
||||
+ PTR_MANGLE(ptr);
|
||||
+ *vtable = ptr;
|
||||
+}
|
||||
+
|
||||
+#define _IO_JUMPS_RAW(THIS) (THIS)->vtable
|
||||
+#define _IO_JUMPS_SET(THIS, TABLE) __mangle_vtable(&_IO_JUMPS_RAW(THIS), (TABLE))
|
||||
+#define _IO_WIDE_JUMPS_RAW(THIS) ((struct _IO_FILE *) (THIS))->_wide_data->_wide_vtable
|
||||
+#define _IO_WIDE_JUMPS_SET(THIS, TABLE) __mangle_vtable(&_IO_WIDE_JUMPS_RAW(THIS), (TABLE))
|
||||
#define _IO_CHECK_WIDE(THIS) (((struct _IO_FILE *) (THIS))->_wide_data != NULL)
|
||||
|
||||
+static inline const struct _IO_jump_t *
|
||||
+__demangle_vtable(const struct _IO_jump_t *vtable)
|
||||
+{
|
||||
+ struct _IO_jump_t *ptr;
|
||||
+ ptr = (struct _IO_jump_t *)vtable;
|
||||
+ PTR_DEMANGLE(ptr);
|
||||
+ return (const struct _IO_jump_t *)ptr;
|
||||
+}
|
||||
+
|
||||
#if _IO_JUMPS_OFFSET
|
||||
-# define _IO_JUMPS_FUNC(THIS) \
|
||||
- (*(struct _IO_jump_t **) ((void *) &_IO_JUMPS ((struct _IO_FILE_plus *) (THIS)) \
|
||||
- + (THIS)->_vtable_offset))
|
||||
+# define _IO_JUMPS_FUNC(THIS) __demangle_vtable (\
|
||||
+ (*(struct _IO_jump_t **) ((void *) &_IO_JUMPS_RAW ((struct _IO_FILE_plus *) (THIS)) \
|
||||
+ + (THIS)->_vtable_offset)))
|
||||
# define _IO_vtable_offset(THIS) (THIS)->_vtable_offset
|
||||
#else
|
||||
-# define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
|
||||
+# define _IO_JUMPS_FUNC(THIS) __demangle_vtable (_IO_JUMPS_RAW ((struct _IO_FILE_plus *) (THIS)))
|
||||
# define _IO_vtable_offset(THIS) 0
|
||||
#endif
|
||||
-#define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
|
||||
+#define _IO_WIDE_JUMPS_FUNC(THIS) __demangle_vtable (_IO_WIDE_JUMPS_RAW(THIS))
|
||||
#ifdef _G_USING_THUNKS
|
||||
# define JUMP_FIELD(TYPE, NAME) TYPE NAME
|
||||
# define JUMP0(FUNC, THIS) (_IO_JUMPS_FUNC(THIS)->FUNC) (THIS)
|
||||
diff -uNrp glibc-2.11.1~/libio/memstream.c glibc-2.11.1/libio/memstream.c
|
||||
--- glibc-2.11.1~/libio/memstream.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/memstream.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -87,7 +87,7 @@ open_memstream (bufloc, sizeloc)
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
INTUSE(_IO_init) (&new_f->fp._sf._sbf._f, 0);
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp._sf._sbf) = &_IO_mem_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) &new_f->fp._sf._sbf, &_IO_mem_jumps);
|
||||
_IO_str_init_static_internal (&new_f->fp._sf, buf, _IO_BUFSIZ, buf);
|
||||
new_f->fp._sf._sbf._f._flags &= ~_IO_USER_BUF;
|
||||
new_f->fp._sf._s._allocate_buffer = (_IO_alloc_type) malloc;
|
||||
diff -uNrp glibc-2.11.1~/libio/obprintf.c glibc-2.11.1/libio/obprintf.c
|
||||
--- glibc-2.11.1~/libio/obprintf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/obprintf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -136,7 +136,7 @@ _IO_obstack_vprintf (struct obstack *obs
|
||||
#endif
|
||||
|
||||
_IO_no_init (&new_f.ofile.file.file, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&new_f.ofile.file) = &_IO_obstack_jumps;
|
||||
+ _IO_JUMPS_SET (&new_f.ofile.file, &_IO_obstack_jumps);
|
||||
room = obstack_room (obstack);
|
||||
size = obstack_object_size (obstack) + room;
|
||||
if (size == 0)
|
||||
diff -uNrp glibc-2.11.1~/libio/oldiofdopen.c glibc-2.11.1/libio/oldiofdopen.c
|
||||
--- glibc-2.11.1~/libio/oldiofdopen.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/oldiofdopen.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -117,7 +117,7 @@ _IO_old_fdopen (fd, mode)
|
||||
new_f->fp.file._file._lock = &new_f->lock;
|
||||
#endif
|
||||
_IO_old_init (&new_f->fp.file._file, 0);
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp) = &_IO_old_file_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) &new_f->fp, &_IO_old_file_jumps);
|
||||
_IO_old_file_init ((struct _IO_FILE_plus *) &new_f->fp);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
new_f->fp.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/oldiofopen.c glibc-2.11.1/libio/oldiofopen.c
|
||||
--- glibc-2.11.1~/libio/oldiofopen.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/oldiofopen.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -56,7 +56,7 @@ _IO_old_fopen (filename, mode)
|
||||
new_f->fp.file._file._lock = &new_f->lock;
|
||||
#endif
|
||||
_IO_old_init (&new_f->fp.file._file, 0);
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fp) = &_IO_old_file_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) &new_f->fp, &_IO_old_file_jumps);
|
||||
_IO_old_file_init ((struct _IO_FILE_plus *) &new_f->fp);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
new_f->fp.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/oldiopopen.c glibc-2.11.1/libio/oldiopopen.c
|
||||
--- glibc-2.11.1~/libio/oldiopopen.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/oldiopopen.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -225,7 +225,7 @@ _IO_old_popen (command, mode)
|
||||
#endif
|
||||
fp = &new_f->fpx.file.file._file;
|
||||
_IO_old_init (fp, 0);
|
||||
- _IO_JUMPS ((struct _IO_FILE_plus *) &new_f->fpx.file) = &_IO_old_proc_jumps;
|
||||
+ _IO_JUMPS_SET ((struct _IO_FILE_plus *) &new_f->fpx.file, &_IO_old_proc_jumps);
|
||||
_IO_old_file_init ((struct _IO_FILE_plus *) &new_f->fpx.file);
|
||||
#if !_IO_UNIFIED_JUMPTABLES
|
||||
new_f->fpx.file.vtable = NULL;
|
||||
diff -uNrp glibc-2.11.1~/libio/vasprintf.c glibc-2.11.1/libio/vasprintf.c
|
||||
--- glibc-2.11.1~/libio/vasprintf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/vasprintf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -56,7 +56,7 @@ _IO_vasprintf (result_ptr, format, args)
|
||||
sf._sbf._f._lock = NULL;
|
||||
#endif
|
||||
_IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
|
||||
+ _IO_JUMPS_SET (&sf._sbf, &_IO_str_jumps);
|
||||
_IO_str_init_static_internal (&sf, string, init_string_size, string);
|
||||
sf._sbf._f._flags &= ~_IO_USER_BUF;
|
||||
sf._s._allocate_buffer = (_IO_alloc_type) malloc;
|
||||
diff -uNrp glibc-2.11.1~/libio/vsnprintf.c glibc-2.11.1/libio/vsnprintf.c
|
||||
--- glibc-2.11.1~/libio/vsnprintf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/libio/vsnprintf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -114,7 +114,7 @@ _IO_vsnprintf (string, maxlen, format, a
|
||||
}
|
||||
|
||||
_IO_no_init (&sf.f._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&sf.f._sbf) = &_IO_strn_jumps;
|
||||
+ _IO_JUMPS_SET (&sf.f._sbf, &_IO_strn_jumps);
|
||||
string[0] = '\0';
|
||||
_IO_str_init_static_internal (&sf.f, string, maxlen - 1, string);
|
||||
ret = INTUSE(_IO_vfprintf) (&sf.f._sbf._f, format, args);
|
||||
diff -uNrp glibc-2.11.1~/misc/init-misc.c glibc-2.11.1/misc/init-misc.c
|
||||
--- glibc-2.11.1~/misc/init-misc.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/misc/init-misc.c 2012-01-05 12:13:44.995722496 -0800
|
||||
@@ -17,7 +17,11 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
+#include "libioP.h"
|
||||
+
|
||||
#include <string.h>
|
||||
+#include <stdio.h>
|
||||
+#include <sysdep.h>
|
||||
#include <libc-internal.h>
|
||||
|
||||
char *__progname_full = (char *) "";
|
||||
@@ -38,4 +42,13 @@ __init_misc (int argc, char **argv, char
|
||||
__progname = p + 1;
|
||||
__progname_full = argv[0];
|
||||
}
|
||||
+
|
||||
+ PTR_MANGLE (_IO_JUMPS_RAW ((struct _IO_FILE_plus *)stdin));
|
||||
+ PTR_MANGLE (_IO_WIDE_JUMPS_RAW (stdin));
|
||||
+
|
||||
+ PTR_MANGLE (_IO_JUMPS_RAW ((struct _IO_FILE_plus *)stdout));
|
||||
+ PTR_MANGLE (_IO_WIDE_JUMPS_RAW (stdout));
|
||||
+
|
||||
+ PTR_MANGLE (_IO_JUMPS_RAW ((struct _IO_FILE_plus *)stderr));
|
||||
+ PTR_MANGLE (_IO_WIDE_JUMPS_RAW (stderr));
|
||||
}
|
||||
diff -uNrp glibc-2.11.1~/stdio-common/isoc99_vsscanf.c glibc-2.11.1/stdio-common/isoc99_vsscanf.c
|
||||
--- glibc-2.11.1~/stdio-common/isoc99_vsscanf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/stdio-common/isoc99_vsscanf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -38,7 +38,7 @@ __isoc99_vsscanf (const char *string, co
|
||||
sf._sbf._f._lock = NULL;
|
||||
#endif
|
||||
_IO_no_init (&sf._sbf._f, _IO_USER_LOCK, -1, NULL, NULL);
|
||||
- _IO_JUMPS (&sf._sbf) = &_IO_str_jumps;
|
||||
+ _IO_JUMPS_SET (&sf._sbf, &_IO_str_jumps);
|
||||
_IO_str_init_static_internal (&sf, (char*)string, 0, NULL);
|
||||
sf._sbf._f._flags2 |= _IO_FLAGS2_SCANF_STD;
|
||||
ret = INTUSE(_IO_vfscanf) (&sf._sbf._f, format, args, NULL);
|
||||
diff -uNrp glibc-2.11.1~/stdio-common/vfprintf.c glibc-2.11.1/stdio-common/vfprintf.c
|
||||
--- glibc-2.11.1~/stdio-common/vfprintf.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/stdio-common/vfprintf.c 2012-01-05 12:08:38.139676023 -0800
|
||||
@@ -2224,7 +2224,7 @@ buffered_vfprintf (register _IO_FILE *s,
|
||||
hp->_lock = NULL;
|
||||
#endif
|
||||
hp->_flags2 = s->_flags2;
|
||||
- _IO_JUMPS (&helper._f) = (struct _IO_jump_t *) &_IO_helper_jumps;
|
||||
+ _IO_JUMPS_SET (&helper._f, (struct _IO_jump_t *) &_IO_helper_jumps);
|
||||
|
||||
/* Now print to helper instead. */
|
||||
#ifndef COMPILE_WPRINTF
|
||||
diff -uNrp glibc-2.11.1~/stdlib/strfmon_l.c glibc-2.11.1/stdlib/strfmon_l.c
|
||||
--- glibc-2.11.1~/stdlib/strfmon_l.c 2009-12-08 12:10:20.000000000 -0800
|
||||
+++ glibc-2.11.1/stdlib/strfmon_l.c 2012-01-05 12:08:38.143676076 -0800
|
||||
@@ -517,7 +517,7 @@ __vstrfmon_l (char *s, size_t maxsize, _
|
||||
f._sbf._f._lock = NULL;
|
||||
#endif
|
||||
INTUSE(_IO_init) (&f._sbf._f, 0);
|
||||
- _IO_JUMPS (&f._sbf) = &_IO_str_jumps;
|
||||
+ _IO_JUMPS_SET (&f._sbf, &_IO_str_jumps);
|
||||
INTUSE(_IO_str_init_static) (&f, dest,
|
||||
(s + maxsize) - dest, dest);
|
||||
/* We clear the last available byte so we can find out whether
|
@ -1,370 +0,0 @@
|
||||
--- ports/sysdeps/arm/eabi/armv7/memcpy.S
|
||||
+++ ports/sysdeps/arm/eabi/armv7/memcpy.S 2012-08-02 15:59:19.932220525 -0700
|
||||
@@ -0,0 +1,367 @@
|
||||
+/*
|
||||
+This version of memcpy for arm is from the newlib.
|
||||
+http://sourceware.org/newlib/
|
||||
+*/
|
||||
+#include <sysdep.h>
|
||||
+
|
||||
+ .text
|
||||
+
|
||||
+/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */
|
||||
+
|
||||
+ENTRY(memcpy)
|
||||
+
|
||||
+ /* Assumes that n >= 0, and dst, src are valid pointers.
|
||||
+ If there is at least 8 bytes to copy, use LDRD/STRD.
|
||||
+ If src and dst are misaligned with different offsets,
|
||||
+ first copy byte by byte until dst is aligned,
|
||||
+ and then copy using LDRD/STRD and shift if needed.
|
||||
+ When less than 8 left, copy a word and then byte by byte. */
|
||||
+
|
||||
+ /* Save registers (r0 holds the return value):
|
||||
+ optimized push {r0, r4, r5, lr}.
|
||||
+ To try and improve performance, stack layout changed,
|
||||
+ i.e., not keeping the stack looking like users expect
|
||||
+ (highest numbered register at highest address). */
|
||||
+ push {r0, lr}
|
||||
+ strd r4, r5, [sp, #-8]!
|
||||
+
|
||||
+ /* TODO: Add debug frame directives.
|
||||
+ We don't need exception unwind directives, because the code below
|
||||
+ does not throw any exceptions and does not call any other functions.
|
||||
+ Generally, newlib functions like this lack debug information for
|
||||
+ assembler source. */
|
||||
+
|
||||
+ /* Get copying of tiny blocks out of the way first. */
|
||||
+ /* Is there at least 4 bytes to copy? */
|
||||
+ subs r2, r2, #4
|
||||
+ blt copy_less_than_4 /* If n < 4. */
|
||||
+
|
||||
+ /* Check word alignment. */
|
||||
+ ands ip, r0, #3 /* ip = last 2 bits of dst. */
|
||||
+ bne dst_not_word_aligned /* If dst is not word-aligned. */
|
||||
+
|
||||
+ /* Get here if dst is word-aligned. */
|
||||
+ ands ip, r1, #3 /* ip = last 2 bits of src. */
|
||||
+ bne src_not_word_aligned /* If src is not word-aligned. */
|
||||
+word_aligned:
|
||||
+ /* Get here if source and dst both are word-aligned.
|
||||
+ The number of bytes remaining to copy is r2+4. */
|
||||
+
|
||||
+ /* Is there is at least 64 bytes to copy? */
|
||||
+ subs r2, r2, #60
|
||||
+ blt copy_less_than_64 /* If r2 + 4 < 64. */
|
||||
+
|
||||
+ /* First, align the destination buffer to 8-bytes,
|
||||
+ to make sure double loads and stores don't cross cache line boundary,
|
||||
+ as they are then more expensive even if the data is in the cache
|
||||
+ (require two load/store issue cycles instead of one).
|
||||
+ If only one of the buffers is not 8-bytes aligned,
|
||||
+ then it's more important to align dst than src,
|
||||
+ because there is more penalty for stores
|
||||
+ than loads that cross cacheline boundary.
|
||||
+ This check and realignment are only worth doing
|
||||
+ if there is a lot to copy. */
|
||||
+
|
||||
+ /* Get here if dst is word aligned,
|
||||
+ i.e., the 2 least significant bits are 0.
|
||||
+ If dst is not 2w aligned (i.e., the 3rd bit is not set in dst),
|
||||
+ then copy 1 word (4 bytes). */
|
||||
+ ands r3, r0, #4
|
||||
+ beq 11f /* If dst already two-word aligned. */
|
||||
+ ldr r3, [r1], #4
|
||||
+ str r3, [r0], #4
|
||||
+ subs r2, r2, #4
|
||||
+ blt copy_less_than_64
|
||||
+
|
||||
+11:
|
||||
+ /* TODO: Align to cacheline (useful for PLD optimization). */
|
||||
+
|
||||
+ /* Every loop iteration copies 64 bytes. */
|
||||
+1:
|
||||
+ .irp offset, #0, #8, #16, #24, #32, #40, #48, #56
|
||||
+ ldrd r4, r5, [r1, \offset]
|
||||
+ strd r4, r5, [r0, \offset]
|
||||
+ .endr
|
||||
+
|
||||
+ add r0, r0, #64
|
||||
+ add r1, r1, #64
|
||||
+ subs r2, r2, #64
|
||||
+ bge 1b /* If there is more to copy. */
|
||||
+
|
||||
+copy_less_than_64:
|
||||
+
|
||||
+ /* Get here if less than 64 bytes to copy, -64 <= r2 < 0.
|
||||
+ Restore the count if there is more than 7 bytes to copy. */
|
||||
+ adds r2, r2, #56
|
||||
+ blt copy_less_than_8
|
||||
+
|
||||
+ /* Copy 8 bytes at a time. */
|
||||
+2:
|
||||
+ ldrd r4, r5, [r1], #8
|
||||
+ strd r4, r5, [r0], #8
|
||||
+ subs r2, r2, #8
|
||||
+ bge 2b /* If there is more to copy. */
|
||||
+
|
||||
+copy_less_than_8:
|
||||
+
|
||||
+ /* Get here if less than 8 bytes to copy, -8 <= r2 < 0.
|
||||
+ Check if there is more to copy. */
|
||||
+ cmn r2, #8
|
||||
+ beq return /* If r2 + 8 == 0. */
|
||||
+
|
||||
+ /* Restore the count if there is more than 3 bytes to copy. */
|
||||
+ adds r2, r2, #4
|
||||
+ blt copy_less_than_4
|
||||
+
|
||||
+ /* Copy 4 bytes. */
|
||||
+ ldr r3, [r1], #4
|
||||
+ str r3, [r0], #4
|
||||
+
|
||||
+copy_less_than_4:
|
||||
+ /* Get here if less than 4 bytes to copy, -4 <= r2 < 0. */
|
||||
+
|
||||
+ /* Restore the count, check if there is more to copy. */
|
||||
+ adds r2, r2, #4
|
||||
+ beq return /* If r2 == 0. */
|
||||
+
|
||||
+ /* Get here with r2 is in {1,2,3}={01,10,11}. */
|
||||
+ /* Logical shift left r2, insert 0s, update flags. */
|
||||
+ lsls r2, r2, #31
|
||||
+
|
||||
+ /* Copy byte by byte.
|
||||
+ Condition ne means the last bit of r2 is 0.
|
||||
+ Condition cs means the second to last bit of r2 is set,
|
||||
+ i.e., r2 is 1 or 3. */
|
||||
+ ldrneb r3, [r1], #1
|
||||
+ ldrcsb r4, [r1], #1
|
||||
+ ldrcsb ip, [r1]
|
||||
+ strneb r3, [r0], #1
|
||||
+ strcsb r4, [r0], #1
|
||||
+ strcsb ip, [r0]
|
||||
+
|
||||
+
|
||||
+return:
|
||||
+ /* Restore registers: optimized pop {r0, r4, r5, pc} */
|
||||
+ ldrd r4, r5, [sp], #8
|
||||
+ pop {r0, pc} /* This is the only return point of memcpy. */
|
||||
+
|
||||
+#ifndef __ARM_FEATURE_UNALIGNED
|
||||
+
|
||||
+ /* The following assembly macro implements misaligned copy in software.
|
||||
+ Assumes that dst is word aligned, src is at offset "pull" bits from
|
||||
+ word, push = 32 - pull, and the number of bytes that remain to copy
|
||||
+ is r2 + 4, r2 >= 0. */
|
||||
+
|
||||
+ /* In the code below, r2 is the number of bytes that remain to be
|
||||
+ written. The number of bytes read is always larger, because we have
|
||||
+ partial words in the shift queue. */
|
||||
+
|
||||
+ .macro miscopy pull push shiftleft shiftright
|
||||
+
|
||||
+ /* Align src to the previous word boundary. */
|
||||
+ bic r1, r1, #3
|
||||
+
|
||||
+ /* Initialize the shift queue. */
|
||||
+ ldr r5, [r1], #4 /* Load a word from source. */
|
||||
+
|
||||
+ subs r2, r2, #4
|
||||
+ blt 6f /* Go to misaligned copy of less than 8 bytes. */
|
||||
+
|
||||
+ /* Get here if there is more than 8 bytes to copy.
|
||||
+ The number of bytes to copy is r2+8, r2 >= 0. */
|
||||
+
|
||||
+ /* Save registers: push { r6, r7 }.
|
||||
+ We need additional registers for LDRD and STRD, because in ARM state
|
||||
+ the first destination register must be even and the second
|
||||
+ consecutive. */
|
||||
+ strd r6, r7, [sp, #-8]!
|
||||
+
|
||||
+ subs r2, r2, #56
|
||||
+ blt 4f /* Go to misaligned copy of less than 64 bytes. */
|
||||
+
|
||||
+3:
|
||||
+ /* Get here if there is more than 64 bytes to copy.
|
||||
+ The number of bytes to copy is r2+64, r2 >= 0. */
|
||||
+
|
||||
+ /* Copy 64 bytes in every iteration.
|
||||
+ Use a partial word from the shift queue. */
|
||||
+ .irp offset, #0, #8, #16, #24, #32, #40, #48, #56
|
||||
+ mov r6, r5, \shiftleft #\pull
|
||||
+ ldrd r4, r5, [r1, \offset]
|
||||
+ orr r6, r6, r4, \shiftright #\push
|
||||
+ mov r7, r4, \shiftleft #\pull
|
||||
+ orr r7, r7, r5, \shiftright #\push
|
||||
+ strd r6, r7, [r0, \offset]
|
||||
+ .endr
|
||||
+
|
||||
+ add r1, r1, #64
|
||||
+ add r0, r0, #64
|
||||
+ subs r2, r2, #64
|
||||
+ bge 3b
|
||||
+
|
||||
+4:
|
||||
+ /* Get here if there is less than 64 bytes to copy (-64 <= r2 < 0)
|
||||
+ and they are misaligned. */
|
||||
+
|
||||
+ /* Restore the count if there is more than 7 bytes to copy. */
|
||||
+ adds r2, r2, #56
|
||||
+
|
||||
+ /* If less than 8 bytes to copy,
|
||||
+ restore registers saved for this loop: optimized poplt { r6, r7 }. */
|
||||
+ itt lt
|
||||
+ ldrltd r6, r7, [sp], #8
|
||||
+ blt 6f /* Go to misaligned copy of less than 8 bytes. */
|
||||
+
|
||||
+5:
|
||||
+ /* Copy 8 bytes at a time.
|
||||
+ Use a partial word from the shift queue. */
|
||||
+ mov r6, r5, \shiftleft #\pull
|
||||
+ ldrd r4, r5, [r1], #8
|
||||
+ orr r6, r6, r4, \shiftright #\push
|
||||
+ mov r7, r4, \shiftleft #\pull
|
||||
+ orr r7, r7, r5, \shiftright #\push
|
||||
+ strd r6, r7, [r0], #8
|
||||
+
|
||||
+ subs r2, r2, #8
|
||||
+ bge 5b /* If there is more to copy. */
|
||||
+
|
||||
+ /* Restore registers saved for this loop: optimized pop { r6, r7 }. */
|
||||
+ ldrd r6, r7, [sp], #8
|
||||
+
|
||||
+6:
|
||||
+ /* Get here if there less than 8 bytes to copy (-8 <= r2 < 0)
|
||||
+ and they are misaligned. */
|
||||
+
|
||||
+ /* Check if there is more to copy. */
|
||||
+ cmn r2, #8
|
||||
+ beq return
|
||||
+
|
||||
+ /* Check if there is less than 4 bytes to copy. */
|
||||
+ cmn r2, #4
|
||||
+
|
||||
+ itt lt
|
||||
+ /* Restore src offset from word-align. */
|
||||
+ sublt r1, r1, #(\push / 8)
|
||||
+ blt copy_less_than_4
|
||||
+
|
||||
+ /* Use a partial word from the shift queue. */
|
||||
+ mov r3, r5, \shiftleft #\pull
|
||||
+ /* Load a word from src, but without writeback
|
||||
+ (this word is not fully written to dst). */
|
||||
+ ldr r5, [r1]
|
||||
+
|
||||
+ /* Restore src offset from word-align. */
|
||||
+ add r1, r1, #(\pull / 8)
|
||||
+
|
||||
+ /* Shift bytes to create one dst word and store it. */
|
||||
+ orr r3, r3, r5, \shiftright #\push
|
||||
+ str r3, [r0], #4
|
||||
+
|
||||
+ /* Use single byte copying of the remaining bytes. */
|
||||
+ b copy_less_than_4
|
||||
+
|
||||
+ .endm
|
||||
+
|
||||
+#endif /* not __ARM_FEATURE_UNALIGNED */
|
||||
+
|
||||
+dst_not_word_aligned:
|
||||
+
|
||||
+ /* Get here when dst is not aligned and ip has the last 2 bits of dst,
|
||||
+ i.e., ip is the offset of dst from word.
|
||||
+ The number of bytes that remains to copy is r2 + 4,
|
||||
+ i.e., there are at least 4 bytes to copy.
|
||||
+ Write a partial word (0 to 3 bytes), such that dst becomes
|
||||
+ word-aligned. */
|
||||
+
|
||||
+ /* If dst is at ip bytes offset from a word (with 0 < ip < 4),
|
||||
+ then there are (4 - ip) bytes to fill up to align dst to the next
|
||||
+ word. */
|
||||
+ rsb ip, ip, #4 /* ip = #4 - ip. */
|
||||
+ cmp ip, #2
|
||||
+
|
||||
+ /* Copy byte by byte with conditionals. */
|
||||
+ ldrgtb r3, [r1], #1
|
||||
+ ldrgeb r4, [r1], #1
|
||||
+ ldrb lr, [r1], #1
|
||||
+ strgtb r3, [r0], #1
|
||||
+ strgeb r4, [r0], #1
|
||||
+ subs r2, r2, ip
|
||||
+ strb lr, [r0], #1
|
||||
+ /* Update the count.
|
||||
+ ip holds the number of bytes we have just copied. */
|
||||
+ /*subs r2, r2, ip /* r2 = r2 - ip. */
|
||||
+ blt copy_less_than_4 /* If r2 < ip. */
|
||||
+
|
||||
+ /* Get here if there are more than 4 bytes to copy.
|
||||
+ Check if src is aligned. If beforehand src and dst were not word
|
||||
+ aligned but congruent (same offset), then now they are both
|
||||
+ word-aligned, and we can copy the rest efficiently (without
|
||||
+ shifting). */
|
||||
+ ands ip, r1, #3 /* ip = last 2 bits of src. */
|
||||
+ beq word_aligned /* If r1 is word-aligned. */
|
||||
+
|
||||
+src_not_word_aligned:
|
||||
+ /* Get here when src is not word-aligned, but dst is word-aligned.
|
||||
+ The number of bytes that remains to copy is r2+4. */
|
||||
+
|
||||
+#ifdef __ARM_FEATURE_UNALIGNED
|
||||
+ /* Copy word by word using LDR when alignment can be done in hardware,
|
||||
+ i.e., SCTLR.A is set, supporting unaligned access in LDR and STR. */
|
||||
+ subs r2, r2, #60
|
||||
+ blt 8f
|
||||
+
|
||||
+7:
|
||||
+ /* Copy 64 bytes in every loop iteration. */
|
||||
+ .irp offset, #0, #4, #8, #12, #16, #20, #24, #28, #32, #36, #40, #44, #48, #52, #56, #60
|
||||
+ ldr r3, [r1, \offset]
|
||||
+ str r3, [r0, \offset]
|
||||
+ .endr
|
||||
+
|
||||
+ add r0, r0, #64
|
||||
+ add r1, r1, #64
|
||||
+ subs r2, r2, #64
|
||||
+ bge 7b
|
||||
+
|
||||
+8:
|
||||
+ /* Get here if less than 64 bytes to copy, -64 <= r2 < 0.
|
||||
+ Check if there is more than 3 bytes to copy. */
|
||||
+ adds r2, r2, #60
|
||||
+ blt copy_less_than_4
|
||||
+
|
||||
+9:
|
||||
+ /* Get here if there is less than 64 but at least 4 bytes to copy,
|
||||
+ where the number of bytes to copy is r2+4. */
|
||||
+ ldr r3, [r1], #4
|
||||
+ str r3, [r0], #4
|
||||
+ subs r2, r2, #4
|
||||
+ bge 9b
|
||||
+
|
||||
+ b copy_less_than_4
|
||||
+
|
||||
+#else /* not __ARM_FEATURE_UNALIGNED */
|
||||
+
|
||||
+ /* ip has last 2 bits of src,
|
||||
+ i.e., ip is the offset of src from word, and ip > 0.
|
||||
+ Compute shifts needed to copy from src to dst. */
|
||||
+ cmp ip, #2
|
||||
+ beq miscopy_16_16 /* If ip == 2. */
|
||||
+ bge miscopy_24_8 /* If ip == 3. */
|
||||
+
|
||||
+ /* Get here if ip == 1. */
|
||||
+
|
||||
+ /* Endian independent macros for shifting bytes within registers. */
|
||||
+
|
||||
+#ifndef __ARMEB__
|
||||
+miscopy_8_24: miscopy pull=8 push=24 shiftleft=lsr shiftright=lsl
|
||||
+miscopy_16_16: miscopy pull=16 push=16 shiftleft=lsr shiftright=lsl
|
||||
+miscopy_24_8: miscopy pull=24 push=8 shiftleft=lsr shiftright=lsl
|
||||
+#else /* not __ARMEB__ */
|
||||
+miscopy_8_24: miscopy pull=8 push=24 shiftleft=lsl shiftright=lsr
|
||||
+miscopy_16_16: miscopy pull=16 push=16 shiftleft=lsl shiftright=lsr
|
||||
+miscopy_24_8: miscopy pull=24 push=8 shiftleft=lsl shiftright=lsr
|
||||
+#endif /* not __ARMEB__ */
|
||||
+
|
||||
+#endif /* not __ARM_FEATURE_UNALIGNED */
|
||||
+
|
||||
+END(memcpy)
|
||||
+libc_hidden_builtin_def (memcpy)
|
@ -1,273 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.15-r2.ebuild,v 1.1 2012/05/18 05:04:44 vapier Exp $
|
||||
|
||||
inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib unpacker binutils-funcs
|
||||
|
||||
DESCRIPTION="GNU libc6 (also called glibc2) C library"
|
||||
HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
|
||||
|
||||
LICENSE="LGPL-2"
|
||||
KEYWORDS="amd64 arm ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc x86"
|
||||
RESTRICT="strip" # strip ourself #46186
|
||||
EMULTILIB_PKG="true"
|
||||
|
||||
# Configuration variables
|
||||
RELEASE_VER=""
|
||||
BRANCH_UPDATE=""
|
||||
SNAP_VER=""
|
||||
case ${PV} in
|
||||
9999*)
|
||||
EGIT_REPO_URIS=( "git://sourceware.org/git/glibc.git" "git://sourceware.org/git/glibc-ports.git" )
|
||||
EGIT_SOURCEDIRS=( "${S}" "${S}/ports" )
|
||||
inherit git-2
|
||||
;;
|
||||
*_p*)
|
||||
RELEASE_VER=${PV%_p*}
|
||||
SNAP_VER=${PV#*_p}
|
||||
;;
|
||||
*)
|
||||
RELEASE_VER=${PV}
|
||||
;;
|
||||
esac
|
||||
MANPAGE_VER="" # pregenerated manpages
|
||||
INFOPAGE_VER="" # pregenerated infopages
|
||||
LIBIDN_VER="" # it's integrated into the main tarball now
|
||||
PATCH_VER="22" # Gentoo patchset
|
||||
PORTS_VER=${RELEASE_VER} # version of glibc ports addon
|
||||
NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
|
||||
|
||||
IUSE="debug gd hardened multilib selinux profile vanilla crosscompile_opts_headers-only"
|
||||
[[ -n ${RELEASE_VER} ]] && S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
|
||||
|
||||
# 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-} != ${CATEGORY} ]] ; then
|
||||
export CTARGET=${CATEGORY/cross-}
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
|
||||
|
||||
is_crosscompile() {
|
||||
[[ ${CHOST} != ${CTARGET} ]]
|
||||
}
|
||||
alt_libdir() {
|
||||
if is_crosscompile ; then
|
||||
echo /usr/${CTARGET}/$(get_libdir)
|
||||
else
|
||||
echo /$(get_libdir)
|
||||
fi
|
||||
}
|
||||
|
||||
if is_crosscompile ; then
|
||||
SLOT="${CTARGET}-2.2"
|
||||
else
|
||||
# Why SLOT 2.2 you ask yourself while sippin your tea ?
|
||||
# Everyone knows 2.2 > 0, duh.
|
||||
SLOT="2.2"
|
||||
fi
|
||||
|
||||
# General: We need a new-enough binutils for as-needed
|
||||
# arch: we need to make sure our binutils/gcc supports TLS
|
||||
DEPEND=">=sys-devel/gcc-3.4.4
|
||||
arm? ( >=sys-devel/binutils-2.16.90 >=sys-devel/gcc-4.1.0 )
|
||||
x86? ( >=sys-devel/gcc-4.3 )
|
||||
amd64? ( >=sys-devel/binutils-2.19 >=sys-devel/gcc-4.3 )
|
||||
ppc? ( >=sys-devel/gcc-4.1.0 )
|
||||
ppc64? ( >=sys-devel/gcc-4.1.0 )
|
||||
>=sys-devel/binutils-2.15.94
|
||||
>=app-misc/pax-utils-0.1.10
|
||||
virtual/os-headers
|
||||
!<sys-apps/sandbox-1.2.18.1-r2
|
||||
!<sys-apps/portage-2.1.2
|
||||
>=sys-devel/patch-2.6.1
|
||||
selinux? ( sys-libs/libselinux )"
|
||||
RDEPEND="!sys-kernel/ps3-sources
|
||||
selinux? ( sys-libs/libselinux )
|
||||
!sys-libs/nss-db"
|
||||
|
||||
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
|
||||
DEPEND="${DEPEND} !crosscompile_opts_headers-only? ( ${CATEGORY}/gcc )"
|
||||
[[ ${CATEGORY} == *-linux* ]] && DEPEND="${DEPEND} ${CATEGORY}/linux-headers"
|
||||
else
|
||||
DEPEND="${DEPEND} !vanilla? ( >=sys-libs/timezone-data-2007c )"
|
||||
RDEPEND="${RDEPEND}
|
||||
vanilla? ( !sys-libs/timezone-data )
|
||||
!vanilla? ( sys-libs/timezone-data )"
|
||||
fi
|
||||
|
||||
SRC_URI=$(
|
||||
upstream_uris() {
|
||||
echo mirror://gnu/glibc/$1 ftp://sources.redhat.com/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
|
||||
}
|
||||
gentoo_uris() {
|
||||
local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
|
||||
devspace=${devspace//HTTP/http://dev.gentoo.org/}
|
||||
echo mirror://gentoo/$1 ${devspace//URI/$1}
|
||||
}
|
||||
|
||||
TARNAME=${PN}
|
||||
if [[ -n ${SNAP_VER} ]] ; then
|
||||
TARNAME="${PN}-${RELEASE_VER}"
|
||||
[[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
|
||||
upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
|
||||
elif [[ -z ${EGIT_REPO_URIS} ]] ; then
|
||||
upstream_uris ${TARNAME}-${RELEASE_VER}.tar.xz
|
||||
fi
|
||||
[[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
|
||||
[[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.xz
|
||||
[[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
|
||||
[[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
|
||||
[[ -n ${MANPAGE_VER} ]] && gentoo_uris glibc-manpages-${MANPAGE_VER}.tar.bz2
|
||||
[[ -n ${INFOPAGE_VER} ]] && gentoo_uris glibc-infopages-${INFOPAGE_VER}.tar.bz2
|
||||
)
|
||||
|
||||
# eblit-include [--skip] <function> [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 <function> [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 <function>
|
||||
# run the specified function if it is defined
|
||||
eblit-run-maybe() {
|
||||
[[ $(type -t "$@") == "function" ]] && "$@"
|
||||
}
|
||||
|
||||
# eblit-run <function> [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_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() {
|
||||
if [[ ${CTARGET} == x86_64* ]] && has x32 $(get_all_abis) ; then
|
||||
GLIBC_PATCH_EXCLUDE+=" 0080_all_glibc-2.15-revert-x86_64-eagain-pthread_cond_wait.patch"
|
||||
else
|
||||
GLIBC_PATCH_EXCLUDE+=" 1200_all_glibc-${PV}-x32.patch"
|
||||
fi
|
||||
}
|
||||
|
||||
eblit-src_unpack-post() {
|
||||
cd "${S}"
|
||||
epatch "${FILESDIR}"/local/glibc-2.14-file-mangle.patch
|
||||
epatch "${FILESDIR}"/2.11/glibc-2.11-frecord-gcc-switches.patch
|
||||
epatch "${FILESDIR}"/2.11/glibc-2.11-disable-memset-warning.patch
|
||||
epatch "${FILESDIR}"/2.11/glibc-2.11-resolv-milliseconds.patch
|
||||
epatch "${FILESDIR}"/local/glibc-2.15-arm-memcpy.patch
|
||||
if use hardened ; then
|
||||
cd "${S}"
|
||||
einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
|
||||
gcc-specs-pie && epatch "${FILESDIR}"/2.12/glibc-2.12-hardened-pie.patch
|
||||
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
|
||||
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
|
||||
epatch "${FILESDIR}"/2.11/glibc-2.11-tls-stack-addition.patch
|
||||
|
||||
einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
|
||||
cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
|
||||
debug/stack_chk_fail.c || die
|
||||
cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
|
||||
debug/chk_fail.c || die
|
||||
|
||||
if use debug ; then
|
||||
# When using Hardened Gentoo stack handler, have smashes dump core for
|
||||
# analysis - debug only, as core could be an information leak
|
||||
# (paranoia).
|
||||
sed -i \
|
||||
-e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
||||
debug/Makefile \
|
||||
|| die "Failed to modify debug/Makefile for debug stack handler"
|
||||
sed -i \
|
||||
-e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
||||
debug/Makefile \
|
||||
|| die "Failed to modify debug/Makefile for debug fortify handler"
|
||||
fi
|
||||
|
||||
# Build nscd with ssp-all
|
||||
sed -i \
|
||||
-e 's:-fstack-protector$:-fstack-protector-all:' \
|
||||
nscd/Makefile \
|
||||
|| die "Failed to ensure nscd builds with ssp-all"
|
||||
fi
|
||||
}
|
||||
|
||||
eblit-pkg_preinst-post() {
|
||||
if [[ ${CTARGET} == arm* ]] ; then
|
||||
# Backwards compat support for renaming hardfp ldsos #417287
|
||||
local oldso='/lib/ld-linux.so.3'
|
||||
local nldso='/lib/ld-linux-armhf.so.3'
|
||||
if [[ -e ${D}${nldso} ]] ; then
|
||||
if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
|
||||
ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
|
||||
ewarn "Please rebuild all packages using this old ldso as compat"
|
||||
ewarn "support will be dropped in the future."
|
||||
ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
maint_pkg_create() {
|
||||
local base="/usr/local/src/gnu/glibc/glibc-${PV:0:1}_${PV:2:1}"
|
||||
cd ${base}
|
||||
local stamp=$(date +%Y%m%d)
|
||||
local d
|
||||
for d in libc ports ; do
|
||||
#(cd ${d} && cvs up)
|
||||
case ${d} in
|
||||
libc) tarball="${P}";;
|
||||
ports) tarball="${PN}-ports-${PV}";;
|
||||
esac
|
||||
rm -f ${tarball}*
|
||||
ln -sf ${d} ${tarball}
|
||||
tar hcf - ${tarball} --exclude-vcs | lzma > "${T}"/${tarball}.tar.lzma
|
||||
du -b "${T}"/${tarball}.tar.lzma
|
||||
done
|
||||
}
|
@ -1,227 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.16.0.ebuild,v 1.16 2012/11/18 09:32:24 vapier Exp $
|
||||
|
||||
inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib unpacker multiprocessing
|
||||
|
||||
DESCRIPTION="GNU libc6 (also called glibc2) C library"
|
||||
HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
|
||||
|
||||
LICENSE="LGPL-2"
|
||||
KEYWORDS=""
|
||||
RESTRICT="strip" # strip ourself #46186
|
||||
EMULTILIB_PKG="true"
|
||||
|
||||
# Configuration variables
|
||||
RELEASE_VER=""
|
||||
BRANCH_UPDATE=""
|
||||
SNAP_VER=""
|
||||
case ${PV} in
|
||||
9999*)
|
||||
EGIT_REPO_URIS=( "git://sourceware.org/git/glibc.git" "git://sourceware.org/git/glibc-ports.git" )
|
||||
EGIT_SOURCEDIRS=( "${S}" "${S}/ports" )
|
||||
inherit git-2
|
||||
;;
|
||||
*_p*)
|
||||
RELEASE_VER=${PV%_p*}
|
||||
SNAP_VER=${PV#*_p}
|
||||
;;
|
||||
*)
|
||||
RELEASE_VER=${PV}
|
||||
;;
|
||||
esac
|
||||
MANPAGE_VER="" # pregenerated manpages
|
||||
INFOPAGE_VER="" # pregenerated infopages
|
||||
LIBIDN_VER="" # it's integrated into the main tarball now
|
||||
PATCH_VER="8" # Gentoo patchset
|
||||
PORTS_VER=${RELEASE_VER} # version of glibc ports addon
|
||||
NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.16"} # min kernel version nptl requires
|
||||
|
||||
IUSE="debug gd hardened multilib selinux systemtap profile vanilla crosscompile_opts_headers-only"
|
||||
[[ -n ${RELEASE_VER} ]] && S=${WORKDIR}/glibc-${RELEASE_VER}${SNAP_VER:+-${SNAP_VER}}
|
||||
|
||||
# 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
|
||||
|
||||
[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.16/2.6.20}
|
||||
|
||||
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
|
||||
!<sys-apps/sandbox-1.6
|
||||
!<sys-apps/portage-2.1.2
|
||||
selinux? ( sys-libs/libselinux )"
|
||||
RDEPEND="!sys-kernel/ps3-sources
|
||||
selinux? ( sys-libs/libselinux )
|
||||
!sys-libs/nss-db"
|
||||
|
||||
if [[ ${CATEGORY} == cross-* ]] ; then
|
||||
DEPEND+=" !crosscompile_opts_headers-only? (
|
||||
>=${CATEGORY}/binutils-2.20
|
||||
>=${CATEGORY}/gcc-4.3
|
||||
)"
|
||||
[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
|
||||
else
|
||||
DEPEND+="
|
||||
>=sys-devel/binutils-2.20
|
||||
>=sys-devel/gcc-4.3
|
||||
virtual/os-headers
|
||||
!vanilla? ( >=sys-libs/timezone-data-2012c )"
|
||||
RDEPEND+="
|
||||
vanilla? ( !sys-libs/timezone-data )
|
||||
!vanilla? ( sys-libs/timezone-data )"
|
||||
fi
|
||||
|
||||
SRC_URI=$(
|
||||
upstream_uris() {
|
||||
echo mirror://gnu/glibc/$1 ftp://sources.redhat.com/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
|
||||
}
|
||||
gentoo_uris() {
|
||||
local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
|
||||
devspace=${devspace//HTTP/http://dev.gentoo.org/}
|
||||
echo mirror://gentoo/$1 ${devspace//URI/$1}
|
||||
}
|
||||
|
||||
TARNAME=${PN}
|
||||
if [[ -n ${SNAP_VER} ]] ; then
|
||||
TARNAME="${PN}-${RELEASE_VER}"
|
||||
[[ -n ${PORTS_VER} ]] && PORTS_VER=${SNAP_VER}
|
||||
upstream_uris ${TARNAME}-${SNAP_VER}.tar.bz2
|
||||
elif [[ -z ${EGIT_REPO_URIS} ]] ; then
|
||||
upstream_uris ${TARNAME}-${RELEASE_VER}.tar.xz
|
||||
fi
|
||||
[[ -n ${LIBIDN_VER} ]] && upstream_uris glibc-libidn-${LIBIDN_VER}.tar.bz2
|
||||
[[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.xz
|
||||
[[ -n ${BRANCH_UPDATE} ]] && gentoo_uris glibc-${RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
|
||||
[[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
|
||||
[[ -n ${MANPAGE_VER} ]] && gentoo_uris glibc-manpages-${MANPAGE_VER}.tar.bz2
|
||||
[[ -n ${INFOPAGE_VER} ]] && gentoo_uris glibc-infopages-${INFOPAGE_VER}.tar.bz2
|
||||
)
|
||||
|
||||
# eblit-include [--skip] <function> [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 <function> [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 <function>
|
||||
# run the specified function if it is defined
|
||||
eblit-run-maybe() {
|
||||
[[ $(type -t "$@") == "function" ]] && "$@"
|
||||
}
|
||||
|
||||
# eblit-run <function> [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_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-post() {
|
||||
if use hardened ; then
|
||||
cd "${S}"
|
||||
einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
|
||||
gcc-specs-pie && epatch "${FILESDIR}"/2.16/glibc-2.16-hardened-pie.patch
|
||||
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
|
||||
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
|
||||
|
||||
einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
|
||||
cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
|
||||
debug/stack_chk_fail.c || die
|
||||
cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
|
||||
debug/chk_fail.c || die
|
||||
|
||||
if use debug ; then
|
||||
# When using Hardened Gentoo stack handler, have smashes dump core for
|
||||
# analysis - debug only, as core could be an information leak
|
||||
# (paranoia).
|
||||
sed -i \
|
||||
-e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
||||
debug/Makefile \
|
||||
|| die "Failed to modify debug/Makefile for debug stack handler"
|
||||
sed -i \
|
||||
-e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
||||
debug/Makefile \
|
||||
|| die "Failed to modify debug/Makefile for debug fortify handler"
|
||||
fi
|
||||
|
||||
# Build nscd with ssp-all
|
||||
sed -i \
|
||||
-e 's:-fstack-protector$:-fstack-protector-all:' \
|
||||
nscd/Makefile \
|
||||
|| die "Failed to ensure nscd builds with ssp-all"
|
||||
fi
|
||||
}
|
||||
|
||||
eblit-pkg_preinst-post() {
|
||||
if [[ ${CTARGET} == arm* ]] ; then
|
||||
# Backwards compat support for renaming hardfp ldsos #417287
|
||||
local oldso='/lib/ld-linux.so.3'
|
||||
local nldso='/lib/ld-linux-armhf.so.3'
|
||||
if [[ -e ${D}${nldso} ]] ; then
|
||||
if scanelf -qRyi "${ROOT}$(alt_prefix)"/*bin/ | grep -s "^${oldso}" ; then
|
||||
ewarn "Symlinking old ldso (${oldso}) to new ldso (${nldso})."
|
||||
ewarn "Please rebuild all packages using this old ldso as compat"
|
||||
ewarn "support will be dropped in the future."
|
||||
ln -s "${nldso##*/}" "${D}$(alt_prefix)${oldso}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
# Copyright 1999-2012 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-9999.ebuild,v 1.16 2012/11/02 18:25:11 vapier Exp $
|
||||
|
||||
inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib unpacker multiprocessing binutils-funcs
|
||||
|
||||
DESCRIPTION="GNU libc6 (also called glibc2) C library"
|
||||
HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
|
||||
|
||||
LICENSE="LGPL-2"
|
||||
#KEYWORDS="~amd64 ~ia64 ~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" "git://sourceware.org/git/glibc-ports.git" )
|
||||
EGIT_SOURCEDIRS=( "${S}" "${S}/ports" )
|
||||
inherit git-2
|
||||
;;
|
||||
*)
|
||||
RELEASE_VER=${PV}
|
||||
;;
|
||||
esac
|
||||
PATCH_VER="" # Gentoo patchset
|
||||
PORTS_VER=${RELEASE_VER} # version of glibc ports addon
|
||||
NPTL_KERN_VER=${NPTL_KERN_VER:-"2.6.9"} # min kernel version nptl requires
|
||||
|
||||
IUSE="debug gd hardened multilib selinux systemtap profile 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
|
||||
|
||||
[[ ${CTARGET} == hppa* ]] && NPTL_KERN_VER=${NPTL_KERN_VER/2.6.9/2.6.20}
|
||||
|
||||
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
|
||||
!<sys-apps/sandbox-1.6
|
||||
!<sys-apps/portage-2.1.2
|
||||
selinux? ( sys-libs/libselinux )"
|
||||
RDEPEND="!sys-kernel/ps3-sources
|
||||
selinux? ( sys-libs/libselinux )
|
||||
!sys-libs/nss-db"
|
||||
|
||||
if [[ ${CATEGORY} == cross-* ]] ; then
|
||||
DEPEND+=" !crosscompile_opts_headers-only? (
|
||||
>=${CATEGORY}/binutils-2.20
|
||||
>=${CATEGORY}/gcc-4.3
|
||||
)"
|
||||
[[ ${CATEGORY} == *-linux* ]] && DEPEND+=" ${CATEGORY}/linux-headers"
|
||||
else
|
||||
DEPEND+="
|
||||
>=sys-devel/binutils-2.20
|
||||
>=sys-devel/gcc-4.3
|
||||
virtual/os-headers
|
||||
!vanilla? ( >=sys-libs/timezone-data-2012c )"
|
||||
RDEPEND+="
|
||||
vanilla? ( !sys-libs/timezone-data )
|
||||
!vanilla? ( sys-libs/timezone-data )"
|
||||
fi
|
||||
|
||||
SRC_URI=$(
|
||||
upstream_uris() {
|
||||
echo mirror://gnu/glibc/$1 ftp://sources.redhat.com/pub/glibc/{releases,snapshots}/$1 mirror://gentoo/$1
|
||||
}
|
||||
gentoo_uris() {
|
||||
local devspace="HTTP~vapier/dist/URI HTTP~azarah/glibc/URI"
|
||||
devspace=${devspace//HTTP/http://dev.gentoo.org/}
|
||||
echo mirror://gentoo/$1 ${devspace//URI/$1}
|
||||
}
|
||||
|
||||
[[ -z ${EGIT_REPO_URIS} ]] && upstream_uris ${P}.tar.xz
|
||||
[[ -n ${PORTS_VER} ]] && upstream_uris ${TARNAME}-ports-${PORTS_VER}.tar.bz2
|
||||
[[ -n ${PATCH_VER} ]] && gentoo_uris glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2
|
||||
)
|
||||
|
||||
# eblit-include [--skip] <function> [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 <function> [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 <function>
|
||||
# run the specified function if it is defined
|
||||
eblit-run-maybe() {
|
||||
[[ $(type -t "$@") == "function" ]] && "$@"
|
||||
}
|
||||
|
||||
# eblit-run <function> [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_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-post() {
|
||||
if use hardened ; then
|
||||
cd "${S}"
|
||||
einfo "Patching to get working PIE binaries on PIE (hardened) platforms"
|
||||
gcc-specs-pie && epatch "${FILESDIR}"/2.12/glibc-2.12-hardened-pie.patch
|
||||
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-configure-picdefault.patch
|
||||
epatch "${FILESDIR}"/2.10/glibc-2.10-hardened-inittls-nosysenter.patch
|
||||
|
||||
einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler"
|
||||
cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \
|
||||
debug/stack_chk_fail.c || die
|
||||
cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \
|
||||
debug/chk_fail.c || die
|
||||
|
||||
if use debug ; then
|
||||
# When using Hardened Gentoo stack handler, have smashes dump core for
|
||||
# analysis - debug only, as core could be an information leak
|
||||
# (paranoia).
|
||||
sed -i \
|
||||
-e '/^CFLAGS-backtrace.c/ iCFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
||||
debug/Makefile \
|
||||
|| die "Failed to modify debug/Makefile for debug stack handler"
|
||||
sed -i \
|
||||
-e '/^CFLAGS-backtrace.c/ iCFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \
|
||||
debug/Makefile \
|
||||
|| die "Failed to modify debug/Makefile for debug fortify handler"
|
||||
fi
|
||||
|
||||
# Build nscd with ssp-all
|
||||
sed -i \
|
||||
-e 's:-fstack-protector$:-fstack-protector-all:' \
|
||||
nscd/Makefile \
|
||||
|| die "Failed to ensure nscd builds with ssp-all"
|
||||
fi
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user