OSDN Git Service

uclinux-h8/uClibc.git
10 years agomips: Remove duplicate macro definitions
Steve Ellcey [Wed, 12 Feb 2014 19:01:35 +0000 (11:01 -0800)]
mips: Remove duplicate macro definitions

The INLINE_SYSCALL, INTERNAL_SYSCALL*, and internal_syscall* macros
are defined for MIPS in both libc/sysdeps/linux/mips/sysdep.h and
libc/sysdeps/linux/mips/bits/syscalls.h.  The macros are the same
in both cases except that syscalls.h defines internal_syscalls[567]
the same for N32 and N64 ABIs and has a different definition for O32.
I believe that is correct.  The sysdep.h header uses the O32 versions
for N32 and has different definitions for N64.  I think that is wrong
and that N32 and N64 should share the same definition (modulo the
type 'long' vs. 'long long' for the arguments.  This setup (from
sysdep.h) now agrees with what glibc has.

I am not positive about which header (sysdep.h vs syscalls.h) is
really the right one to have these definitions in but using sysdep.h
seems to work for all my builds.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: Fix sync_file_range.c for MIPS64 N32 ABI
Steve Ellcey [Wed, 12 Feb 2014 18:09:58 +0000 (10:09 -0800)]
libc: Fix sync_file_range.c for MIPS64 N32 ABI

The special sync_file_range handling is only needed for the O32 ABI
(regardless of whether it is on mips32 or mips64).  The N32 (and N64)
ABI's should both use the standard code.  This routine was using the
special code for the N32 ABI because that ABI has a word size of 32 bits
and that is wrong.  This patch fixes it by checking the ABI used instead
of checking the word size.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agotest/tls/tst-tls[6-8]: Fix build errors
Vineet Gupta [Thu, 6 Feb 2014 12:19:21 +0000 (17:49 +0530)]
test/tls/tst-tls[6-8]: Fix build errors

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: silence warning in fts
Bernhard Reutner-Fischer [Sat, 15 Feb 2014 09:32:28 +0000 (10:32 +0100)]
libc: silence warning in fts

cderrno is dead code, comment it out.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: mips: Fix setjmp/longjmp for MIPS64 N64 ABI
Waldemar Brodkorb [Wed, 29 Jan 2014 17:58:56 +0000 (18:58 +0100)]
libc: mips: Fix setjmp/longjmp for MIPS64 N64 ABI

When booting a Linux system with qemu-system-mips64 the execution
of $(pwd) in the ash shell triggers a segmentation fault. Ash uses
setjmp/longjmp for exception handling.

After looking at the glibc implementation,
I found some differences, with this patch tries to resolve.
Now the system boots up fine and no segmentation faults occur.

The global pointer should be restored and the types for the
register values should be wide enough.

See:
http://www.cygwin.com/ml/libc-alpha/2003-03/msg00363.html

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agomips: silence 'set but not used' warnings
Steve Ellcey [Wed, 29 Jan 2014 17:54:34 +0000 (09:54 -0800)]
mips: silence 'set but not used' warnings

This patch uses 'attribute_unused' to clean up a number of warnings
messages that are generated when doing a MIPS build.  All of the
changes are in MIPS specific files and there are no code changes
other then adding the unused attribute where needed.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: mips: Fix non-LFS build
Steve Ellcey [Sat, 25 Jan 2014 01:44:58 +0000 (17:44 -0800)]
libc: mips: Fix non-LFS build

The MIPS build is failing when UCLIBC_HAS_LFS is set to "n"
because posix_fadvise64.c is included in the build when it
should not be.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agomips: silence _ABI* undef warnings
Bernhard Reutner-Fischer [Thu, 23 Jan 2014 22:03:48 +0000 (23:03 +0100)]
mips: silence _ABI* undef warnings

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agopowerpc: syscall support up to 6 arguments
Bernhard Reutner-Fischer [Wed, 22 Jan 2014 22:10:15 +0000 (23:10 +0100)]
powerpc: syscall support up to 6 arguments

As reported by Kristof Provost.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agovfork: fix clone based version
Stefan Kristiansson [Fri, 17 Jan 2014 04:30:08 +0000 (06:30 +0200)]
vfork: fix clone based version

The clone based version was introduced by commit

58570fc8e1fd601f15be5758ab95013d56771804
vfork: Use clone if arch does not have the vfork syscall

but the code was made unreachable by the previous commit

0a043c30ee71245dfe7c9d82d654312c5e1f6127
vfork: make all archs consistent

that adds a guard which require either __NR_vfork or __NR_fork
to be set.
Neither will be set on an arch that would need to use the
clone based version.

The double declaration of vfork was also introduced by
the merge of the two above mentioned patches.
The missing ; was present in the original patch.

CC: Markos Chandras <markos.chandras@imgtec.com>
CC: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
CC: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: fix MIPS N64 fork
Waldemar Brodkorb [Sat, 21 Dec 2013 12:18:29 +0000 (13:18 +0100)]
libc: fix MIPS N64 fork

fork() is broken for MIPS64 N64 ABI. You can check it with a simple
C program statically linked with qemu-mips64 user emulation.
Internally fork() is using the clone system call (at least with NPTL)
with 5 arguments. See ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c.
The calling conventions for MIPS N32 and N64 allow to use up to 8 registers
for that. See http://en.wikipedia.org/wiki/Calling_convention#MIPS
This is correctly implemented in libc/sysdeps/linux/mips/bits/syscalls.h,
but not in libc/sysdeps/linux/mips/sysdep.h. fork.c uses the later one.
It seems that fork() works fine for MIPS64 N32 with just using the stack like
with the O32 case. There is a user of INLINE_SYSCALL with 7 arguments in
libc/sysdeps/linux/common/sync_file_range.c for MIPS64 N32, so I decided to
only use the macros for the MIPS64 N64 case. With this patch my uClibc based
Linux system boots up fine in qemu-system-mips64.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agonptl: Fix arm pt-vfork
Bernhard Reutner-Fischer [Sat, 11 Jan 2014 19:02:30 +0000 (20:02 +0100)]
nptl: Fix arm pt-vfork

We were ending up with an unrecognised CPP token (which is not diagnosed
for assembler-with-cpp, 59805)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: add guard for arm thumb2 asm
Bernhard Reutner-Fischer [Sat, 11 Jan 2014 18:48:42 +0000 (19:48 +0100)]
libc: add guard for arm thumb2 asm

Fixes gen_lowlevelrobustlock on thumb2

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: arm, metag: Use runtime pagesize
Bernhard Reutner-Fischer [Sat, 11 Jan 2014 18:43:12 +0000 (19:43 +0100)]
ldso: arm, metag: Use runtime pagesize

Use the generic runtime pagesize as per
ce54b92b046b65464e2d16b3842f3e97e3e0f27e

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: metag: Remove inappropriate comment
Bernhard Reutner-Fischer [Tue, 14 Jan 2014 12:42:28 +0000 (13:42 +0100)]
buildsys: metag: Remove inappropriate comment

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoARC: opencode ENTRY/END macros in crt1
Vineet Gupta [Tue, 24 Dec 2013 13:25:17 +0000 (18:55 +0530)]
ARC: opencode ENTRY/END macros in crt1

crt1.S -> include sysdep.h -> include sysnum.h

In multistage gcc build, Buildroot happens to build crt1.S before
sysnum.h is generated. So break the above include chain and opencode the
ENTRY/END macros.

Reported-by: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: store savedefconfig to defconfig file
Vineet Gupta [Thu, 19 Dec 2013 11:39:59 +0000 (17:09 +0530)]
buildsys: store savedefconfig to defconfig file

It now generated a file name defconfig in current directory

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoxtensa: use common ptrace.h
Baruch Siach [Sun, 5 Jan 2014 12:39:03 +0000 (14:39 +0200)]
xtensa: use common ptrace.h

Adds support for architecture independent actions.

Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: posix_fadvise: restore implementation for xtensa
Baruch Siach [Sun, 5 Jan 2014 09:44:02 +0000 (11:44 +0200)]
libc: posix_fadvise: restore implementation for xtensa

Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT)
removed posix_fadvise implementation for xtensa, since xtensa does not
define __NR_fadvise64. Reuse the ARM support code to restore xtensa support.

