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"
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.
# # 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 $@ $<
added a patch to fix this properly rather than filtering -fPIC (dont use _syscall5() when defined(__PIC__))
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