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