This commit is based Mike Frysinger's suggested patch.

Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agosiginfo.h: __SIGEV_PAD_SIZE takes __WORDSIZE into account
Vicente Olivert Riera [Thu, 2 Jan 2014 15:02:12 +0000 (15:02 +0000)]
siginfo.h: __SIGEV_PAD_SIZE takes __WORDSIZE into account

Make __SIGEV_PAD_SIZE to take __WORDSIZE into account for alpha, mips
and ia64 arches.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agosiginfo.h: add a missing function member on ia64, mips and sparc arches
Vicente Olivert Riera [Thu, 2 Jan 2014 15:02:11 +0000 (15:02 +0000)]
siginfo.h: add a missing function member on ia64, mips and sparc arches

Add "__pid_t _tid" member which is used for some packages, like rt-test
for instance, which fails with an error like this one:

src/cyclictest/cyclictest.c:638:9: error: 'union <anonymous>' has no
member named '_tid'

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: update unifdef
Bernhard Reutner-Fischer [Wed, 8 Jan 2014 09:44:05 +0000 (10:44 +0100)]
buildsys: update unifdef

sync up to 1542ea42da59018860a987f34f065cd120982e8c
(2.10 + cleaner exit status handling)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: fixup unifdef state in skiphash, linenum
Bernhard Reutner-Fischer [Tue, 7 Jan 2014 18:47:31 +0000 (19:47 +0100)]
buildsys: fixup unifdef state in skiphash, linenum

amend to fixup line-numbering in the unifdefile

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: fixup unifdef state in skiphash
Bernhard Reutner-Fischer [Tue, 7 Jan 2014 16:17:52 +0000 (17:17 +0100)]
buildsys: fixup unifdef state in skiphash

attempt to fix unifdef swallowing -f defundefile lines

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoelf: Add ARC Magic and Relocations
Vineet Gupta [Fri, 13 Dec 2013 09:19:20 +0000 (14:49 +0530)]
elf: Add ARC Magic and Relocations

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: ARC: tweak whitespace some more
Bernhard Reutner-Fischer [Fri, 20 Dec 2013 15:24:12 +0000 (16:24 +0100)]
ldso: ARC: tweak whitespace some more

Use spaces instead of tabs in the table to accomodate different tab
settings.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: ARC whitespace tweaks
Vineet Gupta [Fri, 20 Dec 2013 14:14:47 +0000 (19:44 +0530)]
ldso: ARC whitespace tweaks

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoinet: Fix threaded res_init
Kenneth Soerensen [Fri, 20 Dec 2013 14:53:01 +0000 (15:53 +0100)]
inet: Fix threaded res_init

