Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 34712 - raidtools-1.00.3-r1 fails to compile with hcc, gives BREG
Summary: raidtools-1.00.3-r1 fails to compile with hcc, gives BREG
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-29 10:18 UTC by Scott Taylor (RETIRED)
Modified: 2005-02-13 06:58 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Taylor (RETIRED) gentoo-dev 2003-11-29 10:18:50 UTC
raid_io.c: In function `_llseek':
raid_io.c:96: error: can't find a register in class `BREG' while reloading `asm'make: *** [raid_io.o] Error 1

adding -yet_exec lets it compile

Suggest adding the next line to its ebuild?
        has_version "sys-devel/hardened-gcc" && append-flags "-yet_exec"
Comment 1 solar (RETIRED) gentoo-dev 2003-11-29 17:16:06 UTC
No the suggestion is to add. 

inherit flag-o-matic
filter-flags -fPIC

The eclass will set the proper flags -yet_exec flags to your 
CFLAGS/LDFLAGS as well as fix this for other users who attempt to
compile pic code such as users of prelink and amd64.

fixed in cvs.. 
resync and remerge.
Comment 2 solar (RETIRED) gentoo-dev 2005-02-03 08:44:08 UTC
#
# raidtools-1.00 uses _llseek via syscall5() which is not x86-pic 
# compatible We can compile all of raidtools with -fno-pie and every 
# binary will be an ET_EXEC file, or we can -fno-pie the single 
# problematic file raid_io.c and then everything will be built as an 
# ET_DYN file but will contain text relocations.
#
# On hardened glibc systems it may be desirable to have a ET_DYN over 
# ET_EXEC files even if they have text relocations.
#
# On hardened uclibc systems we just disallow text relocations, and this 
# patch wont work.
#
# Either way the check can be downgraded from filter-flags -fPIC to 
# -fPIE for raidtools.
#
# What's needed is good way to work around syscall5() eatting up the ebx 
# register on x86. ideas? options that don't depend on kernel/header
# changes?
#
# The prototype looks like this in raid_io.c
#  static int _llseek (unsigned int, unsigned long,
#                  unsigned long, long long *, unsigned int);
#
#  static _syscall5( int, _llseek, unsigned int, fd, unsigned long, offset_high,
#                 unsigned long, offset_low, long long *, result,
#                 unsigned int, origin)
#
--- Makefile.in.orig	2005-02-03 10:14:15.000000000 -0500
+++ Makefile.in	2005-02-03 10:15:50.000000000 -0500
@@ -63,6 +63,9 @@
 install: dummy
 	for N in all install_bin install_doc install_dev; do make $$N; done
 
+raid_io.o: raid_io.c $(HEADERS) Makefile
+	$(CC) $(CFLAGS) -fno-pie -c -o $@ $<
+
 %.o: %.c $(HEADERS) Makefile
 	$(CC) $(CFLAGS) -c -o $@ $<
 
Comment 3 SpanKY gentoo-dev 2005-02-11 18:06:19 UTC
added a patch to fix this properly rather than filtering -fPIC (dont use _syscall5() when defined(__PIC__))
Comment 4 solar (RETIRED) gentoo-dev 2005-02-13 06:58:01 UTC
solution from comment #1 is no longer needed on arch x86 and should not be 
used on hardened bugs that use syscall() macros. 
Fixed by linux-headers-2.4.22-r1 and linux-headers-2.6.10