OSDN Git Service

uclinux-h8/uclibc-ng.git
13 years agolgamma: fix sign handling
Bernhard Reutner-Fischer [Thu, 10 Jun 2010 20:20:17 +0000 (22:20 +0200)]
lgamma: fix sign handling

add testcase from
http://sourceware.org/bugzilla/show_bug.cgi?id=4407

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
13 years agolibm: unhide signgam
Roman I Khimov [Thu, 10 Jun 2010 20:17:04 +0000 (22:17 +0200)]
libm: unhide signgam

Fixes signgam checks in math tests on x86_64. It's R_X86_64_COPY for program,
so the program didn't see any changes from libm.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
13 years agodo not generate garbled interp
Bernhard Reutner-Fischer [Tue, 8 Jun 2010 21:21:09 +0000 (23:21 +0200)]
do not generate garbled interp

for parallel make

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
13 years agonptl: fix for !ipv4 && !ipv6
Bernhard Reutner-Fischer [Tue, 8 Jun 2010 21:05:48 +0000 (23:05 +0200)]
nptl: fix for !ipv4 && !ipv6

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
13 years agomips/socket.h: add SOCK_CLOEXEC and SOCK_NONBLOCK definitions for mips
Khem Raj [Mon, 7 Jun 2010 19:46:01 +0000 (12:46 -0700)]
mips/socket.h: add SOCK_CLOEXEC and SOCK_NONBLOCK definitions for mips

* __ss_aligntype is defined to unsigned long int

Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 years agostrverscmp: I forgot to export it
Denys Vlasenko [Fri, 4 Jun 2010 11:36:30 +0000 (13:36 +0200)]
strverscmp: I forgot to export it

Result was:

strverscmp.o:
000000ec T __GI_strverscmp

i.e. no plain "strverscmp"!

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
13 years agoldso/mips: Fix relocation parsing so that they work on both mips32/mips64
Khem Raj [Wed, 2 Jun 2010 17:17:40 +0000 (10:17 -0700)]
ldso/mips: Fix relocation parsing so that they work on both mips32/mips64

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Rob Landley <rob@landley.net>
13 years agoinotify: add inotify_init1 system call support
Vladimir Zapolskiy [Tue, 1 Jun 2010 16:02:54 +0000 (20:02 +0400)]
inotify: add inotify_init1 system call support

This patch introduces support for inotify_init1 system call, found
since Linux 2.6.27.

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 years agobits/socket.h: add SOCK_CLOEXEC and SOCK_NONBLOCK support
Vladimir Zapolskiy [Tue, 1 Jun 2010 16:02:39 +0000 (20:02 +0400)]
bits/socket.h: add SOCK_CLOEXEC and SOCK_NONBLOCK support

This patch adds support for SOCK_CLOEXEC and SOCK_NONBLOCK socket
descriptor flags, which are introduced since Linux 2.6.27

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 years agoutils: Fix ldd segfault
Natanael Copa [Mon, 24 May 2010 07:07:45 +0000 (09:07 +0200)]
utils: Fix ldd segfault

Fixes ldd segfault on this testcase:

extern void _dl_getenv(void);
void foo(void)
{
    printf("foo: %x\n", &_dl_getenv);
}

linked as -shared

It fixes bug #1507

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agomips: Add vfork to libc
Khem Raj [Wed, 19 May 2010 22:59:50 +0000 (15:59 -0700)]
mips: Add vfork to libc

* When using NPTL get clone.o from nptl.
* Only use vfork if syscall is there.
* Add libc_a_SSRC to LINUX_LIBC_ARCH_OBJ.
* Use CLEAN_* for clean target.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 years agomips/bits/pthreadtypes.h: Re-include sgidefs.h
Khem Raj [Wed, 19 May 2010 22:32:30 +0000 (15:32 -0700)]
mips/bits/pthreadtypes.h: Re-include sgidefs.h

* This was dropped accidently in last merge
  removal meant a lot of warnings about undefined
  _ABI64.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 years agostatic build: define pthreads wrappers only for threaded builds
Timo Teräs [Mon, 17 May 2010 08:01:49 +0000 (11:01 +0300)]
static build: define pthreads wrappers only for threaded builds

Otherwise we get compiler errors due to undefined prototypes
as noticed by Denys.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agosome (all?) archs don't define asm, so use builtin __asm__
Austin Foxley [Mon, 17 May 2010 14:15:24 +0000 (07:15 -0700)]
some (all?) archs don't define asm, so use builtin __asm__

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoFix fcntl64 for 64 bit targets.
Rob Landley [Sun, 16 May 2010 21:41:36 +0000 (16:41 -0500)]
Fix fcntl64 for 64 bit targets.