In a multi-threaded application where res_init() was called either
directly or implicitly, getaddrinfo() and others failed to add the
DNS search domain to hostnames.

This problem made it not possible to look up a hostname without its
domain appended.

The problem is caused by res_sync_func() overwriting the configuration
read by __open_nameservers() immediately after it is read.

The suggested solutin is to disable res_sync_func() while reading name
server configuration in res_init().

Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibrt: fix mq_timed{send,receive} return instructions
Baruch Siach [Thu, 7 Nov 2013 12:38:18 +0000 (14:38 +0200)]
librt: fix mq_timed{send,receive} return instructions

Not all architectures use 'ret' as function return instruction. For example,
xtensa usually uses 'retw'. Use the ret_ERRVAL arch dependant macro instead.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc/sysdeps: commonize ret_ERRVAL
Baruch Siach [Thu, 7 Nov 2013 12:38:17 +0000 (14:38 +0200)]
libc/sysdeps: commonize ret_ERRVAL

* Add a common ret_ERRVAL definition

* Remove ret_ERRVAL from architectures using the common 'ret'

* Add 'undef' to architectures that need a different return instruction

* Add '#include <common/sysdep.h>' to cris and ia64 that were missing it

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoARC defconfigs
Vineet Gupta [Fri, 13 Dec 2013 09:19:26 +0000 (14:49 +0530)]
ARC defconfigs

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoARC port to uClibc
Vineet Gupta [Fri, 13 Dec 2013 09:19:25 +0000 (14:49 +0530)]
ARC port to uClibc

For this port, I would like to give due credit to:

- Folks from Codito technologies (Sameer, Amit, Kanika, Ramana,...)
   who did the very first port

