OSDN Git Service

uclinux-h8/uclibc-ng.git
8 years agoh8300: O_DIRECT and O_DIRECTIRY swapping. rx
Yoshinori Sato [Sat, 9 Jan 2016 06:57:55 +0000 (15:57 +0900)]
h8300: O_DIRECT and O_DIRECTIRY swapping.

8 years agoh8300: Add ARCH_HAS_DEPRECATED_SYSCALLS
Yoshinori Sato [Sat, 9 Jan 2016 06:56:59 +0000 (15:56 +0900)]
h8300: Add ARCH_HAS_DEPRECATED_SYSCALLS

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agorevert changes
Yoshinori Sato [Sat, 9 Jan 2016 06:53:55 +0000 (15:53 +0900)]
revert changes

8 years agogetdents is deprecated.
Yoshinori Sato [Fri, 1 Jan 2016 10:34:18 +0000 (19:34 +0900)]
getdents is deprecated.
So redirect to readdir64 in __ARCH_HAS_DEPRECATED_SYSCALLS__.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years ago__ARCH_HAS_DEPRECATED_SYSCALLS__ case fix.
Yoshinori Sato [Fri, 1 Jan 2016 10:20:20 +0000 (19:20 +0900)]
__ARCH_HAS_DEPRECATED_SYSCALLS__ case fix.
getdents is deprecated.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agoRemove alias.
Yoshinori Sato [Mon, 4 Jan 2016 12:51:04 +0000 (21:51 +0900)]
Remove alias.

open_cancel and open2_cancel have diffrent argument on open.
So can't alias this functions.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agoopenat argument fix.
Yoshinori Sato [Fri, 1 Jan 2016 10:03:55 +0000 (19:03 +0900)]
openat argument fix.

If argument passing to register case (ex. -mregparam=3).
This case set all parameters set to register from caller.
But callee refer to stack. So can't get parameter.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agoh8300: vfork flags update.
Yoshinori Sato [Fri, 1 Jan 2016 09:59:49 +0000 (18:59 +0900)]
h8300: vfork flags update.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agorx: update
Yoshinori Sato [Fri, 1 Jan 2016 09:58:07 +0000 (18:58 +0900)]
rx: update

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agorx: update
Yoshinori Sato [Fri, 1 Jan 2016 09:56:31 +0000 (18:56 +0900)]
rx: update

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agoAdd RX support.
Yoshinori Sato [Wed, 30 Dec 2015 10:59:11 +0000 (19:59 +0900)]
Add RX support.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
8 years agoremove deprecated architectures v850/i960
Waldemar Brodkorb [Mon, 28 Dec 2015 11:11:16 +0000 (12:11 +0100)]
remove deprecated architectures v850/i960

Both architectures are more or less deprecated.
No Linux upstream support, no gcc support for uClinux.

8 years agoReplace bltzal with lapc for MIPS R6 builds.
Steve Ellcey [Wed, 23 Dec 2015 16:38:41 +0000 (08:38 -0800)]
Replace bltzal with lapc for MIPS R6 builds.

The R6 version of MIPS does not support the bltzal instruction.  This
patch changes dl-startup.h and dl-sysdep.h to use lapc on R6 instead.
lapc is a new R6 insruction so older systems need to continue to use
bltzal in order to load register $31.

Signed-off-by: Steve Ellcey <sellcey@imgtec.com>
8 years agoReplace MIPS specific memcpy.S/memset.S with version from glibc/newlib.
Steve Ellcey [Mon, 21 Dec 2015 21:22:07 +0000 (13:22 -0800)]
Replace MIPS specific memcpy.S/memset.S with version from glibc/newlib.

These MIPS specific versions of memcpy.S and memset.S are faster than
the current ones and match what is in newlib and glibc.  They also have
support for the mips32r6 and mips64r6 architectures.

Signed-off-by: Steve Ellcey <sellcey@imgtec.com>
8 years agopselect: Use linux pselect syscall when available
Nicolas S. Dade [Sat, 19 Dec 2015 03:39:19 +0000 (19:39 -0800)]
pselect: Use linux pselect syscall when available

Linux has a pselect syscall since 2.6.something. Using it
rather than emulating it with sigprocmask+select+sigprocmask
is smaller code, and works properly. (The emulation has
race conditions when unblocked signals arrive before or
after the select)

The tv.nsec >= 1E9 handling comes from uclibc's linux select()
implementation, which itself uses pselect() internally if the
pselect syscall exists. I though it would be good to do the
same here.

Note that although the libc pselect() API has 6 arguments,
the linux kernel syscall as 7 arguments. There is an extra,
somewhat vestigial, sizeof the signal mask argument.

Signed-off-by: Nicolas S. Dade <nic.dade@gmail.com>
8 years agolibc/pwd_grp: Create template for non-reentrant functions
Waldemar Brodkorb [Tue, 22 Dec 2015 09:58:08 +0000 (10:58 +0100)]
libc/pwd_grp: Create template for non-reentrant functions

