patches/uClibc/0.9.30.2/190-avr32-add-varargs-handling-of-prctl-syscall.patch
author Remy Bohmer <linux@bohmer.net>
Thu May 27 23:18:19 2010 +0200 (2010-05-27)
changeset 2060 51e4597b07fc
permissions -rw-r--r--
scripts: add option to strip all toolchain executables

To reduce filesizes of the toolchain and even improve build times
of projects to be build with this toolchain it is usefull to strip
the delivered toolchain executables. Since it is not likely that we
will debug the toolchain executables itself we do not need the
debug information inside the executables itself.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
yann@1819
     1
From 85bc04d5436ca6c8a30a1ad28862260a04b8b3d5 Mon Sep 17 00:00:00 2001
yann@1819
     2
From: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
yann@1819
     3
Date: Wed, 16 Dec 2009 13:16:08 +0100
yann@1819
     4
Subject: [PATCH 02/15] avr32: add varargs handling of prctl syscall
yann@1819
     5
yann@1819
     6
prctl is defined to use varargs in the header file, hence it needs varargs
yann@1819
     7
specific handling in the source. This patch properly handles the variodic
yann@1819
     8
argument before the syscall is passed to the kernel for the AVR32 architecture.
yann@1819
     9
yann@1819
    10
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
yann@1819
    11
---
yann@1819
    12
 libc/sysdeps/linux/avr32/Makefile.arch |    2 +-
yann@1819
    13
 libc/sysdeps/linux/avr32/prctl.c       |   36 ++++++++++++++++++++++++++++++++
yann@1819
    14
 2 files changed, 37 insertions(+), 1 deletions(-)
yann@1819
    15
 create mode 100644 libc/sysdeps/linux/avr32/prctl.c
yann@1819
    16
yann@1819
    17
diff --git a/libc/sysdeps/linux/avr32/Makefile.arch b/libc/sysdeps/linux/avr32/Makefile.arch
yann@1819
    18
index bc5f625..98b85a7 100644
yann@1819
    19
--- a/libc/sysdeps/linux/avr32/Makefile.arch
yann@1819
    20
+++ b/libc/sysdeps/linux/avr32/Makefile.arch
yann@1819
    21
@@ -5,7 +5,7 @@
yann@1819
    22
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
yann@1819
    23
 #
yann@1819
    24
 
yann@1819
    25
-CSRC	:= brk.c clone.c mmap.c sigaction.c
yann@1819
    26
+CSRC	:= brk.c clone.c mmap.c prctl.c sigaction.c
yann@1819
    27
 
yann@1819
    28
 SSRC	:= __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S	\
yann@1819
    29
 		sigrestorer.S syscall.S vfork.S
yann@1819
    30
diff --git a/libc/sysdeps/linux/avr32/prctl.c b/libc/sysdeps/linux/avr32/prctl.c
yann@1819
    31
new file mode 100644
yann@1819
    32
index 0000000..4e146e3
yann@1819
    33
--- /dev/null
yann@1819
    34
+++ b/libc/sysdeps/linux/avr32/prctl.c
yann@1819
    35
@@ -0,0 +1,36 @@
yann@1819
    36
+/*
yann@1819
    37
+ * prctl syscall for AVR32 Linux.
yann@1819
    38
+ *
yann@1819
    39
+ * Copyright (C) 2010 Atmel Corporation
yann@1819
    40
+ *
yann@1819
    41
+ * This file is subject to the terms and conditions of the GNU Lesser General
yann@1819
    42
+ * Public License. See the file "COPYING.LIB" in the main directory of this
yann@1819
    43
+ * archive for more details.
yann@1819
    44
+ */
yann@1819
    45
+#include <sys/syscall.h>
yann@1819
    46
+#include <sys/prctl.h>
yann@1819
    47
+#include <stdarg.h>
yann@1819
    48
+
yann@1819
    49
+#ifdef __NR_prctl
yann@1819
    50
+#define __NR___syscall_prctl	__NR_prctl
yann@1819
    51
+static inline _syscall5(int, __syscall_prctl, int, option, long, arg2,
yann@1819
    52
+		long, arg3, long, arg4, long, arg5);
yann@1819
    53
+
yann@1819
    54
+int prctl(int __option, ...)
yann@1819
    55
+{
yann@1819
    56
+	long arg2;
yann@1819
    57
+	long arg3;
yann@1819
    58
+	long arg4;
yann@1819
    59
+	long arg5;
yann@1819
    60
+	va_list ap;
yann@1819
    61
+
yann@1819
    62
+	va_start(ap, __option);
yann@1819
    63
+	arg2 = va_arg(ap, long);
yann@1819
    64
+	arg3 = va_arg(ap, long);
yann@1819
    65
+	arg4 = va_arg(ap, long);
yann@1819
    66
+	arg5 = va_arg(ap, long);
yann@1819
    67
+	va_end(ap);
yann@1819
    68
+
yann@1819
    69
+	return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5);
yann@1819
    70
+}
yann@1819
    71
+#endif
yann@1819
    72
-- 
yann@1819
    73
1.6.6.1
yann@1819
    74