This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Remove compatibility code for old ARM kernels
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-ports at sourceware dot org
- Date: Sat, 19 May 2012 18:02:23 +0000 (UTC)
- Subject: Remove compatibility code for old ARM kernels
Since I removed ARM old-ABI support, the minimum kernel version supported
by glibc on ARM has been 2.6.16 (the version at which EABI support was
added to the kernel). I've now applied this patch to remove compatibility
code for kernels older than that.
Most of this code would never have been compiled in. In the
posix_fadvise64 case, nothing defined __ASSUME_FADVISE64_64_SYSCALL for
ARM - but the arm_fadvise64_64 syscall is certainly present in 2.6.16 so
the compatibility code isn't needed.
To avoid any nonobvious dependencies on ARM not using libc code that uses
a particular __ASSUME_* macro, this patch does not remove any __ASSUME_*
macro definitions from kernel-features.h; I'll remove those later when
removing tests of the macros in question from libc.
diff --git a/ChangeLog.arm b/ChangeLog.arm
index b75bd86..bfb87aa 100644
--- a/ChangeLog.arm
+++ b/ChangeLog.arm
@@ -1,3 +1,31 @@
+2012-05-19 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/arm/ftruncate64.c (kernel-features.h):
+ Don't include.
+ [__NR_ftruncate64]: Make code unconditional.
+ [!__NR_ftruncate64]: Remove conditional code.
+ [!__ASSUME_TRUNCATE64_SYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/arm/mmap.S (kernel-features.h): Don't
+ include.
+ [__ASSUME_MMAP2_SYSCALL]:
+ Make code unconditional.
+ [!__ASSUME_MMAP2_SYSCALL]: Remove conditional code.
+ * sysdeps/unix/sysv/linux/arm/posix_fadvise64.c
+ (kernel-features.h): Don't include.
+ [__NR_arm_fadvise64_64]: Make code unconditional.
+ [!__ASSUME_FADVISE64_64_SYSCALL]: Remove conditional code.
+ * sysdeps/unix/sysv/linux/arm/truncate64.c (kernel-features.h):
+ Don't include.
+ [__NR_truncate64]: Make code unconditional.
+ [!__NR_truncate64]: Remove conditional code.
+ [!__ASSUME_TRUNCATE64_SYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/arm/vfork.S (kernel-features.h): Don't
+ include.
+ [__NR_vfork]: Make code unconditional.
+ [__ASSUME_VFORK_SYSCALL]: Likewise.
+ [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.
+ [!__NR_vfork]: Likewise.
+
2012-05-16 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/arm/kernel-features.h
diff --git a/sysdeps/unix/sysv/linux/arm/ftruncate64.c b/sysdeps/unix/sysv/linux/arm/ftruncate64.c
index ad5eb18..9838182 100644
--- a/sysdeps/unix/sysv/linux/arm/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/arm/ftruncate64.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2003, 2005
- Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,53 +23,14 @@
#include <sysdep.h>
#include <sys/syscall.h>
-#include "kernel-features.h"
-
-#ifdef __NR_ftruncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls. */
-extern int __have_no_truncate64;
-#endif
-
-
/* Truncate the file FD refers to to LENGTH bytes. */
int
__ftruncate64 (int fd, off64_t length)
{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! __have_no_truncate64)
-#endif
- {
- unsigned int low = length & 0xffffffff;
- unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- int saved_errno = errno;
-#endif
- int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
- __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (result != -1 || errno != ENOSYS)
-#endif
- return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- __set_errno (saved_errno);
- __have_no_truncate64 = 1;
-#endif
- }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if ((off_t) length != length)
- {
- __set_errno (EINVAL);
- return -1;
- }
- return __ftruncate (fd, (off_t) length);
-#endif
+ unsigned int low = length & 0xffffffff;
+ unsigned int high = length >> 32;
+ int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
+ __LONG_LONG_PAIR (high, low));
+ return result;
}
weak_alias (__ftruncate64, ftruncate64)
-
-#else
-/* Use the generic implementation. */
-# include <misc/ftruncate64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/mmap.S b/sysdeps/unix/sysv/linux/arm/mmap.S
index 62bf8ee..3276a3b 100644
--- a/sysdeps/unix/sysv/linux/arm/mmap.S
+++ b/sysdeps/unix/sysv/linux/arm/mmap.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,20 +16,12 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
-#include <kernel-features.h>
#define EINVAL 22
.text
ENTRY (__mmap)
-# ifdef __ASSUME_MMAP2_SYSCALL
- /* This code is actually a couple of cycles slower than the
- sys_mmap version below, so it might seem like a loss. But the
- code path inside the kernel is sufficiently much shorter to
- make it a net gain to use mmap2 when it's known to be
- available. */
-
/* shuffle args */
str r5, [sp, #-4]!
cfi_adjust_cfa_offset (4)
@@ -66,38 +58,6 @@ ENTRY (__mmap)
.Linval:
mov r0, #-EINVAL
b 2b
-# else
- /* Because we can only get five args through the syscall interface, and
- mmap() takes six, we need to build a parameter block and pass its
- address instead. The 386 port does a similar trick. */
-
- /* This code previously moved sp into ip and stored the args using
- stmdb ip!, {a1-a4}. It did not modify sp, so the stack never had
- to be restored after the syscall completed. It saved an
- instruction and meant no stack cleanup work was required.
-
- This will not work in the case of a mmap call being interrupted
- by a signal. If the signal handler uses any stack the arguments
- to mmap will be trashed. The results of a restart of mmap are
- then unpredictable. */
-
- /* store args on the stack */
- stmdb sp!, {a1-a4}
- cfi_adjust_cfa_offset (16)
-
- /* do the syscall */
- mov a1, sp
- DO_CALL (mmap, 0)
-
- /* pop args off the stack. */
- add sp, sp, #16
- cfi_adjust_cfa_offset (-16)
-
- cmn r0, $4096
- RETINSTR(cc, lr)
- b PLTJMP(syscall_error);
-#endif
-
PSEUDO_END (__mmap)
weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/arm/posix_fadvise64.c b/sysdeps/unix/sysv/linux/arm/posix_fadvise64.c
index 174c3bb..75b06ab 100644
--- a/sysdeps/unix/sysv/linux/arm/posix_fadvise64.c
+++ b/sysdeps/unix/sysv/linux/arm/posix_fadvise64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,7 +18,6 @@
#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>
-#include <kernel-features.h>
int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
@@ -29,34 +28,13 @@ int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
int
__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
{
-#ifdef __NR_arm_fadvise64_64
INTERNAL_SYSCALL_DECL (err);
int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
__LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
__LONG_LONG_PAIR ((long)(len >> 32), (long)len));
if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
return 0;
-# ifndef __ASSUME_FADVISE64_64_SYSCALL
- if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
-# endif
- return INTERNAL_SYSCALL_ERRNO (ret, err);
-#endif
-#ifndef __ASSUME_FADVISE64_64_SYSCALL
-# ifdef __NR_fadvise64
- if (len != (off_t) len)
- return EOVERFLOW;
-
- INTERNAL_SYSCALL_DECL (err2);
- int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 6, fd, 0,
- __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
- (off_t) len, advise);
- if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret2, err2);
-# else
- return ENOSYS;
-# endif
-#endif
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
}
#include <shlib-compat.h>
diff --git a/sysdeps/unix/sysv/linux/arm/truncate64.c b/sysdeps/unix/sysv/linux/arm/truncate64.c
index 409bf19..3fad93f 100644
--- a/sysdeps/unix/sysv/linux/arm/truncate64.c
+++ b/sysdeps/unix/sysv/linux/arm/truncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,51 +24,13 @@
#include <sys/syscall.h>
#include <bp-checks.h>
-#include "kernel-features.h"
-
-#ifdef __NR_truncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls. */
-int __have_no_truncate64;
-#endif
-
/* Truncate the file FD refers to to LENGTH bytes. */
int
truncate64 (const char *path, off64_t length)
{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! __have_no_truncate64)
-#endif
- {
- unsigned int low = length & 0xffffffff;
- unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- int saved_errno = errno;
-#endif
- int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
- __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (result != -1 || errno != ENOSYS)
-#endif
- return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- __set_errno (saved_errno);
- __have_no_truncate64 = 1;
-#endif
- }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if ((off_t) length != length)
- {
- __set_errno (EINVAL);
- return -1;
- }
- return __truncate (path, (off_t) length);
-#endif
+ unsigned int low = length & 0xffffffff;
+ unsigned int high = length >> 32;
+ int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
+ __LONG_LONG_PAIR (high, low));
+ return result;
}
-
-#else
-/* Use the generic implementation. */
-# include <misc/truncate64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S
index 99c366d..abd46c1 100644
--- a/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -19,7 +19,6 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#include <kernel-features.h>
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
@@ -27,8 +26,6 @@
and the process ID of the new process to the old process. */
ENTRY (__vfork)
-
-#ifdef __NR_vfork
#ifdef SAVE_PID
SAVE_PID
#endif
@@ -56,25 +53,7 @@ ENTRY (__vfork)
cmn a1, #4096
RETINSTR(cc, lr)
-# ifdef __ASSUME_VFORK_SYSCALL
b PLTJMP(SYSCALL_ERROR)
-# else
- /* Check if vfork syscall is known at all. */
- cmn a1, #ENOSYS
- bne PLTJMP(SYSCALL_ERROR)
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
- /* If we don't have vfork, fork is close enough. */
- DO_CALL (fork, 0)
- cmn a1, #4096
- RETINSTR(cc, lr)
- b PLTJMP(SYSCALL_ERROR)
-#elif !defined __NR_vfork
-# error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
-#endif
-
PSEUDO_END (__vfork)
libc_hidden_def (__vfork)
--
Joseph S. Myers
joseph@codesourcery.com