Avoid a lot of copy'n'paste code, no functionality change

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
8 years agoUse gcc's __builtin_mempcpy() as __mempcpy(), if possible
Waldemar Brodkorb [Tue, 22 Dec 2015 09:56:08 +0000 (10:56 +0100)]
Use gcc's __builtin_mempcpy() as __mempcpy(), if possible

Patch from OpenWrt.

Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
8 years agouse arch specific thread stack size for nptl
Waldemar Brodkorb [Tue, 22 Dec 2015 09:51:13 +0000 (10:51 +0100)]
use arch specific thread stack size for nptl

Use the arch specific thread stack size for nptl if the size
returned by getrlimits exceeds it - fixes threads on systems
with only 16 MB RAM.

Patch from OpenWRT

Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
8 years agoDo define some IPv6 related symbols even with IPv6 disabled
Waldemar Brodkorb [Tue, 22 Dec 2015 09:52:55 +0000 (10:52 +0100)]
Do define some IPv6 related symbols even with IPv6 disabled

Fixes compilation of some faulty applictions.
Patch from Freetz.org

Reported-by: Leonid Lisovskiy <lly.dev@gmail.com>
8 years agoresolv: fix gethostbyname2_r to match gethostbyname_r, fixing bugs with AAAA lookups
Waldemar Brodkorb [Tue, 22 Dec 2015 09:47:56 +0000 (10:47 +0100)]
resolv: fix gethostbyname2_r to match gethostbyname_r, fixing bugs with AAAA lookups

The latter half of gethostbyname2_r (doing AAAA queries) is rather dramatically different
from the corresponding portion of gethostbyname_r (doing A queries). This leads to problems
like calls to getaddrinfo only returning one IPv6 address, even when multiple exist.

Seems to be entirely a case of divergent evolution -- a half-decade of fixes for the IPv4
code but no love for IPv6. Until now. ;)

DNS behaviour for IPv6 is really no different than for IPv4 -- beyond the difference in
address sizes, there's no need for the functions to be so different.

Consequently, this patch really is almost just a cut-and-paste of gethostbyname_r, with
the appropriate substitutions of in6_addr, AF_INET6, etc; while holding on to the few
extra bits that actually belong in there (eg #ifdef __UCLIBC_HAS_IPV6__).

Signed-off-by: Wes Campaigne <westacular@gmail.com>
8 years agoinet/resolv: Fix broken h_aliases list terminator after 2dab3f5
Waldemar Brodkorb [Tue, 22 Dec 2015 09:45:51 +0000 (10:45 +0100)]
inet/resolv: Fix broken h_aliases list terminator after 2dab3f5

Commit 2dab3f5a "resolv: tiny shrinkage in /etc/hosts handling" leads to
that read_etc_hosts_r() provide garbage pointer at the end of h_aliases
list if more than four hostnames follow a dotted quad in /etc/hosts

Test-case:

Add following line to /etc/hosts
63.63.0.2    host1 alias2 alias3 alias4 alias5

#include <stdio.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int main (void)
{
int i;
char *a;
struct hostent *he;
struct in_addr ipv4addr;

inet_pton(AF_INET, "63.63.0.2", &ipv4addr);
he = gethostbyaddr(&ipv4addr, sizeof ipv4addr, AF_INET);
if (he == NULL)
exit(1);
printf("Host name: '%s'\n", he->h_name);
i = 0;
while ((a = he->h_aliases[i]) != NULL) {
printf("Host alias: '%s'\n", a);
++i;
}

return 0;
}

 Wrong output:

 Host name: 'host1'
 Host alias: 'alias2'
 Host alias: 'alias3'
 Host alias: 'alias4'
 Host alias: 'alias5'
 Host alias: '??'

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoRevert "glibc compat: bump glibc minor version"
Waldemar Brodkorb [Thu, 17 Dec 2015 20:07:07 +0000 (21:07 +0100)]
Revert "glibc compat: bump glibc minor version"

This reverts commit 4a05ed87ceb946608100642121c32e642b58cd0d.

This breaks SSP detection for gcc, which might be problematic
for some projects. Revert it after some discussion with
buildroot and openembedded people.

8 years agoreduce stack cache size to save memory space
Waldemar Brodkorb [Thu, 17 Dec 2015 19:21:18 +0000 (20:21 +0100)]
reduce stack cache size to save memory space

Idea from different projects as OpenWrt and others.
https://lists.openwrt.org/pipermail/openwrt-devel/2013-November/022299.html
https://github.com/wl500g/toolchain/blob/master/toolchain/uClibc/patches/0.9.32/980-stack-cache-maxsize.patch

8 years agotestsuite subdir fix
Waldemar Brodkorb [Thu, 17 Dec 2015 06:59:05 +0000 (07:59 +0100)]
testsuite subdir fix

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoAdd implementation for copysignl for ppc
Khem Raj [Sat, 31 Oct 2015 18:32:54 +0000 (18:32 +0000)]
Add implementation for copysignl for ppc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
8 years agolibc/stdlib: canonicalize_file_name() memory leak
Wojciech Nizinski [Tue, 20 Oct 2015 12:08:09 +0000 (14:08 +0200)]
libc/stdlib: canonicalize_file_name() memory leak

Uclibc's canonicalize_file_name() is allocating temprary buffer of 4kB
(PATH_MAX), and passing it to realpath() as second argument. Function is
not checking if realpath() fails and memory is lost.

8 years agoutlis/ldd: Fix host ldd in case of target wordsize differs from host one
Waldemar Brodkorb [Sun, 13 Dec 2015 22:52:24 +0000 (23:52 +0100)]
utlis/ldd: Fix host ldd in case of target wordsize differs from host one

improved solution from http://freetz.org/ticket/842

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agotest/tls: tls-macros*.h fixes from glibc
Waldemar Brodkorb [Sun, 13 Dec 2015 22:51:12 +0000 (23:51 +0100)]
test/tls: tls-macros*.h fixes from glibc

glibc commits
 4822a2a520 Add x32 support to TLS_LE/TLS_IE/TLS_GD
 63fb881a04 tls-macros-mips.h: Load $gp as required.
            Merge 32-bit and 64-bit versions.

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agodlclose fix
Waldemar Brodkorb [Sun, 13 Dec 2015 22:49:06 +0000 (23:49 +0100)]
dlclose fix

Patch is from Timo Teras

Refs.:
 http://lists.uclibc.org/pipermail/uclibc/2012-October/047059.html
 http://git.alpinelinux.org/cgit/aports/tree/main/libc0.9.32/uclibc-dlclose-fix.patch

8 years agoFix syslog messages lost if syslogd is temporary busy
Vladislav Grishenko [Wed, 12 Sep 2012 12:04:48 +0000 (18:04 +0600)]
Fix syslog messages lost if syslogd is temporary busy

Commit 4139fe5aec935ba3f462dcaf6aafb6e5eadf1ab9 fixes SIGSTOPed syslogd issue.
but introduced new one - messages will be lost when socket buffer gets full,
not only if syslogd is stalled, but even if it accepts message slower than
someone sends and possibly leads to security hole, when important messages get
lost as result of attacker flooding.

Patch adds 1 second waiting for socket buffer can accept the message, helps
when syslogd is working hard. If it's stalled/SIGSTOPed, message will be sent
to errout as before. After that, further non-blocking /dev/log connect attempts
will fail immediately with EAGAIN error until syslogd reads some from it.

function                                             old     new   delta
openlog_intern                                       259     355     +96
static.tv                                              -       8      +8
.rodata                                              151     159      +8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 112/0)             Total: 112 bytes

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
8 years agoFix syslog messages lost after syslogd restarts
Vladislav Grishenko [Wed, 12 Sep 2012 11:13:55 +0000 (17:13 +0600)]
Fix syslog messages lost after syslogd restarts

