Hi. The attached patch replaces util-linux-fPIC.patch, by adding PIC assembly to linux-libc-headers for syscalls. This fixes text relocation problems with util-linux, vsftpd, proftpd, and others.
robert
Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes) Date: 2005-02-22 Initial Package Version: 2.6.10.0 Upstream Status: Not submitted Origin: Gentoo - unistd.h-i386-pic.patch Description: This patch adds position independent assembly for syscalls. This fixes problems with llseek(), util-linux, vsftpd, proftpd, and more. Also see: http://www.linuxfromscratch.org/hlfs/ diff -Naur linux-libc-headers-2.6.10.0.orig/include/asm-i386/unistd.h linux-libc-headers-2.6.10.0/include/asm-i386/unistd.h --- linux-libc-headers-2.6.10.0.orig/include/asm-i386/unistd.h 2005-01-08 14:04:09.000000000 +0000 +++ linux-libc-headers-2.6.10.0/include/asm-i386/unistd.h 2005-02-22 10:34:01.836076592 +0000 @@ -321,6 +321,21 @@ __syscall_return(type,__res); \ } +#ifdef __PIC__ +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile (\ + "pushl %%ebx\n\t" \ + "movl %2,%%ebx\n\t" \ + "int $0x80\n\t" \ + "popl %%ebx\n\t" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1))); \ +__syscall_return(type,__res); \ +} +#else #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) \ { \ @@ -330,7 +345,23 @@ : "0" (__NR_##name),"b" ((long)(arg1))); \ __syscall_return(type,__res); \ } +#endif +#ifdef __PIC__ +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile (\ + "pushl %%ebx\n\t" \ + "movl %2,%%ebx\n\t" \ + "int $0x80\n\t" \ + "popl %%ebx\n\t" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2))); \ +__syscall_return(type,__res); \ +} +#else #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) \ { \ @@ -340,7 +371,24 @@ : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ __syscall_return(type,__res); \ } +#endif +#ifdef __PIC__ +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile (\ + "pushl %%ebx\n\t" \ + "movl %2,%%ebx\n\t" \ + "int $0x80\n\t" \ + "popl %%ebx\n\t" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ +__syscall_return(type,__res); \ +} +#else #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) \ { \ @@ -351,7 +399,24 @@ "d" ((long)(arg3))); \ __syscall_return(type,__res); \ } +#endif +#ifdef __PIC__ +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ volatile (\ + "pushl %%ebx\n\t" \ + "movl %2,%%ebx\n\t" \ + "int $0x80\n\t" \ + "popl %%ebx\n\t" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4))); \ +__syscall_return(type,__res); \ +} +#else #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ { \ @@ -362,7 +427,25 @@ "d" ((long)(arg3)),"S" ((long)(arg4))); \ __syscall_return(type,__res); \ } +#endif +#ifdef __PIC__ +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +__asm__ volatile (\ + "pushl %%ebx\n\t" \ + "movl %2,%%ebx\n\t" \ + "int $0x80\n\t" \ + "popl %%ebx\n\t" \ + : "=a" (__res) \ + : "0" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ +__syscall_return(type,__res); \ +} +#else #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ @@ -374,7 +457,30 @@ "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ __syscall_return(type,__res); \ } +#endif +#ifdef __PIC__ +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +long __res; \ +__asm__ volatile (\ + "pushl %%ebp\n\t" \ + "movl %%eax,%%ebp\n\t" \ + "movl %1,%%eax\n\t" \ + "pushl %%ebx\n\t" \ + "movl %2,%%ebx\n\t" \ + "int $0x80\n\t" \ + "popl %%ebx\n\t" \ + "popl %%ebp\n\t" \ + : "=a" (__res) \ + : "i" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ + "0" ((long)(arg6))); \ +__syscall_return(type,__res); \ +} +#else #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5,type6,arg6) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ @@ -387,6 +493,7 @@ "0" ((long)(arg6))); \ __syscall_return(type,__res); \ } +#endif #ifdef __KERNEL_SYSCALLS__
-- http://linuxfromscratch.org/mailman/listinfo/patches FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