64 bit targets often don't have a separate fcntl64() system call, because they don't need one.

Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoworkaround GCC PR32219
Denys Vlasenko [Mon, 17 May 2010 13:56:19 +0000 (15:56 +0200)]
workaround GCC PR32219

we ended up calling 0
Fixes bug #1033

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoresolv.h: fix wring indentation of #ifdef/#endif pairs
Denys Vlasenko [Sun, 16 May 2010 04:39:16 +0000 (06:39 +0200)]
resolv.h: fix wring indentation of #ifdef/#endif pairs

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
14 years agoutils/Makefile.in: Define GETCONF_DIR for host builds of getconf.
Khem Raj [Tue, 11 May 2010 21:07:04 +0000 (14:07 -0700)]
utils/Makefile.in: Define GETCONF_DIR for host builds of getconf.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 years agopowerpc/Makefile.arch: Add objclean and headers_clean targets for NPTL.
Khem Raj [Mon, 10 May 2010 06:00:39 +0000 (23:00 -0700)]
powerpc/Makefile.arch: Add objclean and headers_clean targets for NPTL.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 years agopowerpc: Add TLS and NPTL support
Khem Raj [Thu, 6 May 2010 05:50:19 +0000 (22:50 -0700)]
powerpc: Add TLS and NPTL support

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agomips/Makefile.arch: Remove -f option to $(do_awk)
Khem Raj [Fri, 7 May 2010 19:39:08 +0000 (12:39 -0700)]
mips/Makefile.arch: Remove -f option to $(do_awk)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 years agoresolv: various memory corruption and off by one fixes
Timo Teras [Fri, 7 May 2010 14:19:20 +0000 (17:19 +0300)]
resolv: various memory corruption and off by one fixes

Fixes resolution of names with AAAA entries and gethostbyaddr issues.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agostatic build: fix internal locking weaks to get pulled in always
Timo Teras [Fri, 7 May 2010 14:19:19 +0000 (17:19 +0300)]
static build: fix internal locking weaks to get pulled in always

Linker is smart and does not pull in weaks.os, ever. This happens
because that compilation unit does not get strong references and
ld eliminates dead code. We really need the weaks for static build
in a compilation unit that is always there, otherwise it won't work.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Acked-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoldso: fix x86_64 R_X86_64_TPOFF64 and R_X86_64_DTPOFF64 relocations
Roman I Khimov [Tue, 4 May 2010 10:00:47 +0000 (14:00 +0400)]
ldso: fix x86_64 R_X86_64_TPOFF64 and R_X86_64_DTPOFF64 relocations

R_X86_64_TPOFF64 revealed by trivial testcase:
===================================================================
 #include <stdio.h>
 #include <errno.h>

int main() {
        void *a = &errno;

        printf("errno addr: %llx\n", a);
        __asm__("movq    errno@gottpoff(%%rip), %0;\n"
                "add    %%fs:0x0,%0;" : "=r"(a) );
        printf("got errno addr: %llx\n", a);

        return 0;
}
===================================================================

The addresses application got with R_X86_64_TPOFF64 was different than the once libc
internal __errno_location returned.

R_X86_64_DTPOFF64 testcase is even simpler than that:
===================================================================
 #include <stdio.h>
 #include <errno.h>
 #include <netdb.h>
 #undef h_errno

extern __thread int h_errno;

int main() {
        printf("h_errno addr: %llx\n", &h_errno);
        printf("__h_errno_location addr: %llx\n", __h_errno_location());
        return 0;
}
===================================================================

but needs to be linked with "-lpthread". This way we've got h_errno relocation via
R_X86_64_TPOFF64 in application and h_errno relocation via R_X86_64_DTPOFF64 in
libpthread which has its own __h_errno_location() (probably we can kill it later?).
And addresses were different again.

The problem is that both relocations resolve symbols in external modules and thus
should use symbol_addr instead of sym->st_value.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoFix gen_wc8bit support for finding a UTF8 locale on host.
Andy Gibbs [Wed, 5 May 2010 06:49:18 +0000 (08:49 +0200)]
Fix gen_wc8bit support for finding a UTF8 locale on host.

gen_wc8bit was previously patched to support UTF8 locales other than the
default en_US.UTF-8 by patch id 0e14b8f425c562749d3821a42414b1ce6b3b0923.

This was incomplete in its implementation and still failed where item(s)
in the list returned by 'locale -a' already had 'UTF8' appended to the
name. This patch rectifies this situation, plus adds an extra fix to
avoid trimming '\n' from an empty line which could cause a segfault.

Signed-off-by: Andy Gibbs <andyg1001@hotmail.co.uk>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agonptl: use arch-specific pthread_cond_timedwait and pthread_cond_wait on x86_64
Roman I Khimov [Fri, 30 Apr 2010 14:18:32 +0000 (18:18 +0400)]
nptl: use arch-specific pthread_cond_timedwait and pthread_cond_wait on x86_64