If syslogd is stopped and restarted while a process has the log open, the next
message that process produces will be logged to the console and not to the new
instance of syslogd. Further messages will be routed correctly, but not the
first one.

Based on original patch
Bug 3889 - syslog loses messages when syslogd restarted
https://bugs.busybox.net/show_bug.cgi?id=3889

function                                             old     new   delta
openlog                                               33      68     +35
__vsyslog                                            851     848      -3
openlog_intern                                       318     259     -59
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 35/-62)            Total: -27 bytes

Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
8 years agoresolv: NI_IDN unimplemented
Waldemar Brodkorb [Sun, 13 Dec 2015 22:44:54 +0000 (23:44 +0100)]
resolv: NI_IDN unimplemented

Some programs trying to use NI_IDN flag in case of it defined in netdb.h,
so hide it to suppress bad values for ai_flags.
Inspired by OpenWRT issue #12323

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoresolv: __dns_lookup - immediately switch to next server in case of poll() set error...
Waldemar Brodkorb [Sun, 13 Dec 2015 22:42:34 +0000 (23:42 +0100)]
resolv: __dns_lookup - immediately switch to next server in case of poll() set error events

https://bugs.busybox.net/show_bug.cgi?id=3211

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agodynamically allocate ahostbuf buffer
Waldemar Brodkorb [Sun, 13 Dec 2015 22:40:36 +0000 (23:40 +0100)]
dynamically allocate ahostbuf buffer

Free 1k of static data (.bss)

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agosvc.c: svc_getreqset() buffer overflow
Waldemar Brodkorb [Sun, 13 Dec 2015 22:38:30 +0000 (23:38 +0100)]
svc.c: svc_getreqset() buffer overflow

http://bugs.busybox.net/show_bug.cgi?id=5588

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoonly strip test binaries when DOSTRIP is enabled
Waldemar Brodkorb [Sun, 13 Dec 2015 22:36:46 +0000 (23:36 +0100)]
only strip test binaries when DOSTRIP is enabled

8 years agotest needs -fPIC for m68k
Waldemar Brodkorb [Thu, 10 Dec 2015 10:14:41 +0000 (11:14 +0100)]
test needs -fPIC for m68k

8 years agolibc/stdio: Rework custom streams interface similar to glibc.
Waldemar Brodkorb [Wed, 9 Dec 2015 07:05:10 +0000 (08:05 +0100)]
libc/stdio: Rework custom streams interface similar to glibc.

Save 20 bytes per FILE structure, avoid indirect call for
read/write/seek/close operations for normal streams.
Additionally, custom streams has fileno = -2 now, like in glibc.