- ARC UK from 2007-2009 (Joern, Irfan, Khurram, Phil...

- Late Brendan Kehoe (may he RIP)

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agostring: Add ARC support
Joern Rennecke [Fri, 13 Dec 2013 09:19:24 +0000 (14:49 +0530)]
string: Add ARC support

Signed-off-by: Joern Rennecke <joern.rennecke@embecosm.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoLT.old: Add ARC support
Vineet Gupta [Fri, 13 Dec 2013 09:19:23 +0000 (14:49 +0530)]
LT.old: Add ARC support

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: Add ARC support
Vineet Gupta [Fri, 13 Dec 2013 09:19:22 +0000 (14:49 +0530)]
ldso: Add ARC support

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldd: Add ARC support
Vineet Gupta [Fri, 13 Dec 2013 09:19:21 +0000 (14:49 +0530)]
ldd: Add ARC support

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoFix for SIGBUS error on MIPS64 with N64 ABI
Waldemar Brodkorb [Wed, 27 Nov 2013 08:55:51 +0000 (09:55 +0100)]
Fix for SIGBUS error on MIPS64 with N64 ABI

When accessing errno, a per thread variable, from _stdio_init
a SIGBUS error happens. This change fixes the wrong relocation
and debug output.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoNPTL: fork: relief register pressure on arm thumb1
Bernhard Reutner-Fischer [Fri, 20 Dec 2013 13:05:12 +0000 (14:05 +0100)]
NPTL: fork: relief register pressure on arm thumb1

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: use unlikely macro
Bernhard Reutner-Fischer [Fri, 20 Dec 2013 13:00:26 +0000 (14:00 +0100)]
ldso: use unlikely macro

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: Fix error on config clean in realclean
Bernhard Reutner-Fischer [Fri, 20 Dec 2013 12:59:03 +0000 (13:59 +0100)]
buildsys: Fix error on config clean in realclean

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: add TODO reminder
Bernhard Reutner-Fischer [Fri, 20 Dec 2013 12:21:20 +0000 (13:21 +0100)]
buildsys: add TODO reminder

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: update unifdef
Bernhard Reutner-Fischer [Tue, 19 Nov 2013 11:43:49 +0000 (12:43 +0100)]
buildsys: update unifdef

sync up to 55501a61dd257e941d53f175350ee52fc6ff2866
(2.9 + refactor keyword and symbol matching)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: check LDFLAGS through driver
Bernhard Reutner-Fischer [Wed, 13 Nov 2013 11:31:00 +0000 (12:31 +0100)]
buildsys: check LDFLAGS through driver

We run the linker through the compiler-driver, so we have to check
linker flags through the driver, too.
Otherwise we might check $LD's flags while we will run $CC's linker
and those might be different beasts.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: silence warnings in debug code
Bernhard Reutner-Fischer [Tue, 12 Nov 2013 16:29:48 +0000 (17:29 +0100)]
ldso: silence warnings in debug code

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoMake res_init() thread safe.
Kenneth Soerensen [Wed, 10 Apr 2013 14:52:52 +0000 (16:52 +0200)]
Make res_init() thread safe.

res_init() was not atomic, which could give undesired behaviour. Now
res_init() is completely locked under one lock and the locking is
removed from __res_vinit().

Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoFix threaded use of res_ functions.
Sørensen, Kenneth [Thu, 11 Apr 2013 06:32:54 +0000 (06:32 +0000)]
Fix threaded use of res_ functions.

Commit aab4df0fb51660300559f5f29290709db2f7bfee says that the line with
after res_init() function. Commit
7f74de5d4d6d10baafab4b37bb3d472f5c5f0e8c moves the res_init()
function below the line with #undef _res.

This commit moves res_init() back above #undef _res.

Signed-off-by: Kenneth Soerensen <kenneth.sorensen@spectralink.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: document savedefconfig in help
Bernhard Reutner-Fischer [Mon, 11 Nov 2013 10:18:30 +0000 (11:18 +0100)]
buildsys: document savedefconfig in help

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: on realclean, rm include/{config,generated}
Bernhard Reutner-Fischer [Mon, 11 Nov 2013 10:15:17 +0000 (11:15 +0100)]
buildsys: on realclean, rm include/{config,generated}

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobuildsys: rm PT startfiles on realclean
Bernhard Reutner-Fischer [Tue, 5 Nov 2013 20:37:00 +0000 (21:37 +0100)]
buildsys: rm PT startfiles on realclean

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agotime.c: make ll_tzname* static again
Bernhard Reutner-Fischer [Tue, 5 Nov 2013 19:57:23 +0000 (20:57 +0100)]
time.c: make ll_tzname* static again

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoprctl: fix system call wrapper
Baruch Siach [Fri, 18 Oct 2013 05:51:56 +0000 (08:51 +0300)]
prctl: fix system call wrapper

The argument names used in the prctl wrapper collide with the internal
variable names in syscall wrapper macros on some architecture. This
currently breaks xtensa. grep for '\b_a[0-9]' indicates that metag and
microblaze might also be affected.

Prefix argument names with '_prctl' to avoid collision.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agotest: tls: fix build with newer binutils
Baruch Siach [Wed, 2 Oct 2013 07:08:29 +0000 (10:08 +0300)]
test: tls: fix build with newer binutils

Fix the following build failures:

ld: tst-tls10.o: undefined reference to symbol 'f2a'
ld: tst-tls12.o: undefined reference to symbol 'a1'

binutils ld defaults to --no-copy-dt-needed-entries since version 2.22. Add
library dependencies explicitly.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: remove duplicate function declarations
Baruch Siach [Thu, 22 Aug 2013 08:42:38 +0000 (11:42 +0300)]
ldso: remove duplicate function declarations

Commit e3dec33ba (powerpc: Add TLS and NPTL support) introduced a duplicate of
_dl_add_to_slotinfo and _dl_initial_error_catch_tsd declarations.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agotest: inet: fix build when res_close support is disabled
Baruch Siach [Mon, 26 Aug 2013 10:55:11 +0000 (13:55 +0300)]
test: inet: fix build when res_close support is disabled

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibdl: fix unused variable warning
Baruch Siach [Wed, 28 Aug 2013 08:15:21 +0000 (11:15 +0300)]
libdl: fix unused variable warning

The following warning introduced with commit 231e4a9b4 (libdl: fix dlopen
implementation from statically linked application):

ldso/libdl/libdl.c: In function 'do_dlopen':
ldso/libdl/libdl.c:311:23: warning: unused variable 'ls' [-Wunused-variable]

Cc: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agomisc: fix nm 'No such file' error
Baruch Siach [Wed, 28 Aug 2013 07:54:32 +0000 (10:54 +0300)]
misc: fix nm 'No such file' error

Reset CSRC-y to prevent pollution from libc/misc/glob/Makefile.in, and fix the
following error messages when UCLIBC_HAS_OBSTACK is disabled:

nm: 'libc/misc/gnu/glob-susv3.os': No such file
nm: 'libc/misc/gnu/glob64-susv3.os': No such file

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso: fix unused variable warning
Baruch Siach [Tue, 27 Aug 2013 18:20:17 +0000 (21:20 +0300)]
ldso: fix unused variable warning

This fixes the following warning when SUPPORT_LD_DEBUG_EARLY is not enabled:

ldso/ldso/ldso.c: In function '_dl_get_ready_to_run':
ldso/ldso/ldso.c:754:16: warning: unused variable 'tmp' [-Wunused-variable]

This was introduced with commit 94cc6edb (ldso: Rework global scope handling
and symbol lookup mechanism).

Cc: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoadd posix_fadvise() for arm
Khem Raj [Tue, 24 Sep 2013 00:58:11 +0000 (17:58 -0700)]
add posix_fadvise() for arm

arm call to posix_fadvise simply calls posix_fadvise64

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc/metag: add __kernel_long_t and __kernel_ulong_t
Markos Chandras [Wed, 14 Aug 2013 13:57:39 +0000 (14:57 +0100)]
libc/metag: add __kernel_long_t and __kernel_ulong_t

Add __kernel_long_t and __kernel_ulong_t types for Meta. The rest of
the architectures have been fixed in:

6a76edddaa62ff06f178143b582167734cb55c18
"libc/sysdeps: add __kernel_long and __kernel_ulong"

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agopull kconfig from linux-3.11
Bernhard Reutner-Fischer [Sun, 3 Nov 2013 22:27:46 +0000 (23:27 +0100)]
pull kconfig from linux-3.11

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoFix weak/strong attribute of __errno_location and it's __GI alias
Vineet Gupta [Fri, 4 Oct 2013 10:05:01 +0000 (15:35 +0530)]
Fix weak/strong attribute of __errno_location and it's __GI alias

A simple statically linked hello world program was segfaulting for ARC
in linuxthreads.old configuration (although the root casue applies
cross-arch for NPTL as well as linuxthreads.old as described)

The crash was due to branch to NULL in _stdio_init

  0001026c <_stdio_init>:
     1026c:    push_s     blink
     1026e:    st.a       r13,[sp,-8]
     10272:    bl.d       0  --> supposed call to __errno_location

The call was NOT getting patched to libc internal only alias
__GI___errno_location, because it was weak while it's exported cousin,
__errno_location was strong/normal.

  arc-linux-uclibc-nm libc/misc/internals/__errno_location.os

  00000000 W __GI___errno_location
  00000000 T __errno_location

This is exactly opposite to what is expected.

Quoting Peter S. Mazinger, commit 87936cd013041 "errno and *_init cleanup"

 | The rule adopted:
 | for enabled threads we make in libc the __GI_x() variants strong, x() weak
 | and (should) provide another strong x() in libpthread.
 | If threads are disabled, even the __GI_x() variants are weak.

With the fix, we see the right settings as below

  00000000 T __GI___errno_location
  00000000 W __errno_location

Note that problem won't show up in a static busybox build as it references
errno and that seems to elide the issue.

I can confirm the same/more issues with latest ARM buildroot builds w/o
my fix.

(1). linuxthreads.old (broken just like ARC)

  arm-linux-nm uclibc-snapshot/libc/misc/internals/__errno_location.os

  00000000 W __GI___errno_location
  00000000 T __errno_location

  But presumably the issue there is NOT catestrophic because ARM linker is
  likely smarter and patches a NOP instead of NULL branch.

  00008388 <_stdio_init>:
      8388: e92d4038  push {r3, r4, r5, lr}
      838c: e320f000  nop {0}

(2) NPTL build (exported version is not weak)

  00000000 T __GI___errno_location
  00000000 T __errno_location

  This causes a static link with libpthread and test program
  referencing errno to fail to link.

  #include <errno.h>
  int main(void)
  {
      printf("%d\n", errno);
  }

  arm-linux-gcc -static -pthread -o tst tst.o

  arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__errno_location.os):
  In function `__errno_location':  __errno_location.c:(.text+0x0):
                           multiple definition of `__errno_location'
  arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a
            (errno_location.os):errno_location.c:(.text+0x0): first defined here

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoxtensa: fix atomic_decrement_if_positive() return value
Baruch Siach [Wed, 2 Oct 2013 13:14:55 +0000 (16:14 +0300)]
xtensa: fix atomic_decrement_if_positive() return value