Generic ones were broken on x86_64, pthread/ex2 test failed while pthread/ex5
worked fine. So use arch-specific functions and fix linkage failure with
__pthread_mutex_cond_lock_adjust.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: use arch-specific cancellation routines for x86_64
Roman I Khimov [Fri, 30 Apr 2010 14:18:31 +0000 (18:18 +0400)]
nptl: use arch-specific cancellation routines for x86_64

They were present in sources, but not compiled in. Generic routines are
broken badly on x86_64, even basic threading test like pthread/ex1 didn't
work with them.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: fix sem_open with O_CREAT
Roman I Khimov [Sun, 2 May 2010 19:45:27 +0000 (23:45 +0400)]
nptl: fix sem_open with O_CREAT

Temporary file name template passed to __gen_tempname had no "XXXXXX" in it,
so __gen_tempname returned EINVAL which led to sem_open failure.

Fixes NPTL tests tst-sem4, tst-sem7, tst-sem8, tst-sem9.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agotime.c: fix unreadable code style: assignments within if(), misplaced comments
Denys Vlasenko [Thu, 29 Apr 2010 15:22:45 +0000 (17:22 +0200)]
time.c: fix unreadable code style: assignments within if(), misplaced comments

No logic changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
14 years agooptional /etc/localtime support
Denys Vlasenko [Thu, 29 Apr 2010 15:17:18 +0000 (17:17 +0200)]
optional /etc/localtime support

This patch teaches uclibc to use /etc/localtime.
This is possible since recent TZif2 file format contains
TZ-like ASCII string at the end.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
14 years agoinclude dlfcn.h in ldso.h to get RTLD_NODELETE definition
Austin Foxley [Wed, 28 Apr 2010 18:34:32 +0000 (11:34 -0700)]
include dlfcn.h in ldso.h to get RTLD_NODELETE definition

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agofix a few build errors for the no threads case
Austin Foxley [Wed, 28 Apr 2010 17:35:55 +0000 (10:35 -0700)]
fix a few build errors for the no threads case

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoFix typo (OPTIMIZATIONS -> OPTIMIZATION)
Tony Wu [Wed, 28 Apr 2010 09:56:03 +0000 (17:56 +0800)]
Fix typo (OPTIMIZATIONS -> OPTIMIZATION)

Signed-off-by: Tony Wu <tung7970@gmail.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoMIPS: restore INLINE_SYSCALL macro
Gabor Juhos [Tue, 6 Apr 2010 15:56:11 +0000 (17:56 +0200)]
MIPS: restore INLINE_SYSCALL macro

The MIPS specific INLINE_SYSCALL macro has been renamed to
INLINE_SYSCALL_NCS with:

  763bbf9e9a27426c9be8322dca5ddf2cb4dbc464

  syscall: unify part 2: NCS variety

  Declare common NCS (non-constant syscall) variants and convert the
  existing ports over to this.

This change breaks system calls. The code generated with using of the
new macro does not obey the restartable syscall convention used by the
linux kernel. When it tries to restart the syscall the errno value is
not being replaced by the syscall number.

This causes weird behaviour of the 'ping' command in busybox for
example:

root@OpenWrt:/# ping 192.168.1.254
PING 192.168.1.254 (192.168.1.254): 56 data bytes
64 bytes from 192.168.1.254: seq=0 ttl=128 time=6.292 ms
ping: recvfrom: Function not implemented
64 bytes from 192.168.1.254: seq=1 ttl=128 time=0.719 ms
ping: recvfrom: Function not implemented
64 bytes from 192.168.1.254: seq=2 ttl=128 time=0.489 ms
ping: recvfrom: Function not implemented
64 bytes from 192.168.1.254: seq=3 ttl=128 time=0.486 ms
ping: recvfrom: Function not implemented
64 bytes from 192.168.1.254: seq=4 ttl=128 time=0.487 ms
ping: recvfrom: Function not implemented
64 bytes from 192.168.1.254: seq=5 ttl=128 time=0.939 ms
ping: recvfrom: Function not implemented
64 bytes from 192.168.1.254: seq=6 ttl=128 time=0.971 ms
ping: recvfrom: Function not implemented
64 bytes from 192.168.1.254: seq=7 ttl=128 time=0.488 ms
ping: recvfrom: Funct^C

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: mips needs updated clone() implementation
Andreas Schultz [Tue, 27 Apr 2010 15:43:43 +0000 (08:43 -0700)]
nptl: mips needs updated clone() implementation