bloat-o-meter report (UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y):
function                                             old     new   delta
fopencookie                                           69     131     +62
ftello64                                             233     260     +27
fseeko64                                             298     319     +21
fclose                                               423     442     +19
.rodata                                            16696   16708     +12
fileno_unlocked                                       53      45      -8
__ns_name_pack                                       859     851      -8
vswscanf                                             184     144     -40
vdprintf                                             231     187     -44
vsscanf                                              210     151     -59
vswprintf                                            269     201     -68
vsnprintf                                            249     181     -68
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 141/-295)         Total: -154 bytes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agofix readdir_r returns success code while it in fact failed
Waldemar Brodkorb [Wed, 9 Dec 2015 07:07:09 +0000 (08:07 +0100)]
fix readdir_r returns success code while it in fact failed

Taken from Freetz.org.

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agodisable always failing tst-tls16, until someone unbreak it
Waldemar Brodkorb [Thu, 10 Dec 2015 10:04:57 +0000 (11:04 +0100)]
disable always failing tst-tls16, until someone unbreak it

8 years agoconfig: allow config to handle longer path names
Markus Mayer [Thu, 10 Dec 2015 19:24:24 +0000 (11:24 -0800)]
config: allow config to handle longer path names

The current (arbitrary) limit of 128 characters for path names has
proven too short for Android builds, as longer path names are used
there.

Change conf.c, so it can handle path lengths up to PATH_MAX characters.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
8 years agoarc: add ulps file for math tests
Waldemar Brodkorb [Wed, 9 Dec 2015 18:41:41 +0000 (19:41 +0100)]
arc: add ulps file for math tests

Using non-generic ulps file reduces failure counts for
math tests. Generated with nsim emulator running
test-{double,idouble,float,ifloat} -u and
gen-libm-test.pl on the build host.

8 years agodo not hardcode path to perl
Waldemar Brodkorb [Wed, 9 Dec 2015 18:26:33 +0000 (19:26 +0100)]
do not hardcode path to perl

When cross-compiling on other Unix systems like
FreeBSD 10.x, perl is not in /usr/bin. Use env
to find the perl interpreter and use no fixed path
when executing via make.

8 years agonew test is only for MALLOC_STANDARD
Waldemar Brodkorb [Wed, 9 Dec 2015 06:35:28 +0000 (07:35 +0100)]
new test is only for MALLOC_STANDARD

8 years agobsd supports the same floating point classification functions as c99
Waldemar Brodkorb [Sun, 6 Dec 2015 17:09:10 +0000 (18:09 +0100)]
bsd supports the same floating point classification functions as c99

Fixes inetd compile. From OpenWrt.

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoReduce the initial buffer size for open_memstream
Waldemar Brodkorb [Sun, 6 Dec 2015 17:05:32 +0000 (18:05 +0100)]
Reduce the initial buffer size for open_memstream

Reduce the initial buffer size for open_memstream (used by vasprintf),
as most strings are usually smaller than that.
Realloc the buffer after finishing the string to further reduce size.

Problem appears in case of UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y,
see http://dev.openwrt.org/ticket/13024

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoDefine __attribute_const__
Waldemar Brodkorb [Sun, 6 Dec 2015 16:59:04 +0000 (17:59 +0100)]
Define __attribute_const__

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoDo not support localised optimizations this helps to have a global -O level
Khem Raj [Mon, 17 Aug 2015 03:58:59 +0000 (20:58 -0700)]
Do not support localised optimizations this helps to have a global -O level

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoAvoid unnecessary rebuilds due to compiler flag changes
Waldemar Brodkorb [Sun, 6 Dec 2015 16:53:50 +0000 (17:53 +0100)]
Avoid unnecessary rebuilds due to compiler flag changes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agosync with glibc, add some missing defines
Waldemar Brodkorb [Tue, 8 Dec 2015 17:30:57 +0000 (18:30 +0100)]
sync with glibc, add some missing defines

These are already used by some applications, so add it.

8 years agoadd definitions for O_PATH
Waldemar Brodkorb [Mon, 7 Dec 2015 19:20:56 +0000 (20:20 +0100)]
add definitions for O_PATH

Only alpha, hppa and sparc need non-default value.

8 years agosh: add back sh2 specific assembly for clone()
Waldemar Brodkorb [Mon, 7 Dec 2015 06:42:25 +0000 (07:42 +0100)]
sh: add back sh2 specific assembly for clone()

In gcc 5.x there is a compile failure, for sh2 builds
as shad no longer is accepted. Strange that it is working for
4.9.x. Add back old assembly code.

8 years agoallow linuxthreads for superh (sh2 noMMU)
Waldemar Brodkorb [Mon, 7 Dec 2015 06:42:08 +0000 (07:42 +0100)]
allow linuxthreads for superh (sh2 noMMU)

8 years agomips: fix definition.
Steve Ellcey [Wed, 7 May 2014 20:10:48 +0000 (13:10 -0700)]
mips: fix definition.