atomic_decrement_if_positive() returns the old value of &mem, not the
(sometimes undefined) value of __tmp.

Fixes the uClibc nptl/tst-sem3 test.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
10 years agoxtensa: fix layout of struct sigcontext to match the kernel
Baruch Siach [Thu, 12 Sep 2013 09:32:53 +0000 (12:32 +0300)]
xtensa: fix layout of struct sigcontext to match the kernel

Current code breaks libgcc unwind.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Chris Zankel <chris@zankel.net>
10 years agopmap_getport: use TCP to talk to portmapper if protocol == IPPROTO_TCP.
Denys Vlasenko [Mon, 7 Oct 2013 14:42:26 +0000 (16:42 +0200)]
pmap_getport: use TCP to talk to portmapper if protocol == IPPROTO_TCP.

Before the patch, the query itself was sent via UDP
(the query contained correct protocol ID).

The fix is taken from glibc.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibc: add isfdtype()
Anthony G. Basile [Sun, 28 Jul 2013 13:08:34 +0000 (09:08 -0400)]
libc: add isfdtype()

isfdtype(int fd, int fdtype) check whether a file descriptor fd is
of type fdtype, where the types are defined in stat(2).  It is
supported in glibc and BSD, and used by utilities such as acpid.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agomalloc: enable assert() when malloc debugging
Baruch Siach [Mon, 8 Jul 2013 08:40:17 +0000 (11:40 +0300)]
malloc: enable assert() when malloc debugging

UCLIBC_MALLOC_DEBUGGING is useless without assert().

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc/sysdeps: Fix common-generic stat.h for BE part 2
Mischa Jonker [Tue, 23 Jul 2013 16:32:07 +0000 (18:32 +0200)]
libc/sysdeps: Fix common-generic stat.h for BE part 2

Previous patch only fixed the build. This patch fixes the behavior at
run-time as well.

It fixes "Value too large for defined data type" messages caused by
fstat syscall wrapper returning -EOVERFLOW.

Signed-off-by: Mischa Jonker <Mischa.Jonker@synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoRules.mak: Fix setting arch native bit
Gustavo Zacarias [Wed, 24 Jul 2013 15:30:35 +0000 (12:30 -0300)]
Rules.mak: Fix setting arch native bit

fix breakage from 603af30d

Removing the whitespace from findstring for 64 bit architectures has
bad consequences since powerpc would be a match in powerpc64 and sparc
would also be a match in sparc64.
That doesn't make them 64 bits in reality causing general breakage.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agotest commit
Bernhard Reutner-Fischer [Fri, 19 Jul 2013 18:53:57 +0000 (20:53 +0200)]
test commit

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoinet: fix unsafe access to _res.options in res_mkquery()
Vanya Sergeev [Sat, 8 Jun 2013 22:49:45 +0000 (15:49 -0700)]
inet: fix unsafe access to _res.options in res_mkquery()