Signed-off-by: Andreas Schultz <andreas.schultz@gmail.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agolibc/x86_64: use ELF-compatible definitions for assembler
Roman I Khimov [Tue, 27 Apr 2010 11:19:15 +0000 (15:19 +0400)]
libc/x86_64: use ELF-compatible definitions for assembler

Fixes open/read/write/close breakage with NPTL on x86_64 (due to missing
'.type' declaration).

Done this way because there are already ELF-style definitions in assemebler
code for x86_64 and looks like HAVE_ELF is not defined and used this days.
Or the other way around, it'd be a bit strange for x86_64 not to have ELF.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agolibc/regex: fix internal_function declarations
Roman I Khimov [Tue, 27 Apr 2010 11:22:07 +0000 (15:22 +0400)]
libc/regex: fix internal_function declarations

Build failed with

| In file included from libc/misc/regex/regex.c:59:
| libc/misc/regex/regexec.c:315: error: conflicting types for 're_search_2_stub'
| libc/misc/regex/regexec.c:44: note: previous declaration of 're_search_2_stub' was here
| libc/misc/regex/regexec.c:358: error: conflicting types for 're_search_stub'
| libc/misc/regex/regexec.c:49: note: previous declaration of 're_search_stub' was here
.... etc

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agolibpthread/x86_64: fix clean
Roman I Khimov [Tue, 27 Apr 2010 14:04:24 +0000 (18:04 +0400)]
libpthread/x86_64: fix clean

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoenable building __fcntl_nocancel, as it used unconditionally now
Austin Foxley [Mon, 26 Apr 2010 05:06:36 +0000 (22:06 -0700)]
enable building __fcntl_nocancel, as it used unconditionally now

also sync up not-cancel.h headers between all three thread libraries

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoMakefile.in: install sgtty.h
Roman I Khimov [Sun, 25 Apr 2010 18:55:11 +0000 (22:55 +0400)]
Makefile.in: install sgtty.h

Proper and useful header, for example used by pacemaker.

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: Harmonize objects and headers makefile clean targets
Carmelo Amoroso [Sun, 25 Apr 2010 18:38:19 +0000 (20:38 +0200)]
nptl: Harmonize objects and headers makefile clean targets

Update all the nptl clean targets (both objects and headers) to
use the new syntax using CLEAN_<full_path> and HEADER_<full_path>.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agobuild: Fix infinite loop when no threading support is enabled
Carmelo Amoroso [Sun, 25 Apr 2010 14:15:26 +0000 (16:15 +0200)]
build: Fix infinite loop when no threading support is enabled

The build loops forever due to when invoking make $(pregen-headers-y)
and $(pregen-headers-y) is empty (no thread support).
Parallel build should continue to work as well.
It fixes Bugzilla #1633.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agolibpthread/nptl_db: define NOT_IN_libc
Roman I Khimov [Sun, 25 Apr 2010 11:04:59 +0000 (15:04 +0400)]
libpthread/nptl_db: define NOT_IN_libc