glibc [BZ# 16922]

* sysdeps/mips/sys/asm.h (INT_SUB): Fix definition.
(LONG_SUB): Ditto.
(PTR_SUB): Ditto.

glibc commit 5057ad3b50

Signed-off-by: Steve Ellcey <sellcey@mips.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoremove __UCLIBC_ASM_GLOBAL_DIRECTIVE__
Waldemar Brodkorb [Sat, 5 Dec 2015 19:52:47 +0000 (20:52 +0100)]
remove __UCLIBC_ASM_GLOBAL_DIRECTIVE__

.globl can be used for every architecture so remove the define.
Sync with GNU C library.

8 years agoremove __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
Waldemar Brodkorb [Sat, 5 Dec 2015 07:10:51 +0000 (08:10 +0100)]
remove __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__

It's even no longer required for non-ported ppc64
architecture. Sync with GNU C library.
This simplify the macros in include/libc-symbols.h.

8 years agobfin: fix clashing with newer gcc
Waldemar Brodkorb [Mon, 30 Nov 2015 17:32:12 +0000 (18:32 +0100)]
bfin: fix clashing with newer gcc

See here for a discussion about the problem:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47779

Latest gcc/binutils git can generate a working uClibc-ng
toolchain. Binaries tested on Arcturus uCBF54x board via
chroot from original firmware.

8 years agobfin: use vfork.S again
Waldemar Brodkorb [Mon, 30 Nov 2015 17:31:53 +0000 (18:31 +0100)]
bfin: use vfork.S again

Actually revert 711ad9f92c1cf992c4a3d9f4f709bd692be7789c, as
it breaks vfork() on real hardware. So the common
implementation no longer works for bfin.

8 years agoxtensa: avoid some compiler warnings
Waldemar Brodkorb [Tue, 24 Nov 2015 21:07:16 +0000 (22:07 +0100)]
xtensa: avoid some compiler warnings

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
8 years agoxtensa: remove ldso workaround by real pointer check
Waldemar Brodkorb [Mon, 23 Nov 2015 18:07:31 +0000 (19:07 +0100)]
xtensa: remove ldso workaround by real pointer check

An abort() is only generated when gcc does not implement
a trap handler for the target architecture.
This fixes the abort() generation. Latest gcc git master
also contains a trap handler for xtensa.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Walemar Brodkorb <wbx@uclibc-ng.org>
8 years agomips: remove ISA choice
Waldemar Brodkorb [Fri, 13 Nov 2015 17:56:50 +0000 (18:56 +0100)]
mips: remove ISA choice

We don't add cpu specific CFLAGS to the build, so the
ISA config symbols for MIPS are noops.
Simple remove them.

Reported-By: Bryan Hundven <bryanhundven@gmail.com>
8 years agometag: add missing header file
Waldemar Brodkorb [Fri, 13 Nov 2015 05:37:45 +0000 (06:37 +0100)]
metag: add missing header file

When installing header files a warning is generated, because
the header is mandatory.

8 years agotests/tls: Implement TLS macros for metag
James Hogan [Wed, 11 Nov 2015 11:17:37 +0000 (11:17 +0000)]
tests/tls: Implement TLS macros for metag

Implement the TLS macros in tls-macros.h for metag.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
8 years agoi386: use socketcall even if newer linux exposes direct syscalls
Waldemar Brodkorb [Fri, 13 Nov 2015 05:13:42 +0000 (06:13 +0100)]
i386: use socketcall even if newer linux exposes direct syscalls

The changeset 9dea5dc921b5f4045a18c63eb92e84dc274d17eb in the Linux kernel
expose the direct syscalls for sockets. For example udhcpc then will use sendto
syscall directly and get an EINVAL error. Disable direct syscalls as it was done
for SPARC in the past. Musl and GNU libc are not affected, as they already
disable direct socket syscalls on i386.

Reported-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
8 years agoh8300: do not use LDFLAGS, they are wrong. testsuite compile fails with it
Waldemar Brodkorb [Wed, 11 Nov 2015 05:35:07 +0000 (06:35 +0100)]
h8300: do not use LDFLAGS, they are wrong. testsuite compile fails with it

8 years agoh8300: disable test using mprotect(), not available for h8300
Waldemar Brodkorb [Wed, 11 Nov 2015 05:34:08 +0000 (06:34 +0100)]
h8300: disable test using mprotect(), not available for h8300

8 years agoreduce timeoutfactor, fasten test runs!
Waldemar Brodkorb [Wed, 11 Nov 2015 05:33:39 +0000 (06:33 +0100)]
reduce timeoutfactor, fasten test runs!

8 years agofanotify: include needed Linux definitions
Waldemar Brodkorb [Sun, 8 Nov 2015 19:41:42 +0000 (20:41 +0100)]
fanotify: include needed Linux definitions

To support older Linux kernel f.e. 2.6.32.68 include all
required definitions. Copied from musl libc fanotify.h.

Reported by Thomas Petazzoni from Buildroot project.

8 years agoadd support for euidaccess/eaccess legacy functions
Waldemar Brodkorb [Sun, 8 Nov 2015 19:38:23 +0000 (20:38 +0100)]
add support for euidaccess/eaccess legacy functions

Implementation taken from musl libc project.
Missing functions recognized by buildroot autobuilders
with failing open-vm-tools.

8 years agounistd: fix #if condition
Thomas Petazzoni [Tue, 3 Nov 2015 14:57:41 +0000 (15:57 +0100)]
unistd: fix #if condition

Commit dfa593d4d881116723a4401b466ea964fb12327b ("syncfs: add system
call support") modified the #if condition around the definition of the
syncfs() prototype in a way that doesn't build, causing build failures
of any file including <unistd.h>:

output/host/usr/powerpc-buildroot-linux-uclibc/sysroot/usr/include/unistd.h:988:14: error: #if with no expression
 #if __USE_GNU

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reported-by: Xi-Sheng Luo <lxsjason@gmail.com>
8 years agosh4a: allow to build a sh4a toolchain
Waldemar Brodkorb [Mon, 2 Nov 2015 06:04:36 +0000 (07:04 +0100)]
sh4a: allow to build a sh4a toolchain

Add correct compiler settings.

8 years agoh8300: fix compile with 4.2.x kernel
Waldemar Brodkorb [Wed, 28 Oct 2015 21:10:09 +0000 (22:10 +0100)]
h8300: fix compile with 4.2.x kernel

8 years agoARC: With NPTL support, GP is no longer used for PIC
Vineet Gupta [Wed, 21 Oct 2015 07:12:25 +0000 (12:42 +0530)]
ARC: With NPTL support, GP is no longer used for PIC

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
8 years agoNPTL/ARC: fix __lll_lock_wait_private redefinition for static links
Vineet Gupta [Wed, 21 Oct 2015 07:12:24 +0000 (12:42 +0530)]
NPTL/ARC: fix __lll_lock_wait_private redefinition for static links

Commit 2d9740a65a "uclibc: nptl: fix __lll_lock_wait_private multiple definition"
did a sweeping change which did for all in tree arches at that time (ARC
wasn't)

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
8 years agoNPTL/ARCv2: Implement full memory barrier for NPTL
Vineet Gupta [Wed, 21 Oct 2015 07:12:23 +0000 (12:42 +0530)]
NPTL/ARCv2: Implement full memory barrier for NPTL

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
8 years agoalpha: add special umount2 handling
Waldemar Brodkorb [Thu, 22 Oct 2015 01:48:09 +0000 (03:48 +0200)]
alpha: add special umount2 handling

Only on Linux alpha __NR_oldumount is defined and a umount not
umount2 syscall, but with two parameter is used.
Add special handling for it and an alias for umount2() users.

There was a discussion about this special handling, but it seems
it was never committed upstream:
http://marc.info/?l=linux-alpha&m=137455037930738&w=2

Runtime tested with qemu-alpha and a statically linked busybox
binary.

8 years agoalpha: fix kernel_stat struct
Waldemar Brodkorb [Thu, 22 Oct 2015 01:47:43 +0000 (03:47 +0200)]
alpha: fix kernel_stat struct

8 years agoalpha: fix header name
Waldemar Brodkorb [Thu, 22 Oct 2015 01:47:13 +0000 (03:47 +0200)]
alpha: fix header name

8 years agoconfdata: fix invalid write
Ben Boeckel [Sat, 17 Oct 2015 15:58:44 +0000 (11:58 -0400)]
confdata: fix invalid write

stndup will copy *up to* the size parameter, not allocate a buffer of
that size, so the buffer is not necessarily large enough to fit the
".old" extension.

Caught with glibc's MALLOC_CHECK_=3.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
8 years agocleanup special purpose warnings
Waldemar Brodkorb [Sun, 18 Oct 2015 23:38:29 +0000 (01:38 +0200)]
cleanup special purpose warnings

8 years agomips: sync header with glibc
Waldemar Brodkorb [Sun, 18 Oct 2015 23:32:48 +0000 (01:32 +0200)]
mips: sync header with glibc

Fixes following compile error, when UCLIBC_HAS_CONTEXT_FUNCS is enabled
on a mips64 build:

  CC libc/sysdeps/linux/common/_exit.os
libc/sysdeps/linux/mips/swapcontext.S: Assembler messages:
libc/sysdeps/linux/mips/swapcontext.S:110: Error: Illegal operands `s.d fs6,(30*8+296)($4)'
libc/sysdeps/linux/mips/swapcontext.S:111: Error: Illegal operands `s.d fs7,(31*8+296)($4)'
libc/sysdeps/linux/mips/swapcontext.S:149: Error: Illegal operands `l.d fs6,(30*8+296)($2)'
libc/sysdeps/linux/mips/swapcontext.S:150: Error: Illegal operands `l.d fs7,(31*8+296)($2)'

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
8 years agolm32: add new architecture
Waldemar Brodkorb [Sat, 17 Oct 2015 09:17:07 +0000 (11:17 +0200)]
lm32: add new architecture

Add support for FPGA systems from Lattice Semiconductor
http://www.latticesemi.com
Merge https://github.com/m-labs/uclibc-lm32.git

8 years agoia64: enable and fix compile issues
Waldemar Brodkorb [Fri, 16 Oct 2015 17:25:44 +0000 (19:25 +0200)]
ia64: enable and fix compile issues

Enable ia64 in the menu.
Fix build for architectures withou ld.so support.
Fix syntax error in bits/byteswap.h.

8 years agosyncfs: add system call support
Bartosz Golaszewski [Wed, 14 Oct 2015 15:14:01 +0000 (17:14 +0200)]
syncfs: add system call support

Add support for the syncfs() system call.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agofanotify: add system call support
Bartosz Golaszewski [Wed, 14 Oct 2015 15:14:00 +0000 (17:14 +0200)]
fanotify: add system call support

Add support for fanotify_init() and fanotify_mark() syscalls. The header
file is taken from glibc.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
8 years agofix static binaries linked with pthread and compiled with ssp
Waldemar Brodkorb [Mon, 12 Oct 2015 14:21:54 +0000 (16:21 +0200)]
fix static binaries linked with pthread and compiled with ssp

Move TLS initialization for static builds up to the calling
function as suggested by Daniel Fahlgren.

Reported-By: Daniel Fahlgren <daniel@fahlgren.se>
8 years agorestrict linuxthreads/nptl choice
Waldemar Brodkorb [Fri, 9 Oct 2015 04:30:14 +0000 (06:30 +0200)]
restrict linuxthreads/nptl choice

For architectures supporting no MMU systems, allow to use
Linuxthreads. BFLAT does not support TLS right now, so NPTL
can not be used.

8 years agoxtensa: support call0 ABI
Max Filippov [Tue, 15 Sep 2015 22:49:49 +0000 (01:49 +0300)]
xtensa: support call0 ABI

Most changes are mechanical replacement of 'retw' instruction with
'abi_ret' macro, defined to 'retw' or 'ret' according to ABI.
Assembly code that makes calls is duplicated for call0 ABI with changed
register numbers for parameters/return value and call instruction.
'entry' instructions are replaced with 'abi_entry' macro.

More interesting changes:
- non-leaf assembly functions (e.g. _dl_tlsdesc_dynamic,
  _dl_linux_resolve, SYSCALL_ERROR_HANDLER, PSEUDO) now need to preserve
  registers around intermediate calls they make, use temporary stack
  frame for that;
- setjmp/longjmp only need to save and restore return address, stack
  pointer and callee-saved registers in the jmpbuf;
- __clone and syscall functions had hardcoded offsets to parameter
  passed on stack, on call0 ABI they don't need stack frame, so the
  offset is different. Replace these offsets with FRAMESIZE macro.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
8 years agolibc: posix_fallocate must return an error number on failure
Yuriy Kolerov [Wed, 23 Sep 2015 12:43:39 +0000 (15:43 +0300)]
libc: posix_fallocate must return an error number on failure

posix_fallocate implementation in uClibc relies on fallocate
system call - it just returns what fallocate returns. However
fallocate returns -1 on failure and assigns an error number
to errno variable. In the same time posix_fallocate must
return an error number but not -1.

What does this patch: if fallocate returns -1 then posix_fallocate
returns errno. Otherwise posix_fallocate returns 0 on success.

However there is a side effect - posix_fallocate sets errno on
failure because fallocate does it. But POSIX does not forbid it
thus it's not a problem.

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
8 years agolibc: fix sign extension in fallocate()
Yuriy Kolerov [Wed, 23 Sep 2015 12:43:38 +0000 (15:43 +0300)]
libc: fix sign extension in fallocate()

For common generic syscall ABI fallocate syscall handler in kernel
expects a 64-bit signed arguments for offset and len. However uClibc
has 2 wrappers for this syscall: fallocate and fallocate64.

On 32-bit machines fallocate (not fallocate64) expects 32-bit values of
offset and len. Thus in this case uClibc's fallocate must pass to the
syscall those values with sign extension. High word of 64-bit value must
be 0 or 0xFFFFFFFF depending on sign of the original 32-bit value (offset
or len). It is how sign extansion works - all high bits of the negative
value must be 1.

So on 32-bit machines uClibc's fallocate does sign extension incorrectly
when 32-bit values are passed (offset or len). It just fills the second
word of 64-bit value by zeros. E.g. fallocate works incorrectly when offset
or length is negative value - in this case kernel thinks that positive
values are passed.

Solution is to call fallocate64 from fallocate and pass 32-bit values of
offset and len to fallocate64. off_t type is automatically converted to
off64_t with an appropriate sign extension. Then fallocate64 invokes
kernel's system call properly.

This error is detected in LTP's test kernel/syscalls/fallocate02:

    ----------->8----------
    fallocate(..., 1, -1024, 1024) failed, expected errno:22: TEST_ERRNO=0
    fallocate(..., 1, 1024, -1024) failed, expected errno:22: TEST_ERRNO=0
    fallocate(..., 1, 12288, -1024) failed, expected errno:22: TEST_ERRNO=0
    fallocate(..., 1, -24576, 1024) failed, expected errno:22: TEST_ERRNO=0
    ----------->8----------

fallocate does not emit an error because negative values are passed to the
kernel without sign extension and kernel thinks that it got valid positive
values.

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
8 years agolibc: fix setting return value and errno in fallocate()
Yuriy Kolerov [Wed, 23 Sep 2015 12:43:37 +0000 (15:43 +0300)]
libc: fix setting return value and errno in fallocate()

fallocate system call must return 0 on success. On error, -1 is returned
and errno is set to indicate the error.

However there is an error in fallocate which is fixed by this patch - it
does not set errno and returns invalid value on error (it returns error
code instead of -1).

This error is detected in LTP's test kernel/syscalls/fallocate02:

    ----------->8----------
    fallocate(..., 1, 0, 1024) failed, expected errno:9: TEST_ERRNO=0
    fallocate(..., 1, -1024, 1024) failed, expected errno:22: TEST_ERRNO=0
    fallocate(..., 1, 1024, -1024) failed, expected errno:22: TEST_ERRNO=0
    fallocate(..., 1, 12288, 0) failed, expected errno:22: TEST_ERRNO=0
    fallocate(..., 1, 12288, -1024) failed, expected errno:22: TEST_ERRNO=0
    fallocate(..., 1, -24576, 1024) failed, expected errno:22: TEST_ERRNO=0
    ----------->8----------

Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>
8 years agoadd new architecture support for or1k
Waldemar Brodkorb [Thu, 8 Oct 2015 18:28:39 +0000 (20:28 +0200)]
add new architecture support for or1k

Information about Openrisc:
http://opencores.org/or1k/Main_Page
Integrated from:
https://github.com/openrisc/uClibc-or1k

8 years agoNPTL: fix CFLAGS for cancellation points
Max Filippov [Tue, 15 Sep 2015 03:18:38 +0000 (06:18 +0300)]
NPTL: fix CFLAGS for cancellation points

Stack unwinding that happens during NPTL thread cancellation needs
cancellable syscall wrapper functions to be compiled with -fexceptions
-fasynchronous-unwind-tables to be able to unwind to cleanup handlers
registered before syscall invocation.

Add these flags for all cancellable syscall wrappers.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
8 years agoRevert "tgmath.h: disable builtins"
Waldemar Brodkorb [Fri, 11 Sep 2015 11:34:14 +0000 (13:34 +0200)]
Revert "tgmath.h: disable builtins"

This reverts commit d1671548b968103f4df1b80659e60ae1fc5a67b3.

You get following errors while compiling freeswitch:
awgn.c: In function 'awgn_init_dbov':                                                                                   awgn.c:110:5: error: void value not ignored as it ought to be                                                                s->rms = pow(10.0, level/20.0)*32768.0;

Reverting this commit allows to build the code.

8 years agotst-mkostemps: fix test case on read-only root filesystem
Waldemar Brodkorb [Sun, 30 Aug 2015 04:50:59 +0000 (06:50 +0200)]
tst-mkostemps: fix test case on read-only root filesystem

Better use /tmp as embedded systems might have a read-only root.
Fix two wrong asserts.

8 years agoldso: install backward compatibility symlink by default
Waldemar Brodkorb [Sat, 22 Aug 2015 18:40:42 +0000 (20:40 +0200)]
ldso: install backward compatibility symlink by default

Simplify the switch from uClibc to uClibc-ng suggested
by Alexey Brodkin <Alexey.Brodkin@synopsys.com>.
Gcc always uses .0 ld.so link, so install it by default.

8 years agoquieten compile warnings
Waldemar Brodkorb [Sat, 22 Aug 2015 18:41:31 +0000 (20:41 +0200)]
quieten compile warnings

Sync with glibc, quietens gcc warnings.

8 years agoadd tests for mkostemps()
Romain Naour [Sat, 22 Aug 2015 19:08:36 +0000 (21:08 +0200)]
add tests for mkostemps()

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
8 years agonptl_db/db_info: fix the incorrect initial size for dtvp
Junling Zheng [Mon, 20 Jul 2015 13:33:57 +0000 (13:33 +0000)]
nptl_db/db_info: fix the incorrect initial size for dtvp

When debugging a program on ARMv7 with thread-local storage declared using
"__thread", attempting to print a thread-local variable will result in the
following message:

Cannot find thread-local storage for Thread <snip> (LWP <snip>), executable
file /tmp/tls: capability not available

This can be traced back to uclibc libpthread/nptl_db/td_thr_tls_get_addr.c
which gdb uses to look up the address of the TLS. The function returns
TD_NOCAPAB due to a mismatch in size between the DTV pointer and the size
recorded in the db description. The problem lies in libpthread/nptl_db/db_info.c
which initializes the db with the sizeof the union dtv. Instead it should
be the sizeof a pointer to union dtv.

Fixed the initial size for dtvp to sizeof a pointer, instead of sizeof
the union.

Refer to:
http://sourceware.org/ml/libc-alpha/2006-10/msg00088.html
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=416b630981788c1f08e746e19765aa0e5c2a1360

Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
8 years agoRevert "ldso: install backward compatibility symlink by default"
Waldemar Brodkorb [Wed, 19 Aug 2015 00:18:24 +0000 (02:18 +0200)]
Revert "ldso: install backward compatibility symlink by default"

This reverts commit 9b9abfbd25d5f95010241bdd72941dafecd56b0e.

Totally wrong patch. sorry.