res_mkquery() takes out __resolv_lock to copy _res.options to function local
_res_options on line 4204, but later unsafely accesses _res.options without a
lock, instead of its local copy _res_options, on line 4221.  Looks like a
period / underscore typo.

Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoRules.mak: MIPS64: Select correct interpreter
Markos Chandras [Thu, 11 Jul 2013 16:59:16 +0000 (17:59 +0100)]
Rules.mak: MIPS64: Select correct interpreter

gcc (eg 4.7.3) hardcodes the MIPS64 interpreters like this:
(see gcc/config/linux.h and gcc/config/mips/linux64.h)

o32: UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
n32: UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
n64: UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"

The existing check for MIPS64 in uClibc is wrong because it does
not respect the selected ABI

We fix this by explicitely checking the selected ABI instead of the
selected MIPS variant.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agobits/waitstatus.h: correctly interpret status 0x007f on MIPS
Denys Vlasenko [Thu, 18 Jul 2013 19:57:06 +0000 (21:57 +0200)]
bits/waitstatus.h: correctly interpret status 0x007f on MIPS

On other architectures exit status of 0x007f is not possible,
they don't have signal 127.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoC6X: Remove DSBT in favour of FDPIC
Luis Machado [Thu, 4 Jul 2013 09:48:13 +0000 (11:48 +0200)]
C6X: Remove DSBT in favour of FDPIC

Sync up with the changes from C6X entering the kernel.

Signed-off-by: Luis Machado <lgustavo@codesourcery.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc/sysdeps/linux/common/sendfile.c: fix sendfile64 visibility
Anthony G. Basile [Wed, 3 Jul 2013 21:59:32 +0000 (17:59 -0400)]
libc/sysdeps/linux/common/sendfile.c: fix sendfile64 visibility

Commit a83ea57a50 introduces code for falling back on sendfile64
when the sendfile syscall is not available.  However, as written,
that code leads to sendfile64 being globally hidden in situations
where __NR_sendfile and __USE_LARGEFILE64 are defined.  In this case,
the flow executes strong_alias_untyped(sendfile,sendfile64) in
libc/sysdeps/linux/common/sendfile.c and libc_hidden_proto(sendfile64)
in include/sys/sendfile.h, but nowhere does it do libc_hidden_def(sendfile64).
This patch adds the needed libc_hidden_def(sendfile64).

This breaks, for example, xfsprogs on x86_64.  Reported by mardok4
in IRC.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoinsque: fix segfault on (prev == NULL)
Bartosz Golaszewski [Tue, 18 Jun 2013 21:02:20 +0000 (23:02 +0200)]
insque: fix segfault on (prev == NULL)

Since version 2.5 glibc allows prev to be a NULL pointer in insque, whereas
uClibc segfaults in this case. This fixes the issue and makes insque
initialize q_forw and q_back with NULLs if prev == NULL.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibpthread: pthread_exit in static app. segfaults
Filippo ARCIDIACONO [Mon, 1 Jul 2013 13:55:26 +0000 (15:55 +0200)]
libpthread: pthread_exit in static app. segfaults

Static applications that call pthread_exit on the main thread segfault.
This is because after a thread terminates __uClibc_main decrements
__nptl_nthreads which is only defined in pthread_create.
Therefore the right solution is to add a requirement to pthread_create
from pthread_exit.
This patch has been backported from glibc tree:
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=e1f0b2cfa14b058ab033431b70428ccda8ec6ed0
For further detail see also glibc bug at:
http://sourceware.org/bugzilla/show_bug.cgi?id=12310

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Cc: Vladimir Nikulichev <v.nikulichev@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoi386/sysdep.h: Remove STABS_* macros
Khem Raj [Tue, 26 Mar 2013 02:34:39 +0000 (19:34 -0700)]
i386/sysdep.h: Remove STABS_* macros

uclibc is compiled with elf/dwarf and secondly HAVE_CPP_ASM_DEBUGINFO
is not defined so we generate bogus .stab sections needlessly

Some of post processing tools get confused when they see both
dwarf and stab sections

Signed-off-by: Khem Raj <raj.khem@gmail.com>
10 years agoMIPS: set _NSIG to 128, not 129. This matches glibc.
Denys Vlasenko [Fri, 28 Jun 2013 19:59:54 +0000 (21:59 +0200)]
MIPS: set _NSIG to 128, not 129. This matches glibc.

Prompted by lkml discussion of a MIPS bug where sending
signal 128 was found to be able to crash the machine :/

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibc: Fix _obstack_newchunk public symbol vis
Bernhard Reutner-Fischer [Fri, 28 Jun 2013 13:14:46 +0000 (15:14 +0200)]
libc: Fix _obstack_newchunk public symbol vis

975bca165c3e10e74c05c0384fd58f45a7025a3c avoided relocations to
_obstack_newchunk used by obstack_vprintf but missed to enable the
corresponding public symbol which is used by the obstack macros.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: hide obstack relocations
Bernhard Reutner-Fischer [Fri, 14 Jun 2013 12:27:06 +0000 (14:27 +0200)]
libc: hide obstack relocations

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc/misc/gnu/obprintf.c: implement obstack_printf and obstack_vprintf
Anthony G. Basile [Thu, 13 Jun 2013 14:54:39 +0000 (10:54 -0400)]
libc/misc/gnu/obprintf.c: implement obstack_printf and obstack_vprintf

