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
commitf64e847f36f2dda1b6b77af8eb9154e60879628f (patch)
treed8b53b5c378e59c631d579b003a4d34f8cc82d60 /sys-apps/util-linux/files
parentInitial commit. Required for farsight2. (diff)
downloadhistorical-f64e847f36f2dda1b6b77af8eb9154e60879628f.tar.gz
historical-f64e847f36f2dda1b6b77af8eb9154e60879628f.tar.bz2
historical-f64e847f36f2dda1b6b77af8eb9154e60879628f.zip
Fix building on hardened due to PIC/cpuid #269001 by Juergen Rose.
Package-Manager: portage-2.2_rc33/cvs/Linux x86_64
Diffstat (limited to 'sys-apps/util-linux/files')
-rw-r--r--sys-apps/util-linux/files/util-linux-2.15-cpuid-pic.patch51
1 files changed, 51 insertions, 0 deletions
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
+