This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated via dd46699e46decb7273f44dc2cbf307f096dc39e8 (commit) via 03e03e71afc810265b0978f66d62f975bd4f5100 (commit) via 2c3be84e73fa4013608e9b348386ddff91ae0c8c (commit) via e58bacb7ec462912e843fc616288995db88b7275 (commit) via 2eefe0ab83a21e2fa5575e6a1b8b999457984cc7 (commit) via ca6271bd5f595871881447dd40b220c0e5abfb37 (commit) via bc5949fd4f8cddf4eee74492c86a8a72f4dee0e7 (commit) via 0bc1394750885d4e4b2064aff6c48dd542c6f4b8 (commit) via fcbbde85024f494d7ba573bf8a4474755452efdd (commit) via 35adc1fa7fbecea572afaf829a33454da0f764b0 (commit) via e3848e3dd64a8d6437531488fe341354bc02eaed (commit) from 040632792e9f19ccf49149e4ae3ddac351a98b5a (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit dd46699e46decb7273f44dc2cbf307f096dc39e8 Author: Leonid Lisovskiy lly.dev@gmail.com Date: Fri Jun 24 22:06:32 2016 +0300
bits/sigset.h: Fix _EXTERN_INLINE redefinition
Commit 251a3c19cb "sleep: employ __USE_EXTERN_INLINES (with necessary fixes)" introduces following problems:
1. __USE_EXTERN_INLINES forcibly enabled build fails
... LD libuClibc-1.0.15.so libc/libc_so.a(cmsg_nxthdr.os): In function `__GI___cmsg_nxthdr': cmsg_nxthdr.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here libc/libc_so.a(creat.os): In function `__GI___cmsg_nxthdr': creat.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr' libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here ...
2. libuargp wrongly contains __cmsg_nxthdr/__sigismember/__sigdelset/__sigaddset global symbols on platforms which includes signal.h from sys/procfs.h As result, static linking will fail:
TEST_LINK argp/ bug-argp1 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigismember': sigsetops.c:(.text+0x0): multiple definition of `__sigismember' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigaddset': sigsetops.c:(.text+0x28): multiple definition of `__sigaddset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28): first defined here /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os): In function `__GI___sigdelset': sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset' /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c): first defined here
We have to partially revert 251a3c19cb to fix problems above. It is safe to do this after commit 162cfaea20 *: inline constant __sig{add,del}set and __sigismember since we are able to use new inlines from within libc and leave the rest of world(__USE_EXTERN_INLINES) equal to glibc now.
Signed-off-by: Leonid Lisovskiy lly.dev@gmail.com
commit 03e03e71afc810265b0978f66d62f975bd4f5100 Author: Ingo van Lil inguin@gmx.de Date: Thu Jun 23 21:36:36 2016 +0200
inet/resolv: Try search domains first for unqualified names
When resolving an unqualified host name, the resolver tries the original name first before appending the domains from the search list. If a TLD with the same name exists, the query will succeed (but yield no A record) and the resolver will return HOST_NOT_FOUND without trying the search domains.
This patch changes the lookup order for unqualified host names (without dots) to try the search domains first and the original name last.
Signed-off-by: Ingo van Lil inguin@gmx.de
commit 2c3be84e73fa4013608e9b348386ddff91ae0c8c Author: Vineet Gupta Vineet.Gupta1@synopsys.com Date: Thu Jun 23 17:21:15 2016 +0530
ARC: Enable shared crt1
Currently crt1 takes address of functions (main,_init,_fini) directly which doesn't generate truely position independent code, but zero based values instead. e.g.
| __start: | ... | add_s r2,sp,0x4 | mov_s r0, main
generates to
| 000156ec <__start>: | ... | 156f4: add_s r2,sp,0x4 | 156f6: mov_s r0,0x15f7c | ... | 00015f7c <main>: | 15f7c: push_s blink
This works just fine for the normal (non PIE) dynamic executables since they are loaded at address 0. However this is not true for PIE executables. So for Scrt1 we use a true position independent way when taking function addresses.
Cc: uclibc@uclibc.org uclibc@uclibc.org Cc: devel@uclibc-ng.org devel@uclibc-ng.org Cc: Cupertino Miranda cmiranda@synopsys.com Signed-off-by: Vineet Gupta vgupta@synopsys.com
commit e58bacb7ec462912e843fc616288995db88b7275 Author: Alexey Brodkin Alexey.Brodkin@synopsys.com Date: Wed Jun 22 07:38:20 2016 +0300
libs: install backward compatibility symlinks
Simplify the switch from uClibc to uClibc-ng. Apps already built against uClibc-0.9.x.y require .so.0 libs to present on target which in case of current uClibc-ng is not the case and those apps could not be run.
This change creates symlinks from .so.1 to .so.0 for most of other libs in the same way as it was done by 23e96d89b6ab "ldso: install backward compatibility symlink by default"
Signed-off-by: Alexey Brodkin abrodkin@synopsys.com Cc: Waldemar Brodkorb wbx@uclibc-ng.org Cc: Vineet Gupta vgupta@synopsys.com Cc: Anton Kolesov akolesov@synopsys.com
commit 2eefe0ab83a21e2fa5575e6a1b8b999457984cc7 Author: Alexey Brodkin Alexey.Brodkin@synopsys.com Date: Wed Jun 22 11:56:21 2016 +0300
ARC: remove deprecated -msoft-float from CFLAGS
"-msoft-float" makes no sense for ARC because there's no such thing as "-mhard-float" on ARC. Instead we use our own "-mfpu=XXX" option when a particular floating-point related HW feature is enabled in the ARC core.
We used to live with that phony option for quite some time but with migration to newer GCC following warning now appears: -------------------->8----------------- arc-linux-gcc: warning: ‘-msoft-float’ is deprecated cc1: warning: ‘-msoft-float’ is deprecated [enabled by default] -------------------->8-----------------
And that warning gets printed for each invocation of gcc with the option in question, which makes compilation output barely readable.
So we disable that phony option for ARC now.
Signed-off-by: Alexey Brodkin abrodkin@synopsys.com Cc: Waldemar Brodkorb wbx@uclibc-ng.org Cc: Vineet Gupta vgupta@synopsys.com Cc: Anton Kolesov akolesov@synopsys.com
commit ca6271bd5f595871881447dd40b220c0e5abfb37 Author: Anton Kolesov Anton.Kolesov@synopsys.com Date: Wed Jun 22 20:48:29 2016 +0300
ARC: Implement .note.ABI-tag section in crt1.S
Linux Standard Base specifies section .note.ABI-tag that can be considered as a marker for ELF files targeted to Linux systems. See https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/noteabitag.html
This section, for example, is used by the GDB to identify Linux ELFs as compared to baremetal ELFs that do not have this section.
Signed-off-by: Anton Kolesov Anton.Kolesov@synopsys.com Cc: Vineet Gupta Vineet.Gupta1@synopsys.com
commit bc5949fd4f8cddf4eee74492c86a8a72f4dee0e7 Author: Leonid Lisovskiy lly.dev@gmail.com Date: Mon Jun 20 20:29:45 2016 +0300
ldso: fix dlsym hang when reloading DSOs
It can happen under certain cases that the DSO had refcount 0, but was already loaded. (NODELETE flag is set, or it is pulled in via both NEEDED dependency and explicit dlopen()).
Add extra reference count for NODELETE objects, this will ensure that the reference count never drops below one.
It is improved version of http://lists.busybox.net/pipermail/uclibc/2013-June/047826.html
Signed-off-by: Leonid Lisovskiy lly.dev@gmail.com
commit 0bc1394750885d4e4b2064aff6c48dd542c6f4b8 Author: Leonid Lisovskiy lly.dev@gmail.com Date: Mon Jun 20 20:29:44 2016 +0300
ldso: Consistently set & use DL_OPENED flag in both ld.so and libdl
Previously, DL_OPENED flag was set in libdl only and never used. Set it centralized in _dl_load_elf_shared_library() & use it in both ld.so and libdl. Additionally, rename it to DL_OPENED2 for clarity.
Signed-off-by: Leonid Lisovskiy lly.dev@gmail.com
commit fcbbde85024f494d7ba573bf8a4474755452efdd Author: Eugeniy Paltsev Eugeniy.Paltsev@synopsys.com Date: Tue Jun 21 14:19:05 2016 +0300
test: inet: Fix warning messages
This patch is to address a proposal by Waldemar in this thread: http://mailman.uclibc-ng.org/pipermail/devel/2016-June/001006.html tst-ethers-line and tst-ethers require /etc/ethers to exist, otherwise user should create it manually. Add this info to warning message.
Signed-off-by: Eugeniy Paltsev Eugeniy.Paltsev@synopsys.com
commit 35adc1fa7fbecea572afaf829a33454da0f764b0 Author: Wenzel, Alexander alexander.wenzel@qsc.de Date: Tue Jun 21 15:49:54 2016 +0000
inet/getaddrinfo: fix AF_V4MAPPED behavior for non IPv6 host resolution
When trying to resolve a hostname by getaddrinfo() using some specific settings, it will always return -EAI_NONAME (Name or service not known).
To reproduce this behavior, you need to request an IPv6 address with the additional AF_V4MAPPED flag set from an non IPv6 capable hostname. If you choose a IPv4/IPv6 capable hostname like google.com, everything works fine.
This patch is more or less a port [1][2] from the glibc and their behavior for the AF_V4MAPPED flag. To test the bug you can use the following snippet.
---- 8< ----
int ret; struct addrinfo* result; struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_INET6; hints.ai_flags = AI_V4MAPPED;
ret = getaddrinfo("test.com", NULL, &hints, &result); printf("getaddrinfo(): %i", ret);
---- 8< ----
[1] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo... [2] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo...
Signed-off-by: Alexander Wenzel alexander.wenzel@qsc.de
commit e3848e3dd64a8d6437531488fe341354bc02eaed Author: Lucian Cojocar lucian.cojocar@vu.nl Date: Fri Jun 10 18:44:44 2016 +0200
bugfix: ARM: memset.S: use unsigned comparisons
The 'BLT' instruction checks for *signed* values. So if a3, length parameter of memset, is negative, then value added to the PC will be large.
memset(buf, 0xaa, 0xffff0000) triggers the bug.
GDB session without the patch:
""" $ gdb ./main-buggy-memset.elf -q Reading symbols from ./main-buggy-memset.elf...done. (gdb) x/i memset 0x8770 <memset>: mov r3, r0 (gdb) r Starting program: /root/memset/main-buggy-memset.elf
Program received signal SIGSEGV, Segmentation fault. 0x00048808 in ?? () """
The $pc is outside of the memset function because:
""" (gdb) x/i $pc => 0x87e4 <memset+116>: add pc, pc, r2, lsl #2 (gdb) info reg $r2 r2 0x10007 65543 """
GDB session with the bug fixed (patch applied):
""" $ gdb ./main-fixed-memset.elf -q Reading symbols from ./main-fixed-memset.elf...done. (gdb) x/i memset 0x8770 <memset>: mov r3, r0 (gdb) r Starting program: /root/memset/main-fixed-memset.elf
Program received signal SIGSEGV, Segmentation fault. memset () at libc/string/arm/memset.S:92 92 libc/string/arm/memset.S: No such file or directory. (gdb) x/i $pc => 0x87b0 <memset+64>: stmia r3!, {r1, r12} (gdb) info reg $r3 r3 0x15000 86016 (gdb) info proc mappings process 5822 Mapped address spaces:
Start Addr End Addr Size Offset objfile 0x8000 0xb000 0x3000 0x0 /root/memset/main-fixed-memset.elf 0x12000 0x15000 0x3000 0x2000 /root/memset/main-fixed-memset.elf 0xb6fff000 0xb7000000 0x1000 0x0 [sigpage] 0xbefdf000 0xbf000000 0x21000 0x0 0xffff0000 0xffff1000 0x1000 0x0 [vectors] (gdb) info reg $sp sp 0x14d78 0x14d78 """
GDB crashes inside the memset function, on the store instruction. This time the crash is (as expected) because of a memory access imediately after the memory region that contains the stack -- the buffer that's being memset'd is allocated on the stack.
Signed-off-by: Lucian Cojocar lucian.cojocar@vu.nl
-----------------------------------------------------------------------
Summary of changes: Rules.mak | 2 ++ ldso/include/dl-hash.h | 2 +- ldso/ldso/dl-elf.c | 3 ++ ldso/ldso/ldso.c | 8 +++-- ldso/libdl/Makefile.in | 2 ++ ldso/libdl/libdl.c | 8 ++--- libc/Makefile.in | 4 +++ libc/inet/getaddrinfo.c | 16 +++++++-- libc/inet/resolv.c | 12 +++++-- libc/signal/sigsetops.c | 2 +- libc/string/arm/memset.S | 20 +++++------ libc/sysdeps/linux/arc/crt1.S | 23 +++++++++++-- libc/sysdeps/linux/common/bits/sigset.h | 14 +++----- libcrypt/Makefile.in | 4 +++ libintl/Makefile.in | 4 +++ libm/Makefile.in | 4 +++ libnsl/Makefile.in | 2 ++ libpthread/linuxthreads/Makefile.in | 2 ++ libpthread/nptl/Makefile.in | 2 ++ libresolv/Makefile.in | 2 ++ librt/Makefile.in | 2 ++ libubacktrace/Makefile.in | 4 +++ libutil/Makefile.in | 4 +++ test/dlopen/Makefile.in | 4 ++- test/dlopen/nodelete1.c | 59 +++++++++++++++++++++++++++++++++ test/inet/tst-ethers-line.c | 5 +-- test/inet/tst-ethers.c | 6 +++- 27 files changed, 180 insertions(+), 40 deletions(-) create mode 100644 test/dlopen/nodelete1.c
diff --git a/Rules.mak b/Rules.mak index 207c4ec..3e4e6c0 100644 --- a/Rules.mak +++ b/Rules.mak @@ -303,6 +303,7 @@ ifneq ($(TARGET_ARCH),nios2) ifneq ($(TARGET_ARCH),sh) ifneq ($(TARGET_ARCH),c6x) ifneq ($(TARGET_ARCH),h8300) +ifneq ($(TARGET_ARCH),arc) CPU_CFLAGS-y += -msoft-float endif endif @@ -311,6 +312,7 @@ endif endif endif endif +endif
$(eval $(call check-gcc-var,-std=gnu99)) CPU_CFLAGS-y += $(CFLAG_-std=gnu99) diff --git a/ldso/include/dl-hash.h b/ldso/include/dl-hash.h index d6282bb..bdb999a 100644 --- a/ldso/include/dl-hash.h +++ b/ldso/include/dl-hash.h @@ -153,7 +153,7 @@ struct elf_resolve { #define JMP_RELOCS_DONE 0x000002 #define INIT_FUNCS_CALLED 0x000004 #define FINI_FUNCS_CALLED 0x000008 -#define DL_OPENED 0x000010 +#define DL_OPENED2 0x000010 #define DL_RESERVED 0x000020
extern struct dyn_elf * _dl_symbol_tables; diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 04e8c60..a046aeb 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -546,6 +546,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned int rflags, if (tpnt->st_dev == st.st_dev && tpnt->st_ino == st.st_ino) { /* Already loaded */ tpnt->usage_count++; + tpnt->init_flag |= DL_OPENED2; _dl_close(infile); return tpnt; } @@ -883,6 +884,8 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned int rflags, #endif (*rpnt)->dyn = tpnt; tpnt->usage_count++; + if (tpnt->rtld_flags & RTLD_NODELETE) + tpnt->usage_count++; #ifdef __LDSO_STANDALONE_SUPPORT__ tpnt->libtype = (epnt->e_type == ET_DYN) ? elf_lib : elf_executable; #else diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 7bb6a34..4e8a49e 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -905,7 +905,7 @@ of this helper program; chances are you did not intend to run this program.\n\
#ifdef __LDSO_LDD_SUPPORT__ if (trace_loaded_objects && !_dl_trace_prelink && - tpnt1->usage_count == 1) { + !(tpnt1->init_flag & DL_OPENED2)) { /* This is a real hack to make * ldd not print the library * itself when run on a @@ -997,7 +997,7 @@ of this helper program; chances are you did not intend to run this program.\n\
# ifdef __LDSO_LDD_SUPPORT__ if (trace_loaded_objects && !_dl_trace_prelink && - tpnt1->usage_count == 1) { + !(tpnt1->init_flag & DL_OPENED2)) { _dl_dprintf(1, "\t%s => %s (%x)\n", cp2, tpnt1->libname, DL_LOADADDR_BASE(tpnt1->loadaddr)); @@ -1034,6 +1034,8 @@ of this helper program; chances are you did not intend to run this program.\n\ /* Insert the ld.so only once */ ldso_tpnt = add_ldso(tpnt, load_addr, ldso_mapaddr, auxvt, rpnt); + } else { + ldso_tpnt->init_flag |= DL_OPENED2; } ldso_tpnt->usage_count++; tpnt1 = ldso_tpnt; @@ -1064,7 +1066,7 @@ of this helper program; chances are you did not intend to run this program.\n\
#ifdef __LDSO_LDD_SUPPORT__ if (trace_loaded_objects && !_dl_trace_prelink && - tpnt1->usage_count == 1) { + !(tpnt1->init_flag & DL_OPENED2)) { _dl_dprintf(1, "\t%s => %s (%x)\n", lpntstr, tpnt1->libname, DL_LOADADDR_BASE(tpnt1->loadaddr)); diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in index fe1eb9d..1ba8770 100644 --- a/ldso/libdl/Makefile.in +++ b/ldso/libdl/Makefile.in @@ -48,6 +48,8 @@ objclean-y += CLEAN_ldso/libdl
$(top_builddir)lib/libdl.so: $(libdl_OUT)/libdl_so.a $(libc.depend) $(call link.so,$(libdl_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libdl_FULL_NAME),0)
$(libdl_OUT)/libdl_so.a: $(libdl-so-y) $(Q)$(RM) $@ diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 42a09a8..0cf3b70 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -396,7 +396,7 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr) from) dyn_chain->next_handle = _dl_handles; _dl_handles = dyn_ptr = dyn_chain;
- if (tpnt->usage_count > 1) { + if (tpnt->init_flag & DL_OPENED2) { _dl_if_debug_print("Lib: %s already opened\n", libname); /* see if there is a handle from a earlier dlopen */ for (handle = _dl_handles->next_handle; handle; handle = handle->next_handle) { @@ -412,8 +412,6 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr) from) return dyn_chain; }
- tpnt->init_flag |= DL_OPENED; - _dl_if_debug_print("Looking for needed libraries\n"); nlist = 0; runp = alloca(sizeof(*runp)); @@ -820,7 +818,7 @@ static int do_dlclose(void *vhandle, int need_fini) _dl_handles = rpnt->next_handle; _dl_if_debug_print("%s: usage count: %d\n", handle->dyn->libname, handle->dyn->usage_count); - if (handle->dyn->usage_count != 1 || (handle->dyn->rtld_flags & RTLD_NODELETE)) { + if (handle->dyn->usage_count != 1) { handle->dyn->usage_count--; free(handle); return 0; @@ -842,7 +840,7 @@ static int do_dlclose(void *vhandle, int need_fini) for (j = 0; j < handle->init_fini.nlist; ++j) { tpnt = handle->init_fini.init_fini[j]; tpnt->usage_count--; - if (tpnt->usage_count == 0 && !(tpnt->rtld_flags & RTLD_NODELETE)) { + if (tpnt->usage_count == 0) { if ((tpnt->dynamic_info[DT_FINI] || tpnt->dynamic_info[DT_FINI_ARRAY]) && need_fini diff --git a/libc/Makefile.in b/libc/Makefile.in index 2abc77d..8ed8a75 100644 --- a/libc/Makefile.in +++ b/libc/Makefile.in @@ -60,9 +60,13 @@ OUTPUT_FORMAT = $(CC) $(CFLAGS) -Wl,--verbose 2>&1 | $(SED) -n '/OUTPUT_FORMAT/, ifeq ($(DOMULTI),n) $(libc.depend): $(libc_OUT)/libc_so.a $(LIBS-libc.so) $(call link.so,$(libc_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libc_FULL_NAME),0) else $(libc.depend): $(libc_OUT)/libc.oS $(libc-nomulti-y:.o=.oS) | $(LIBS-libc.so) $(call linkm.so,$(libc_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call linkm.so,$(libc_FULL_NAME),0) endif $(Q)$(RM) $@ $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index 7ae32be..a9000ae 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -391,6 +391,9 @@ static uint8_t __gai_precedence = 0; /* =1 - IPv6, IPv4 memcpy((*pat)->addr, h->h_addr_list[i], sizeof(_type)); \ pat = &((*pat)->next); \ } \ + if (_family == AF_INET6 && i > 0) { \ + got_ipv6 = true; \ + } \ } \ }
@@ -404,6 +407,7 @@ gaih_inet(const char *name, const struct gaih_service *service, struct gaih_servtuple *st; struct gaih_addrtuple *at; int rc; + bool got_ipv6 = false; int v4mapped = req->ai_family == PF_INET6 && (req->ai_flags & AI_V4MAPPED); unsigned seen = 0; if (req->ai_flags & AI_ADDRCONFIG) { @@ -586,7 +590,7 @@ gaih_inet(const char *name, const struct gaih_service *service, #endif if (req->ai_family == AF_INET || (!v4mapped && req->ai_family == AF_UNSPEC) - || (v4mapped && (no_inet6_data != 0 || (req->ai_flags & AI_ALL))) + || (v4mapped && (!got_ipv6 || (req->ai_flags & AI_ALL))) ) { if (!(req->ai_flags & AI_ADDRCONFIG) || (seen & SEEN_IPV4)) gethosts(AF_INET, struct in_addr); @@ -705,6 +709,14 @@ gaih_inet(const char *name, const struct gaih_service *service, if (at2->family == AF_INET6 || v4mapped) { family = AF_INET6; socklen = sizeof(struct sockaddr_in6); + + /* If we looked up IPv4 mapped address discard them here if + the caller isn't interested in all address and we have + found at least one IPv6 address. */ + if (got_ipv6 + && (req->ai_flags & (AI_V4MAPPED|AI_ALL)) == AI_V4MAPPED + && IN6_IS_ADDR_V4MAPPED (at2->addr)) + goto ignore; } #endif #if defined __UCLIBC_HAS_IPV4__ && defined __UCLIBC_HAS_IPV6__ @@ -781,7 +793,7 @@ gaih_inet(const char *name, const struct gaih_service *service, (*pai)->ai_next = NULL; pai = &((*pai)->ai_next); } - +ignore: at2 = at2->next; } } diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index e3ad513..d380d44 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1266,6 +1266,7 @@ int __dns_lookup(const char *name, int local_id = local_id; /* for compiler */ int sdomains = 0; bool ends_with_dot; + bool contains_dot; sockaddr46_t sa;
fd = -1; @@ -1277,12 +1278,14 @@ int __dns_lookup(const char *name, if (!packet || !lookup || !name[0]) goto fail; ends_with_dot = (name[name_len - 1] == '.'); + contains_dot = strchr(name, '.') != NULL; /* no strcpy! paranoia, user might change name[] under us */ memcpy(lookup, name, name_len);
DPRINTF("Looking up type %d answer for '%s'\n", type, name); retries_left = 0; /* for compiler */ do { + unsigned act_variant; int pos; unsigned reply_timeout;
@@ -1306,11 +1309,16 @@ int __dns_lookup(const char *name, sdomains = __searchdomains; } lookup[name_len] = '\0'; - if ((unsigned)variant < sdomains) { + /* For qualified names, act_variant = MAX_UINT, 0, .., sdomains-1 + * => Try original name first, then append search domains + * For names without domain, act_variant = 0, 1, .., sdomains + * => Try search domains first, original name last */ + act_variant = contains_dot ? variant : variant + 1; + if (act_variant < sdomains) { /* lookup is name_len + 1 + MAXLEN_searchdomain + 1 long */ /* __searchdomain[] is not bigger than MAXLEN_searchdomain */ lookup[name_len] = '.'; - strcpy(&lookup[name_len + 1], __searchdomain[variant]); + strcpy(&lookup[name_len + 1], __searchdomain[act_variant]); } /* first time? pick starting server etc */ if (local_ns_num < 0) { diff --git a/libc/signal/sigsetops.c b/libc/signal/sigsetops.c index fa5fe6a..da5803e 100644 --- a/libc/signal/sigsetops.c +++ b/libc/signal/sigsetops.c @@ -3,7 +3,7 @@
#include <features.h>
-#define __PROVIDE_OUT_OF_LINE_SIGSETFN +#define _EXTERN_INLINE #ifndef __USE_EXTERN_INLINES # define __USE_EXTERN_INLINES 1 #endif diff --git a/libc/string/arm/memset.S b/libc/string/arm/memset.S index 2be4850..412270f 100644 --- a/libc/string/arm/memset.S +++ b/libc/string/arm/memset.S @@ -67,7 +67,7 @@ memset: memset: mov a4, a1 cmp a3, $8 @ at least 8 bytes to do? - blt 2f + blo 2f orr a2, a2, a2, lsl $8 orr a2, a2, a2, lsl $16 1: @@ -84,27 +84,27 @@ memset: mov ip, a2 1: cmp a3, $8 @ 8 bytes still to do? - blt 2f + blo 2f stmia a4!, {a2, ip} sub a3, a3, $8 cmp a3, $8 @ 8 bytes still to do? - blt 2f + blo 2f stmia a4!, {a2, ip} sub a3, a3, $8 cmp a3, $8 @ 8 bytes still to do? - blt 2f + blo 2f stmia a4!, {a2, ip} sub a3, a3, $8 cmp a3, $8 @ 8 bytes still to do? #if defined(__thumb2__) - itt ge - stmiage a4!, {a2, ip} - subge a3, a3, $8 + itt hs + stmiahs a4!, {a2, ip} + subhs a3, a3, $8 #else - stmgeia a4!, {a2, ip} - subge a3, a3, $8 + stmhsia a4!, {a2, ip} + subhs a3, a3, $8 #endif - bge 1b + bhs 1b 2: movs a3, a3 @ anything left? IT(t, eq) diff --git a/libc/sysdeps/linux/arc/crt1.S b/libc/sysdeps/linux/arc/crt1.S index 95c41f8..178c5b4 100644 --- a/libc/sysdeps/linux/arc/crt1.S +++ b/libc/sysdeps/linux/arc/crt1.S @@ -41,11 +41,15 @@ __start:
mov_s r5, r0 ; rltd_fini add_s r2, sp, 4 ; argv - +#ifdef L_Scrt1 + add r0, pcl, @main@pcl + add r3, pcl, @_init@pcl + add r4, pcl, @_fini@pcl +#else mov_s r0, main mov_s r3, _init mov r4, _fini - +#endif and sp, sp, -8 mov r6, sp
@@ -55,3 +59,18 @@ __start: /* Should never get here.... */ flag 1 .size __start,.-__start + +/* Implement a .note.ABI-tag section that is mandatory for Linux executables + according to LSB. See: + https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/noteabitag.html. + Also: libc/sysdeps/linux/avr32/crt1.S. */ +.section ".note.ABI-tag", "a" + .align 4 + .long 1f - 0f /* Name length */ + .long 3f - 2f /* Data length */ + .long 1 /* Note type */ +0: .asciz "GNU" /* Vendor name */ +1: .align 4 +2: .long 0 /* Note data: Linux executable */ + .long 3,9,0 /* Earliest compatible kernel */ +3: .align 4 /* Pad out section */ diff --git a/libc/sysdeps/linux/common/bits/sigset.h b/libc/sysdeps/linux/common/bits/sigset.h index f220e81..2c9fe74 100644 --- a/libc/sysdeps/linux/common/bits/sigset.h +++ b/libc/sysdeps/linux/common/bits/sigset.h @@ -52,6 +52,10 @@ typedef struct { #if !defined _SIGSET_H_fns && defined _SIGNAL_H # define _SIGSET_H_fns 1
+# ifndef _EXTERN_INLINE +# define _EXTERN_INLINE __extern_inline +# endif + /* Return a mask that includes the bit for SIG only. */ /* Unsigned cast ensures shift/mask insns are used. */ # define __sigmask(sig) \ @@ -151,24 +155,14 @@ typedef struct { /* These functions needn't check for a bogus signal number -- error checking is done in the non __ versions. */
-# if !defined __USE_EXTERN_INLINES || defined __PROVIDE_OUT_OF_LINE_SIGSETFN extern int __sigismember (const __sigset_t *, int); libc_hidden_proto(__sigismember) extern void __sigaddset (__sigset_t *, int); libc_hidden_proto(__sigaddset) extern void __sigdelset (__sigset_t *, int); libc_hidden_proto(__sigdelset) -# endif
# ifdef __USE_EXTERN_INLINES -# undef _EXTERN_INLINE -# ifdef __PROVIDE_OUT_OF_LINE_SIGSETFN -# define _EXTERN_INLINE -# else /* normal case */ - /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES - * will have its own copy of out-of line function emitted. */ -# define _EXTERN_INLINE /*extern*/ __always_inline -# endif # define __SIGSETFN(RET_TYPE, NAME, BODY, CONST) \ _EXTERN_INLINE RET_TYPE \ NAME (CONST __sigset_t *__set, int __sig) \ diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in index 94753f4..94feacb 100644 --- a/libcrypt/Makefile.in +++ b/libcrypt/Makefile.in @@ -46,9 +46,13 @@ else $(top_builddir)lib/libcrypt.so: $(libcrypt_OUT)/libcrypt_so.a $(libc.depend) endif $(call link.so,$(libcrypt_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libcrypt_FULL_NAME),0) else $(top_builddir)lib/libcrypt.so: $(libcrypt_OUT)/libcrypt.oS | $(libc.depend) $(call linkm.so,$(libcrypt_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call linkm.so,$(libcrypt_FULL_NAME),0) endif
$(libcrypt_OUT)/libcrypt_so.a: $(libcrypt-so-y) diff --git a/libintl/Makefile.in b/libintl/Makefile.in index 22ae70c..39b39a5 100644 --- a/libintl/Makefile.in +++ b/libintl/Makefile.in @@ -48,9 +48,13 @@ else $(top_builddir)lib/libintl.so: $(libintl_OUT)/libintl_so.a $(libc.depend) endif $(call link.so,$(libintl_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libintl_FULL_NAME),0) else $(top_builddir)lib/libintl.so: $(libintl_OUT)/libintl.oS | $(libc.depend) $(call linkm.so,$(libintl_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call linkm.so,$(libintl_FULL_NAME),0) endif
$(libintl_OUT)/libintl_so.a: $(libintl-so-y) diff --git a/libm/Makefile.in b/libm/Makefile.in index 835e7bf..2880512 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -305,9 +305,13 @@ else $(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a $(libc.depend) endif $(call link.so,$(libm_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libm_FULL_NAME),0) else $(top_builddir)lib/libm.so: $(libm_OUT)/libm.oS | $(libc.depend) $(call linkm.so,$(libm_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call linkm.so,$(libm_FULL_NAME),0) endif
$(libm_OUT)/libm_so.a: $(libm-so-y) diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in index 333c490..e79268c 100644 --- a/libnsl/Makefile.in +++ b/libnsl/Makefile.in @@ -39,6 +39,8 @@ else $(top_builddir)lib/libnsl.so: $(libnsl_OUT)/libnsl_so.a $(libc.depend) endif $(call link.so,$(libnsl_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libnsl_FULL_NAME),0)
$(libnsl_OUT)/libnsl_so.a: $(libnsl-so-y) $(Q)$(RM) $@ diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in index ffa60c7..5b7d559 100644 --- a/libpthread/linuxthreads/Makefile.in +++ b/libpthread/linuxthreads/Makefile.in @@ -69,6 +69,8 @@ lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libpthread_FULL_NAME),0)
ifeq ($(PTHREADS_DEBUG_SUPPORT),y) $(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index 8261fce..f0d5ad6 100644 --- a/libpthread/nptl/Makefile.in +++ b/libpthread/nptl/Makefile.in @@ -76,6 +76,8 @@ lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(libdl.depend) $(top_builddir)lib/libpthread_nonshared.a $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libpthread_FULL_NAME),0) $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp $(Q)mv $@.tmp $@ diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in index fa3c341..89ef4f7 100644 --- a/libresolv/Makefile.in +++ b/libresolv/Makefile.in @@ -39,6 +39,8 @@ else $(top_builddir)lib/libresolv.so: $(libresolv_OUT)/libresolv_so.a $(libc.depend) endif $(call link.so,$(libresolv_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libresolv_FULL_NAME),0)
$(libresolv_OUT)/libresolv_so.a: $(libresolv-so-y) $(Q)$(RM) $@ diff --git a/librt/Makefile.in b/librt/Makefile.in index 1536a5c..88f15f9 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -73,6 +73,8 @@ else $(top_builddir)lib/librt.so: $(librt_OUT)/librt_so.a $(librt-dep-y) endif $(call link.so,$(librt_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(librt_FULL_NAME),0)
$(librt_OUT)/librt_so.a: $(librt-so-y) $(Q)$(RM) $@ diff --git a/libubacktrace/Makefile.in b/libubacktrace/Makefile.in index 311f1e3..587eaf6 100644 --- a/libubacktrace/Makefile.in +++ b/libubacktrace/Makefile.in @@ -62,9 +62,13 @@ objclean-y += CLEAN_libubacktrace ifeq ($(DOMULTI),n) $(top_builddir)lib/libubacktrace.so: $(libubacktrace_OUT)/libubacktrace_so.a $(libdl.depend) $(call link.so,$(libubacktrace_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libubacktrace_FULL_NAME),0) else $(top_builddir)lib/libubacktrace.so: $(libubacktrace_OUT)/libubacktrace.oS | $(libdl.depend) $(call linkm.so,$(libubacktrace_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call linkm.so,$(libubacktrace_FULL_NAME),0) endif
$(libubacktrace_OUT)/libubacktrace_so.a: $(libubacktrace-so-y) diff --git a/libutil/Makefile.in b/libutil/Makefile.in index 98b178e..7759482 100644 --- a/libutil/Makefile.in +++ b/libutil/Makefile.in @@ -55,9 +55,13 @@ else $(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil_so.a $(libc.depend) endif $(call link.so,$(libutil_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call link.so,$(libutil_FULL_NAME),0) else $(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil.oS | $(libc.depend) $(call linkm.so,$(libutil_FULL_NAME),$(ABI_VERSION)) + # link for backward compatibility + $(call linkm.so,$(libutil_FULL_NAME),0) endif
$(libutil_OUT)/libutil_so.a: $(libutil-so-y) diff --git a/test/dlopen/Makefile.in b/test/dlopen/Makefile.in index 0bed0f7..740453a 100644 --- a/test/dlopen/Makefile.in +++ b/test/dlopen/Makefile.in @@ -5,7 +5,7 @@ export UCLIBC_ONLY := 1
TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr \ - testscope nodelete tst-origin + testscope nodelete nodelete1 tst-origin
ifneq ($(HAVE_SHARED),y) TESTS_DISABLED := test3 @@ -80,3 +80,5 @@ LDFLAGS_nodelete := -rdynamic -ldl LDFLAGS_nodelmod1.so := -Wl,-z,nodelete LDFLAGS_nodelmod3.so := ./nodelmod4.so LDFLAGS_nodelmod4.so := -Wl,-z,nodelete +nodelete1: nodelmod1.so nodelmod2.so +LDFLAGS_nodelete1 := -rdynamic -ldl diff --git a/test/dlopen/nodelete1.c b/test/dlopen/nodelete1.c new file mode 100644 index 0000000..720e37f --- /dev/null +++ b/test/dlopen/nodelete1.c @@ -0,0 +1,59 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + + +int fini_ran; + +#define LIBNAME1 "nodelmod1.so" + +static int +do_test (void) +{ + /* Verify ability to reload RTLD_NODELETE libraries. + */ + void *p; + + p = dlopen (LIBNAME1, RTLD_NOW); + if (p == NULL) + { + printf ("failed to load "LIBNAME1": %s\n", dlerror ()); + exit (1); + } + + if (dlclose (p) != 0) + { + puts ("failed to close "LIBNAME1""); + exit (1); + } + + p = dlopen (LIBNAME1, RTLD_LAZY); + if (p == NULL) + { + printf ("failed to load "LIBNAME1": %s\n", dlerror ()); + exit (1); + } + + if (dlclose (p) != 0) + { + puts ("failed to close "LIBNAME1""); + exit (1); + } + + p = dlopen ("nodelmod2.so", RTLD_LAZY); + if (p == NULL) + { + printf ("failed to load "nodelmod2.so": %s\n", dlerror ()); + exit (1); + } + if (dlclose (p) != 0) + { + puts ("failed to close "nodelmod2.so""); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/inet/tst-ethers-line.c b/test/inet/tst-ethers-line.c index 19cf2fb..182faf0 100644 --- a/test/inet/tst-ethers-line.c +++ b/test/inet/tst-ethers-line.c @@ -14,7 +14,8 @@ #define ETHER_LINE_LEN 256
/* This test requires /etc/ethers to exist - * and to have nonzero length + * and to have nonzero length. You should create it manually, + * if it doesn't exist. */
int main(void) @@ -26,7 +27,7 @@ int main(void) struct stat statb;
if ((fd = open(ETHER_FILE_NAME, O_RDONLY)) == -1) { - perror ("Cannot open file"); + perror ("Cannot open file /etc/ethers"); exit(1); }
diff --git a/test/inet/tst-ethers.c b/test/inet/tst-ethers.c index 6b6e10c..f12813a 100644 --- a/test/inet/tst-ethers.c +++ b/test/inet/tst-ethers.c @@ -6,6 +6,8 @@ /* This test requires /etc/ethers to exist * and to have host "teeth". For example: * 00:11:22:33:44:55 teeth + * You should create /etc/ethers file with + * host "teeth" manually, if it doesn't exist. */
int main(void) @@ -15,8 +17,10 @@ int main(void) int i; int res = ether_hostton("teeth", &addr);
- if (res) + if (res) { + printf("Either /etc/ethers is missing or it has incorrect contents\n"); return 1; + }
for (i = 0; i < 6; i++) { printf("%02x", addr.ether_addr_octet[i]);
hooks/post-receive