This adds a straight forward implementation for obstack_printf and
obstack_vprintf on uClibc's already existing obstack_grow and
vasprintf.  It does not attempt to port over glibc's implementation
in terms of _IO_* structs and functions.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoconfig: UCLIBC_HAS_OBSTACK to optionally enable obstack support
Anthony G. Basile [Thu, 13 Jun 2013 14:54:25 +0000 (10:54 -0400)]
config: UCLIBC_HAS_OBSTACK to optionally enable obstack support

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoeventfd.h: Use new "bits/" scheme for arch-specific flags
Hiroaki KAWAI [Fri, 19 Apr 2013 01:09:35 +0000 (10:09 +0900)]
eventfd.h: Use new "bits/" scheme for arch-specific flags

As in timerfd.h, eventfd.h needs arch-specific definition files.
alpha, mips and sparc needs separate file, all the other arch
will use common definition.

This problem is already fixed in glibc.

Also sanitize and provide bits for hppa.
Make sure not to install the new bits/eventfd unless eventfd support is
enabled.

Signed-off-by: Hiroaki KAWAI <kawai@stratosphere.co.jp>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoldso/libdl: Also include dl-tls.h for for !SHARED.
Gregory Fong [Mon, 3 Jun 2013 20:32:55 +0000 (13:32 -0700)]
ldso/libdl: Also include dl-tls.h for for !SHARED.

On MIPS, several relocations that were original only resolved by the
dynamic linker were reused as static relocations.  Consequently the
macros TLS_DTPREL_VALUE and TLS_TPREL_VALUE defined in
libpthread/nptl/sysdeps/mips/dl-tls.h need to be available even for
!SHARED.

Relevant: http://www.linux-mips.org/wiki/NPTL#History

Original patch by Vincent Wen <wenvincent@gmail.com>:
http://lists.uclibc.org/pipermail/uclibc/2013-April/047707.html

When build statically linked applications for MIPS platform,
sometimes the linker fails with following errors:
undefined reference to TLS_DTPREL_VALUE
undefined reference to TLS_TPREL_VALUE
The include of dl-tls.h is only in code guarded by SHARED,
Removing the SHARED compilation option to cover static link too.

Signed-off-by: Vincent Wen <wenvincent90@gmail.com>
Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agoReinstate hidden protos for config_{open,close,read}()
Vineet Gupta [Thu, 30 May 2013 08:57:33 +0000 (14:27 +0530)]
Reinstate hidden protos for config_{open,close,read}()

Partially reverts "parser_config.[ch]: remove duplicated hidden functions"

There's a namespace collision for config_{open,close,read} functions
between uClibc and Busybox. Callers in uClibc and busybox need to call
their local variants. In case of static linking, both the variants need
to be pulled in the final executable.

Turns out that the existing hidden attribute is not enough for static
linked Busybox where the linker treats these symbols as duplicate and
pulls in only the local (Busybox's own) variants in the final link.
This obviously causes the uClibc callers to crap out at runtime.

This can be fixed by restoring the libc_hidden_proto() annotation
which causes the libc variants to be aliased with __GI_ prefix thus
making both the symbols distinct from linker's perspective.

This issue was found with ARC gcc 4.8 + uClibc trunk.
I can confirm the same thing with ARM uClibc buildroot build (when
switching to uClibc daily snapshot).

All the credit for debugging the issue goes to Anton,Joern and Jeremy -
I simply found the cure :-)

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Anton Kolesov <akolesov@synopsys.com>
Cc: Jeremy Bennett <jeremy.bennett@embecosm.com>
Cc: Joern Rennecke <joern.rennecke@embecosm.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 years agolibc: elf: explicitly include uClibc_page.h to make PAGE_SIZE visible
Carmelo Amoroso [Mon, 27 May 2013 14:30:36 +0000 (16:30 +0200)]
libc: elf: explicitly include uClibc_page.h to make PAGE_SIZE visible

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
10 years agolibubacktrace: fix build due to some typos
Filippo Arcidiacono [Mon, 13 May 2013 12:06:11 +0000 (14:06 +0200)]
libubacktrace: fix build due to some typos

Commit 71c10c484e7dc113396cccb7e503befb759c6346 broke libubactrace build
due to some typos, so that backtrace.o[sS] were not built.
This definetively fixes this problem.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
10 years agoi386: punt all config options that just control -march
Mike Frysinger [Sun, 19 May 2013 05:09:07 +0000 (01:09 -0400)]
i386: punt all config options that just control -march

You can set these yourself in your CFLAGS, and our list is incomplete
and pointless (we agreed some time ago to stop doing this).

We keep around CONFIG_[3456]86 because it is used to select between
different optimized subdirs of handcoded assembly.

Also take this opportunity to up the default to i686.  If you're using
an older cpu, then you can handle changing this yourself.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agolibubacktrace: fix backtrace for statically linked application
Filippo Arcidiacono [Thu, 9 May 2013 09:42:23 +0000 (11:42 +0200)]
libubacktrace: fix backtrace for statically linked application

libgcc_s.so's unwinder could not access unwind tables of statically
linked binaries, so we really want to use _Unwind_* stuff from
libgcc_eh.a.
It required to build backtrace.c differentiating between shared and
static case.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
10 years agolibdl: fix dlopen implementation from statically linked application
Filippo Arcidiacono [Thu, 9 May 2013 07:04:20 +0000 (09:04 +0200)]
libdl: fix dlopen implementation from statically linked application

