summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-05-10 21:02:47 +0000
committerMike Frysinger <vapier@gentoo.org>2009-05-10 21:02:47 +0000
commit17f361039b4296a834ad766e533e891b0e29dd59 (patch)
treebcaab61f96d3fb707c0ab716bc9524e5ceb05fcf /sys-apps/util-linux
parentInitial commit. Required for farsight2. (diff)
downloadgentoo-2-17f361039b4296a834ad766e533e891b0e29dd59.tar.gz
gentoo-2-17f361039b4296a834ad766e533e891b0e29dd59.tar.bz2
gentoo-2-17f361039b4296a834ad766e533e891b0e29dd59.zip
Fix building on hardened due to PIC/cpuid #269001 by Juergen Rose.
(Portage version: 2.2_rc33/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/util-linux')
-rw-r--r--sys-apps/util-linux/ChangeLog6
-rw-r--r--sys-apps/util-linux/files/util-linux-2.15-cpuid-pic.patch51
-rw-r--r--sys-apps/util-linux/util-linux-2.15.ebuild3
3 files changed, 58 insertions, 2 deletions
diff --git a/sys-apps/util-linux/ChangeLog b/sys-apps/util-linux/ChangeLog
index bbb02a9fcb23..05793688f950 100644
--- a/sys-apps/util-linux/ChangeLog
+++ b/sys-apps/util-linux/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-apps/util-linux
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.261 2009/05/09 15:10:56 klausman Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.262 2009/05/10 21:02:47 vapier Exp $
+
+ 10 May 2009; Mike Frysinger <vapier@gentoo.org> util-linux-2.15.ebuild,
+ +files/util-linux-2.15-cpuid-pic.patch:
+ Fix building on hardened due to PIC/cpuid #269001 by Juergen Rose.
09 May 2009; Tobias Klausmann <klausman@gentoo.org>
util-linux-2.14.2.ebuild:
diff --git a/sys-apps/util-linux/files/util-linux-2.15-cpuid-pic.patch b/sys-apps/util-linux/files/util-linux-2.15-cpuid-pic.patch
new file mode 100644
index 000000000000..feaa1af8e37f
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.15-cpuid-pic.patch
@@ -0,0 +1,51 @@
+http://bugs.gentoo.org/269001
+http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/2203
+
+From 89dbd3ee8678bc43de027a99974451acbfc04cf3 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 10 May 2009 16:34:33 -0400
+Subject: [PATCH] lscpu: fix cpuid code on x86/PIC
+
+If we build lscpu as PIE, we currently get a build failure:
+lscpu.c: In function 'main':
+lscpu.c:333: error: can't find a register in class 'BREG' while reloading 'asm'
+lscpu.c:333: error: 'asm' operand has impossible constraints
+make[2]: *** [lscpu.o] Error 1
+
+So we need a little bit of register shuffling to keep gcc happy.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ sys-utils/lscpu.c | 16 +++++++++++++---
+ 1 files changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
+index 3e3fbbe..6b6082f 100644
+--- a/sys-utils/lscpu.c
++++ b/sys-utils/lscpu.c
+@@ -330,9 +330,19 @@ static inline void
+ cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+ {
+- __asm__("cpuid"
+- : "=a" (*eax),
+- "=b" (*ebx),
++ __asm__(
++#if defined(__PIC__) && defined(__i386__)
++ /* x86 PIC cannot clobber ebx -- gcc bitches */
++ "pushl %%ebx;"
++ "cpuid;"
++ "movl %%ebx, %%esi;"
++ "popl %%ebx;"
++ : "=S" (*ebx),
++#else
++ "cpuid;"
++ : "=b" (*ebx),
++#endif
++ "=a" (*eax),
+ "=c" (*ecx),
+ "=d" (*edx)
+ : "0" (op), "c"(0));
+--
+1.6.2.3
+
diff --git a/sys-apps/util-linux/util-linux-2.15.ebuild b/sys-apps/util-linux/util-linux-2.15.ebuild
index 7f88c657548b..68f3b82e3413 100644
--- a/sys-apps/util-linux/util-linux-2.15.ebuild
+++ b/sys-apps/util-linux/util-linux-2.15.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/util-linux-2.15.ebuild,v 1.1 2009/05/05 22:07:29 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/util-linux-2.15.ebuild,v 1.2 2009/05/10 21:02:46 vapier Exp $
EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/util-linux-ng/util-linux-ng.git"
inherit eutils
@@ -43,6 +43,7 @@ src_unpack() {
unpack ${A}
cd "${S}"
#epatch "${FILESDIR}"/${PN}-2.13-uclibc.patch #203711
+ epatch "${FILESDIR}"/${P}-cpuid-pic.patch #269001
use loop-aes && epatch "${WORKDIR}"/util-linux-ng-*.diff
fi
use uclibc && sed -i -e s/versionsort/alphasort/g -e s/strverscmp.h/dirent.h/g mount/lomount.c