NPTL build for x86_64 failed with

  LD libthread_db-0.9.32-git.so
  .../ld: libpthread/nptl_db/libthread_db_so.a(td_ta_event_getmsg.oS): relocation R_X86_64_PC32 against undefined symbol `__GI_memset' can not be used when making a shared object; recompile with -fPIC

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl_db: Remove compiler warning due to old-style function definition
Carmelo Amoroso [Sun, 25 Apr 2010 08:37:01 +0000 (10:37 +0200)]
nptl_db: Remove compiler warning due to old-style function definition

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agonptl: Remove compiler warning due to old-style function definition
Carmelo Amoroso [Sun, 25 Apr 2010 08:36:37 +0000 (10:36 +0200)]
nptl: Remove compiler warning due to old-style function definition

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agolibc: Remove compiler warning due to old-style function definition
Carmelo Amoroso [Sun, 25 Apr 2010 08:14:48 +0000 (10:14 +0200)]
libc: Remove compiler warning due to old-style function definition

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agochange ABI_VERSION back to just include the major number
Austin Foxley [Fri, 23 Apr 2010 14:27:50 +0000 (07:27 -0700)]
change ABI_VERSION back to just include the major number

By default, GCC hard codes the name for ld.so to /lib/ld-uClibc.so.0
so our default should match that. If distribution makers want to change
it, they need to change the default gcc configuration as well.

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoMerge commit 'origin/master' into nptl
Austin Foxley [Fri, 23 Apr 2010 13:55:42 +0000 (06:55 -0700)]
Merge commit 'origin/master' into nptl

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoutils: fix install prefix for getconf
Natanael Copa [Thu, 22 Apr 2010 14:52:48 +0000 (14:52 +0000)]
utils: fix install prefix for getconf

So we don't get /usr/usr/bin/getconf when DEVEL_PREFIX="/usr"

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agonptl: fix dynamic initialization of libpthread
Timo Teräs [Thu, 22 Apr 2010 05:53:43 +0000 (05:53 +0000)]
nptl: fix dynamic initialization of libpthread

If libpthread get's pulled in via dlopen(), we need to do libpthread
initialization in dlopen(). Achieve this by making initializer function
out of __pthread_initialize_minimal_internal. Add the proper linker
flags and make it callable multiple times.

Add also nodelete flag which ensures that libpthread will not get
unmapped after it's been loading. Though, ld.so does not yet
support this.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: fix libc internal, dynamically enabled locking
Timo Teräs [Thu, 22 Apr 2010 11:06:41 +0000 (11:06 +0000)]
nptl: fix libc internal, dynamically enabled locking

Final iteration to fix libc internal locking if libpthread is pulled
in by dlopen call (directly or indirectly).

We cannot really use the weak symbol trick for shared build, since
the symbols won't get refreshed if libpthread is pulled in dynamically.
In glibc, they have #ifdef SHARED magic to either use pthread_functions
table, or weaks. But as we shared object files with both builds, this
does not sounds good either.

The reintroduces the libc weaks.c, but uses them now only with static
build. For dynamic build, we still use the symbols with same name, but
provide weaks in forward.c so they end up dereferencing the
pthread_functions table indirectly if we are not linked to libpthread.
Mutex initialization is hard coded as inline, as it needs to happen even
if libpthread is not initially loaded.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoldso: support RTLD_NODELETE and DF_1_NODELETE
Timo Teräs [Thu, 22 Apr 2010 08:28:10 +0000 (08:28 +0000)]
ldso: support RTLD_NODELETE and DF_1_NODELETE

Honor the nodelete flags so we don't delete shared library if it's
sticky. This is useful for libpthread if it gets pulled in by a
dlopen'ed library.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: fix warnings of shadowing __self
Timo Teräs [Thu, 22 Apr 2010 05:43:00 +0000 (05:43 +0000)]
nptl: fix warnings of shadowing __self

Stdio locking macroes do:
  void *__self = THREAD_SELF;

But THREAD_SELF uses __self also internally which causes shadowing
warnings. Just rename the outer variable for now. Might be an idea
to convert the macroes to static inline functions.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: fix malloc library locking
Timo Teräs [Thu, 22 Apr 2010 05:41:17 +0000 (05:41 +0000)]
nptl: fix malloc library locking

Update malloc library to use internal uclibc locking primitives
to get the libpthread calls correct.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: proper soname handling
Natanael Copa [Tue, 20 Apr 2010 14:49:30 +0000 (14:49 +0000)]
nptl: proper soname handling

Since sublevel releases are not ABI compatible we need to adjust
the soname to include the sublevel version.

This makes it possible to install ABI incompatible versions of the
library side by side so clean upgrades are possible.

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: remove unneeded libc-lock.h include
Timo Teräs [Tue, 20 Apr 2010 08:59:42 +0000 (11:59 +0300)]
nptl: remove unneeded libc-lock.h include

I semi-accidentally added include for libc-lock.h because the intention
was to use locking macroes from there. However, we ended up using using
the weak alias stuff. This is additionally good since now this can result
in compile errors like:

In file included from /toolchain/include/bits/uClibc_mutex.h:16,
                 from /toolchain/include/bits/uClibc_stdio.h:107,
                 from /toolchain/include/stdio.h:72,
                 from /work/freetype-2.3.11/include/freetype/config/ftstdlib.h:100,
                 from ./builds/unix/ftconfig.h:43,
                 from builds/unix/ftsystem.c:21:
/toolchain/include/bits/libc-lock.h:309: error: expected '=', ',',
';', 'asm' or '__attribute__' before 'void'

Remove the unneeded include causing breakage.

Reported-by: Kevin Day <thekevinday@gmail.com>
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: mark forwarded functions protected
Timo Teras [Fri, 16 Apr 2010 13:56:00 +0000 (16:56 +0300)]
nptl: mark forwarded functions protected

The libc stubs should never override the libpthread provided
functions inside libpthread, otherwise the struct pthread_functions
that is used by the forwarder stubs goes bad.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agolibc: remove libc weak __pthreads_* wrappers
Timo Teras [Fri, 16 Apr 2010 13:29:46 +0000 (16:29 +0300)]
libc: remove libc weak __pthreads_* wrappers

It is not possible to override for libpthread to override
the weak libc definitions. This has never worked in uclibc, and
does no longer work in glibc either (unless you use LD_DYNAMIC_WEAK).

The proper thing to do is have weak prototypes in libc, and
definitions in libpthread only. This way libc runs even if
those functions are not defined, but just needs to protect
against the NULL values (done by implementing __uclibc_maybe_call).

This fix the problems if libc is linked before libpthread or
if libpthread is pulled by a dependency library.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agolibc-symbols: add attribute_protected
Timo Teras [Fri, 16 Apr 2010 12:43:15 +0000 (15:43 +0300)]
libc-symbols: add attribute_protected

Definition to use protected visibility.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoldso/i386: support protected symbols
Joakim Tjernlund [Fri, 16 Apr 2010 12:37:40 +0000 (15:37 +0300)]
ldso/i386: support protected symbols

Make sure protected symbols are not overridden by other modules.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoRevert "nptl: mark symbols with libc forwarder hidden"
Timo Teras [Fri, 16 Apr 2010 12:34:26 +0000 (15:34 +0300)]
Revert "nptl: mark symbols with libc forwarder hidden"

This reverts most of commit 1610762362e651f86ca284ac59a1d7ec88034e4e.

Marking the symbols hidden is wrong, because libc accesses
the pthreads internal symbols for internal locking.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: fix libc sigtimedwait
Timo Teräs [Thu, 15 Apr 2010 14:52:54 +0000 (17:52 +0300)]
nptl: fix libc sigtimedwait

It seems that 57e8823548ad6e65d33b2153edeb18fb0edc20e6 removed completely
sigtimedwait symbol from libc which is wrong. I hope there is not too
many other things like this.

Apparently the libc_hidden_* macros actually make previously hidden
symbols visible globally (creates alias from __GI_* to *). This is
probably ancient confusion from times when gcc did not support
visibility attribute and hiding symbols was done using hacks like
this.

This also adds attribute_hidden to the internal __sigtimedwait for
nptl case.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: fix libc sigaction signal checking
Timo Teräs [Thu, 15 Apr 2010 13:54:49 +0000 (16:54 +0300)]
nptl: fix libc sigaction signal checking

We should not check for SIGCANCEL in __libc_sigaction because nptl calls this
function to setup this signal. Nptl provides it's own override for sigaction
that checks that the user cannot override signals nptl uses internally.
Linuxthreads does not use SIGCANCEL at all so this affects nptl only.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoPTR_DEMANGLE: add documentation
Bernhard Reutner-Fischer [Thu, 15 Apr 2010 09:13:16 +0000 (11:13 +0200)]
PTR_DEMANGLE: add documentation

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoMerge commit 'origin/master' into nptl
Austin Foxley [Wed, 14 Apr 2010 18:08:37 +0000 (11:08 -0700)]
Merge commit 'origin/master' into nptl

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: turn pointer demangling off
Timo Teräs [Tue, 13 Apr 2010 17:27:57 +0000 (20:27 +0300)]
nptl: turn pointer demangling off

Currently the stub calls would
demangle the pointer that is never mangled. Alternatively, we could sync
nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c with new glibc version
that properly mangles the pointers, but that would need more validation
to make sure that all struct pthread_function readers do demangling.
uclibc currently does not do pointer mangling everywhere so it's more
consistent to just disable it here too.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agolinuxthreads.new: initialize stdio locking
Timo Teräs [Tue, 13 Apr 2010 06:38:59 +0000 (09:38 +0300)]
linuxthreads.new: initialize stdio locking

uClibc requires the threading library to enable locking for
stdio, or the locking is not done at all.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: initialize stdio locking
Timo Teräs [Tue, 13 Apr 2010 05:53:58 +0000 (08:53 +0300)]
nptl: initialize stdio locking

uClibc requires the threading library to enable locking for
stdio, or the locking is not done at all.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl: mark symbols with libc forwarder hidden
Timo Teräs [Wed, 14 Apr 2010 17:01:33 +0000 (20:01 +0300)]
nptl: mark symbols with libc forwarder hidden

Add attribute_hidden to all symbols having libc forwarder. This prevents
recursive self calls which would happen if libc is before libpthread in
linking order: the forwarder functions would call itself via the function
table, since the libpthread symbols would get overwritten with libc ones.
This has not been a problem in glibc since there these symbols are marked
hidden with linker version-script. Since we don't use one, we need to mark
these explicitly.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years ago*.o[sS]: depend on pregen
Bernhard Reutner-Fischer [Wed, 14 Apr 2010 13:09:43 +0000 (15:09 +0200)]
*.o[sS]: depend on pregen

allows 'make realclean && make utils' to behave properly

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoldso: Add config option for controlling LD_PRELOAD
Carmelo AMOROSO [Wed, 14 Apr 2010 05:24:46 +0000 (07:24 +0200)]
ldso: Add config option for controlling LD_PRELOAD

On hardened system it could be useful to disable the use
of LD_PRELOAD environment variable for preloading shared objects
before the system libraries. So this patch add a config option,
LDSO_PRELOAD_ENV_SUPPORT, to control this behaviour.
It is enabled by default.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agotest: add API test
Bernhard Reutner-Fischer [Tue, 13 Apr 2010 14:14:14 +0000 (16:14 +0200)]
test: add API test

part1; Needs improvement:
Think about a sensible way to map feature sets to the mandated syms.
Our LEGACY stuff maps to OB, OBXSI for example.
A "normal" config should satisfy the BASE (i.e. $foo.SUSv4.syms)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoprovide prototype for internal helper
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 14:39:38 +0000 (16:39 +0200)]
provide prototype for internal helper

i386 was missing a prototype for __tls_get_addr()

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agotemporarily turn on warnings for NPTL
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 14:38:37 +0000 (16:38 +0200)]
temporarily turn on warnings for NPTL

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agosilence debug warning
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 13:47:16 +0000 (15:47 +0200)]
silence debug warning

variable 'tmp' set but not used

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agowhitespace cleanup
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 13:39:42 +0000 (15:39 +0200)]
whitespace cleanup

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoMerge remote branch 'origin/master' into nptl
Austin Foxley [Mon, 12 Apr 2010 13:18:10 +0000 (06:18 -0700)]
Merge remote branch 'origin/master' into nptl

Conflicts:
libc/unistd/confstr.c

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agonptl/sysdeps/unix/sysv/linux/i386: cleanup -DUSE___THREAD
Natanael Copa [Mon, 12 Apr 2010 12:45:50 +0000 (12:45 +0000)]
nptl/sysdeps/unix/sysv/linux/i386: cleanup -DUSE___THREAD

Remove the -DUSE___THREAD from specific assembler files since its
used everywhere anyway.

This is a cleanup after 447a9d1cc181395c3e2ea77ea88e45dee4b30ce6

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoattribute_optimize: fix typo with args
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 13:09:25 +0000 (15:09 +0200)]
attribute_optimize: fix typo with args

curious how 308f5c6e5fd56ea3d1a5512e34388aad788f1180 ever worked.. :P

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agopthread_mutex_timedlock: always build with optimizations
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 13:04:23 +0000 (15:04 +0200)]
pthread_mutex_timedlock: always build with optimizations

avoids breakage with DODEBUG and lll_timedlock() constraints

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agonptl/sysdeps/unix/sysv/linux/i386: enable USE___THREAD for assembler
Timo Teräs [Mon, 12 Apr 2010 12:19:41 +0000 (12:19 +0000)]
nptl/sysdeps/unix/sysv/linux/i386: enable USE___THREAD for assembler

NPTL defines errno as __thread variable. Define USE___THREAD so proper
errno assignment is used in assembly files.

This fixes segfault while building python.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agouse user-provided host binaries
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 10:43:45 +0000 (12:43 +0200)]
use user-provided host binaries

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoprettify make clean
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 08:11:53 +0000 (10:11 +0200)]
prettify make clean

forgot extra/config

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years ago*.i depend on generated headers
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 08:00:54 +0000 (10:00 +0200)]
*.i depend on generated headers

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agosilence warning about undefined preprocessor token
Bernhard Reutner-Fischer [Mon, 12 Apr 2010 07:43:08 +0000 (09:43 +0200)]
silence warning about undefined preprocessor token

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agolibc_regex: __libc_lock primitives are actually available on uClibc
Carmelo Amoroso [Mon, 12 Apr 2010 07:23:43 +0000 (09:23 +0200)]
libc_regex: __libc_lock primitives are actually available on uClibc

__libc_lock primitives are actually available on uClibc when threading
support is enable, so in this case they can be used.

It also fixes the following compiler warnings:

In file included from libc/misc/regex/regex.c:55:
libc/misc/regex/regex_internal.h:49:1: warning: "__libc_lock_define" redefined
[SNIP]
libc/misc/regex/regex_internal.h:50:1: warning: "__libc_lock_init" redefined
[SNIP]
libc/misc/regex/regex_internal.h:51:1: warning: "__libc_lock_lock" redefined
[SNIP]
libc/misc/regex/regex_internal.h:52:1: warning: "__libc_lock_unlock" redefined

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
(cherry picked from commit 65f9ccdafd008abd9892dfc46fb9737ec4d964c5)

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agolibc_regex: __libc_lock primitives are actually available on uClibc
Carmelo Amoroso [Mon, 12 Apr 2010 07:23:43 +0000 (09:23 +0200)]
libc_regex: __libc_lock primitives are actually available on uClibc

__libc_lock primitives are actually available on uClibc when threading
support is enable, so in this case they can be used.

It also fixes the following compiler warnings:

In file included from libc/misc/regex/regex.c:55:
libc/misc/regex/regex_internal.h:49:1: warning: "__libc_lock_define" redefined
[SNIP]
libc/misc/regex/regex_internal.h:50:1: warning: "__libc_lock_init" redefined
[SNIP]
libc/misc/regex/regex_internal.h:51:1: warning: "__libc_lock_lock" redefined
[SNIP]
libc/misc/regex/regex_internal.h:52:1: warning: "__libc_lock_unlock" redefined

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agoldso_sh: Provide only one definition for elf_machine_type_class
Carmelo Amoroso [Sun, 11 Apr 2010 20:56:05 +0000 (22:56 +0200)]
ldso_sh: Provide only one definition for elf_machine_type_class

It doesn't need to provide different definition of elf_machine_type_class
macro depending on TLS support.
It also fixes build for sh architecture when thread support is off:
  CC ldso/ldso/ldso.oS
In file included from ./ldso/ldso/sh/dl-sysdep.h:9,
                 from ./ldso/include/dl-string.h:11,
                 from ./ldso/include/ldso.h:40,
                 from ldso/ldso/ldso.c:33:
./include/tls.h:6:22: error: tls.h: No such file or directory
make: *** [ldso/ldso/ldso.oS] Error 1

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
14 years agoresolv: tentatively fix usage of uninitialized DNS parameters
Denys Vlasenko [Fri, 9 Apr 2010 21:17:34 +0000 (23:17 +0200)]
resolv: tentatively fix usage of uninitialized DNS parameters

See "Possible regression from timeout commit for resolv.conf" thread.
Also remove superfluous NULL check.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
14 years agoFixes NPTL build on x86.
Natanael Copa [Fri, 9 Apr 2010 13:20:59 +0000 (06:20 -0700)]
Fixes NPTL build on x86.

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years ago.gitignore getconf binaries
Bernhard Reutner-Fischer [Thu, 8 Apr 2010 08:33:53 +0000 (10:33 +0200)]
.gitignore getconf binaries

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoconfstr: properly stringify version parts
Bernhard Reutner-Fischer [Thu, 8 Apr 2010 08:33:09 +0000 (10:33 +0200)]
confstr: properly stringify version parts

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agopthread_{attr_,}{s,g}etaffinity: cleanup symbol names
Bernhard Reutner-Fischer [Wed, 7 Apr 2010 20:44:07 +0000 (22:44 +0200)]
pthread_{attr_,}{s,g}etaffinity: cleanup symbol names

fixes typo in a1ee5b32fc698297149c770417354441ee62701e which forgot to
rename __pthread_attr_getaffinity_np to pthread_attr_getaffinity_np.
Thanks to Andre DRASZIK for mentioning my omission.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoutils .gitignore update to include getconf
Austin Foxley [Tue, 6 Apr 2010 17:05:34 +0000 (10:05 -0700)]
utils .gitignore update to include getconf

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agocorrectly quote version in confstr
Austin Foxley [Tue, 6 Apr 2010 16:16:02 +0000 (09:16 -0700)]
correctly quote version in confstr

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agoMerge commit 'origin/master' into nptl
Austin Foxley [Tue, 6 Apr 2010 15:58:29 +0000 (08:58 -0700)]
Merge commit 'origin/master' into nptl

Conflicts:
libc/misc/utmp/utent.c
libc/sysdeps/linux/i386/bits/syscalls.h

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
14 years agogetconf: print arbitrary GNU_LIBPTHREAD_VERSION string
Bernhard Reutner-Fischer [Tue, 6 Apr 2010 15:17:30 +0000 (17:17 +0200)]
getconf: print arbitrary GNU_LIBPTHREAD_VERSION string

the NPTL should probably print the version-string of the glibc it's
compatible with and not the uClibc version (check what mysql expects).

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agogetconf: move to utils/
Bernhard Reutner-Fischer [Tue, 6 Apr 2010 14:19:46 +0000 (16:19 +0200)]
getconf: move to utils/

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoFix use-after-free bug in __dns_lookup
Gabor Juhos [Tue, 6 Apr 2010 07:55:19 +0000 (09:55 +0200)]
Fix use-after-free bug in __dns_lookup

If the type of the first answer does not match with the requested type,
then the dotted name was freed. If there are no further answers in
the DNS reply, this pointer was used later on in the same function.
Additionally it is passed to the caller, and caused strange
behaviour.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
14 years agoi386/bits/syscalls.h: more compact, but stack-hungry syscall code. disabled so far
Denys Vlasenko [Tue, 6 Apr 2010 03:33:01 +0000 (05:33 +0200)]
i386/bits/syscalls.h: more compact, but stack-hungry syscall code. disabled so far

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>