Calling dlopen from statically linked application is actually broken,
because _dl_find_hash enters into an infinite loop when trying to
resolve symbols. In this case it doesn't need to extend the global
scope, it is readyto be used as it is, because _dl_loaded_modules already points
to the dlopened library.

The patch also fixesi a typo in __LDSO_LD_LIBRARY_PATH__ macro, that was
preventing to get the actual value of the LD_LIBRARY_PATH.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
10 years agolibc: deal with aux vect inside __uClibc_main only if !SHARED
Filippo ARCIDIACONO [Fri, 14 Dec 2012 10:40:05 +0000 (11:40 +0100)]
libc: deal with aux vect inside __uClibc_main only if !SHARED

It's not safe to use the aux vect inside __uClibc_main if we are running
with shared libraries, because it could have been already modified.
For example, if some constructor plays with environment variables by
using unsetenv, the modifications done into the stack to unset an
environment variable, have impacts on the aux vect due to the extra NULL
entries added.
Due to this, __uClibc_main is not able to detect where the aux vect
starts, so all the entries that are used by __uClibc_main (AT_UID,
AT_EUID, AT_GID, AT_EGID, AT_PAGESZ and possibly other arch specific)
are impacted.

Same side effect on the aux vect is caused by the ld.so when running a
SUID program with some of the unsecure environment variables set, that
will be unset by the ld.so itself.

In order to fix this issue, it needs to handle aux vect entries into
__uClibc_main only if SHARED is not defined.
In SHARED case, libc refers to __dl_secure and _dl_pagesize as initialised
by the ld.so where the aux vext is still untouched.

Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Reviewed-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
11 years agolinux: pread/write: fix 64bit handling
Mike Frysinger [Sun, 7 Apr 2013 06:19:53 +0000 (02:19 -0400)]
linux: pread/write: fix 64bit handling

The syscall on 64bit ports takes 4 args as there is no need to split
up the value into two args.  Add support for that to the common code.

Once we fix that, the mips code can now leverage it for its 64bit and
32bit needs.  However, we can't just drop it entirely yet because its
n32 ABI needs special handling to treat it like a 64bit port.  This
does change the existing behavior which treats the n32 like a 32bit
port, but we want to do this.

In the future, we'll probably have to introduce a define for this as
it currently affects x86_64/x32 and mips/n32.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agobuildsys: fix realclean
Bernhard Reutner-Fischer [Wed, 3 Apr 2013 22:31:03 +0000 (00:31 +0200)]
buildsys: fix realclean

For anything but (toplevel) clean, CLEAN_%, we need .config
Otherwise realclean would leave stuff behind that was not intended to
survive.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agoadd UCLIBC_SUSV2_LEGACY to hide valloc
Bernhard Reutner-Fischer [Wed, 3 Apr 2013 22:25:06 +0000 (00:25 +0200)]
add UCLIBC_SUSV2_LEGACY to hide valloc

valloc was marked as LEGACY in SUSv2, removed from SUSv3 and later.
TODO: Remove this (point people to memalign and it's successors?).

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agorelinfo.pl: use correct interpreter
Bernhard Reutner-Fischer [Wed, 3 Apr 2013 22:12:25 +0000 (00:12 +0200)]
relinfo.pl: use correct interpreter

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agorelinfo.pl: silence warning
Bernhard Reutner-Fischer [Wed, 3 Apr 2013 22:06:29 +0000 (00:06 +0200)]
relinfo.pl: silence warning

$* is no longer supported at extra/scripts/relinfo.pl line 2.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agostdlib: avoid relocation
Bernhard Reutner-Fischer [Wed, 3 Apr 2013 20:54:00 +0000 (22:54 +0200)]
stdlib: avoid relocation

valloc uses memalign

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agolinux: pread/write: convert to SYSCALL_ALIGN_64BIT
Mike Frysinger [Mon, 1 Apr 2013 09:53:38 +0000 (05:53 -0400)]
linux: pread/write: convert to SYSCALL_ALIGN_64BIT

The pread64/write64 syscalls have the 64bit register align issue for
all arches.  Use this new define so we can merge the powerc/xtensa
versions back into the common code.

SuperH is funky and also allows us to do this.

We should be able to merge the mips version too, but that'll require
someone to take a closer look as the current stuff doesn't look quite
right.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agolinux: readahead: convert to SYSCALL_ALIGN_64BIT
Mike Frysinger [Mon, 1 Apr 2013 09:40:42 +0000 (05:40 -0400)]
linux: readahead: convert to SYSCALL_ALIGN_64BIT

The readahead syscall has the 64bit register align issue for all
arches.  Only mips was handling this though.

Clean up the common readahead.c to use the SYSCALL_ALIGN_64BIT
define so that we can throw away the mips version and make this
work correctly on arm/ppc/xtensa.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agolinux: posix_fadvise: use new SYSCALL_ALIGN_64BIT
Mike Frysinger [Mon, 1 Apr 2013 09:29:23 +0000 (05:29 -0400)]
linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT

Now that we have a new SYSCALL_ALIGN_64BIT define for tracking the
64bit register shift behavior, use it.  This allows us to delete
duplicated arm/xtensa files, as well as drop a few arch ifdefs from
common code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>