Hi,
While working on FDPIC support for ARM in uclibc-ng, I've noticed that
the write() function if defined as a strong global symbol, while the
__GI_write alias is weak.
00000034 w F .text 0000005c .hidden __GI_write
00000034 g F .text 0000005c write
my pre-processed write.i contains:
ssize_t __attribute__ ((weak)) write (int fd, const void *buf, size_t
count) { int oldtype; ssize_t result; if (__builtin_expect
(__libc_multiple_threads == 0, 1)) return __write_nocancel (fd, buf,
count); oldtype = __libc_enable_asynccancel (); result =
__write_nocancel (fd, buf, count); __libc_disable_asynccancel
(oldtype); return result; }
extern __typeof (write) __EI_write __asm__("" "write"); extern
__typeof (write) __EI_write __attribute__((alias ("" "__GI_write")));
and write.s has:
.weak __GI_write
.hidden __GI_write
.type __GI_write, %function
__GI_write:
.fnstart
[...]
.size __GI_write, .-__GI_write
.global write
.set write,__GI_write
>From the .i file, I'd expect the weak attribute to be set on write.
FWIW, I'd like write to be weak, because currently it prevents
re-defining it user code and linking statically with libc.a
I've checked that glibc and newlib have weak write.
Since this seems to depend on the threads model, my .config has:
# HAS_NO_THREADS is not set
UCLIBC_HAS_LINUXTHREADS=y
UCLIBC_HAS_THREADS_NATIVE=y
UCLIBC_HAS_THREADS=y
PTHREADS_DEBUG_SUPPORT=y
and having
# UCLIBC_HAS_LINUXTHREADS is not set
has no effect on write's weakness.
What am I missing?
Thanks,
Christophe
Does anyone know why __WIFSTOPPED macro redefined for MIPS architecture as
#if !defined(__mips__)
#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
#else
#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f && ((status)
& 0xff00))
#endif
?
The problem with this definition is in that newer gdb versions (>= 7.0)
expect that WIFSTOPPED(W_STOPCODE(0)) is true (see [1]), otherwise a
debugger erroneously blocks a child process in a trace status until gdb
exit.
In the glibc [2] this macro expansion is the same for all architectures.
Is this a gdb or uClibc-ng bug?
1. https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;
a=blob;f=gdb/linux-nat.c;h=445b59fa4adadbb2890a9e2debffb5
330f1e09e4;hb=HEAD#l497
2. https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blob;
f=bits/waitstatus.h;h=a1c232612cd13e758f222ade6b27bc2c85ab8f8f;hb=HEAD#l44
These assembler functions seem to be unused/referenced, so we can remove
them completely.
Signed-off-by: Florian La Roche <Florian.LaRoche(a)googlemail.com>
---
ldso/ldso/arm/thumb_atomics.S | 78 -----------------------------------
1 file changed, 78 deletions(-)
delete mode 100644 ldso/ldso/arm/thumb_atomics.S
diff --git a/ldso/ldso/arm/thumb_atomics.S b/ldso/ldso/arm/thumb_atomics.S
deleted file mode 100644
index f88da2b9c..000000000
--- a/ldso/ldso/arm/thumb_atomics.S
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 2006 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
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <features.h>
-
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-
-#include <sysdep.h>
-
-#if defined __thumb__
-
-/* Out-of-line atomic operations that we can't do in Thumb mode.
- This ends up in various libraries where it is needed (and
- a few .a archives where it isn't). */
-
- .hidden __thumb_swpb
-ENTRY (__thumb_swpb)
- swpb r0, r0, [r1]
- bx lr
-END (__thumb_swpb)
-
- .hidden __thumb_swp
-ENTRY (__thumb_swp)
- swp r0, r0, [r1]
- bx lr
-END (__thumb_swp)
-
- .hidden __thumb_cmpxchg
-ENTRY (__thumb_cmpxchg)
- stmdb sp!, {r4, lr}
- mov r4, r0
-0: ldr r3, [r2]
- cmp r3, r4
- bne 1f
- mov r0, r4
- mov r3, #0xffff0fff
- mov lr, pc
- add pc, r3, #(0xffff0fc0 - 0xffff0fff)
- bcc 0b
- mov r3, r4
-1: mov r0, r3
- ldmia sp!, {r4, pc}
-END (__thumb_cmpxchg)
-
-#endif /* __thumb__ */
-#endif /* __UCLIBC_HAS_THREADS_NATIVE__ */
-
--
2.17.0
As preadv and pwritev accept off_t type the prototypes should be declared
as follows
extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
off_t __offset) __wur;
extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
off_t __offset) __wur;
to take into account _FILE_OFFSET_BITS=64 define.
I am not sure but probably it is better to redeclare these prototypes
by analogy with sendfile using __REDIRECT_NTH.