From 001fbbcb59692a09577f5eee3d6f2fbabe5a6230 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 10 Jul 2007 17:08:25 +0000 Subject: parted 1.8.7: Make buildable with latest linux-headers. * Add an adhoc syscall macros include, and they are gone. * Also add a hacky patch to make sure that libparted build properly with autoconf 2.59, but it really requires 2.61. --- packages/parted/files/.mtn2git_empty | 0 packages/parted/files/cross-gross-hack.patch | 33 ++++++ packages/parted/files/syscalls.h | 166 +++++++++++++++++++++++++++ packages/parted/files/syscalls.patch | 10 ++ 4 files changed, 209 insertions(+) create mode 100644 packages/parted/files/.mtn2git_empty create mode 100644 packages/parted/files/cross-gross-hack.patch create mode 100644 packages/parted/files/syscalls.h create mode 100644 packages/parted/files/syscalls.patch (limited to 'packages/parted/files') diff --git a/packages/parted/files/.mtn2git_empty b/packages/parted/files/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/parted/files/cross-gross-hack.patch b/packages/parted/files/cross-gross-hack.patch new file mode 100644 index 0000000000..8d2db63661 --- /dev/null +++ b/packages/parted/files/cross-gross-hack.patch @@ -0,0 +1,33 @@ +diff -ur parted-1.8.7.org/configure parted-1.8.7/configure +--- parted-1.8.7.org/configure 2007-05-10 00:01:27.000000000 +0300 ++++ parted-1.8.7/configure 2007-07-10 15:46:42.000000000 +0300 +@@ -12556,7 +12556,7 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test "$cross_compiling" = yes; then +- ac_cv_func_malloc_0_nonnull=no ++ ac_cv_func_malloc_0_nonnull=yes + else + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +diff -ur parted-1.8.7.org/configure parted-1.8.7/configure +--- parted-1.8.7.org/configure 2007-07-10 15:48:07.000000000 +0300 ++++ parted-1.8.7/configure 2007-07-10 15:57:26.000000000 +0300 +@@ -12889,7 +12889,7 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test "$cross_compiling" = yes; then +- ac_cv_func_memcmp_working=no ++ ac_cv_func_memcmp_working=yes + else + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +@@ -13574,7 +13574,7 @@ + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test "$cross_compiling" = yes; then +- ac_cv_func_realloc_0_nonnull=no ++ ac_cv_func_realloc_0_nonnull=yes + else + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ diff --git a/packages/parted/files/syscalls.h b/packages/parted/files/syscalls.h new file mode 100644 index 0000000000..9278704b29 --- /dev/null +++ b/packages/parted/files/syscalls.h @@ -0,0 +1,166 @@ +/* + * linux/include/asm-arm/unistd.h + * + * Copyright (C) 2001-2005 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Please forward _all_ changes to this file to rmk@arm.linux.org.uk, + * no matter what the change is. Thanks! + */ +#ifndef __ASM_ARM_UNISTD_H2 +#define __ASM_ARM_UNISTD_H2 + + +#define __sys2(x) #x +#define __sys1(x) __sys2(x) + +#ifndef __syscall +#if defined(__thumb__) || defined(__ARM_EABI__) +#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name; +#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs +#define __syscall(name) "swi\t0" +#else +#define __SYS_REG(name) +#define __SYS_REG_LIST(regs...) regs +#define __syscall(name) "swi\t" __sys1(__NR_##name) "" +#endif +#endif + +#define __syscall_return(type, res) \ +do { \ + if ((unsigned long)(res) >= (unsigned long)(-129)) { \ + errno = -(res); \ + res = -1; \ + } \ + return (type) (res); \ +} while (0) + +#define _syscall0(type,name) \ +type name(void) { \ + __SYS_REG(name) \ + register long __res_r0 __asm__("r0"); \ + long __res; \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST() ); \ + __res = __res_r0; \ + __syscall_return(type,__res); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) { \ + __SYS_REG(name) \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __res_r0 __asm__("r0"); \ + long __res; \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0) ) ); \ + __res = __res_r0; \ + __syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) { \ + __SYS_REG(name) \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __res_r0 __asm__("r0"); \ + long __res; \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) ); \ + __res = __res_r0; \ + __syscall_return(type,__res); \ +} + + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) { \ + __SYS_REG(name) \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __res_r0 __asm__("r0"); \ + long __res; \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) ); \ + __res = __res_r0; \ + __syscall_return(type,__res); \ +} + + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ + __SYS_REG(name) \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __r3 __asm__("r3") = (long)arg4; \ + register long __res_r0 __asm__("r0"); \ + long __res; \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) ); \ + __res = __res_r0; \ + __syscall_return(type,__res); \ +} + + +#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) { \ + __SYS_REG(name) \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __r3 __asm__("r3") = (long)arg4; \ + register long __r4 __asm__("r4") = (long)arg5; \ + register long __res_r0 __asm__("r0"); \ + long __res; \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ + "r" (__r3), "r" (__r4) ) ); \ + __res = __res_r0; \ + __syscall_return(type,__res); \ +} + +#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) { \ + __SYS_REG(name) \ + register long __r0 __asm__("r0") = (long)arg1; \ + register long __r1 __asm__("r1") = (long)arg2; \ + register long __r2 __asm__("r2") = (long)arg3; \ + register long __r3 __asm__("r3") = (long)arg4; \ + register long __r4 __asm__("r4") = (long)arg5; \ + register long __r5 __asm__("r5") = (long)arg6; \ + register long __res_r0 __asm__("r0"); \ + long __res; \ + __asm__ __volatile__ ( \ + __syscall(name) \ + : "=r" (__res_r0) \ + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ + "r" (__r3), "r" (__r4), "r" (__r5) ) ); \ + __res = __res_r0; \ + __syscall_return(type,__res); \ +} + +/* + * "Conditional" syscalls + * + * What we want is __attribute__((weak,alias("sys_ni_syscall"))), + * but it doesn't work on all toolchains, so we just do it by hand + */ +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") + +#endif /* __ASM_ARM_UNISTD_H2 */ diff --git a/packages/parted/files/syscalls.patch b/packages/parted/files/syscalls.patch new file mode 100644 index 0000000000..be9b91cb9c --- /dev/null +++ b/packages/parted/files/syscalls.patch @@ -0,0 +1,10 @@ +--- parted-1.8.7/libparted/arch/linux.c.org 2007-05-09 23:40:13.000000000 +0300 ++++ parted-1.8.7/libparted/arch/linux.c 2007-07-10 18:20:27.000000000 +0300 +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include "syscalls.h" + #include + #include + #include -- cgit v1.2.3