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 a0c37f580fe1017abb312fb2fe030ac1d512a98f (commit)
via 2b83082c20d38b6ff170f63e60c95510e9a640b9 (commit)
via f5ff52245ff9f260ebdfc011315066446eeb729c (commit)
via d08f12d953074158178570bf54ff41347613412a (commit)
via 03c9955453af2342492f7f194c6d15eaa504556b (commit)
via 02e1e05c2fb1ec4c0c4aa71028075dbe7d94ca91 (commit)
via b6b6caea9272ff526033f367811b6618b1b620ed (commit)
via bb01edff0377f2585ce304ecbadcb7b6cde372ac (commit)
via 16719c1a7078421928e6d31dd1dec574825ef515 (commit)
via e0ec7f10294250e575b475f5dfe9b5942b0e81e5 (commit)
via 4002a85b077c23d53a9141885fea62157e11e698 (commit)
from 42a40fb3b2bfdf70878b28265a681f7339191660 (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 a0c37f580fe1017abb312fb2fe030ac1d512a98f
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Sat Jan 30 10:37:44 2016 +0100
mips: fix clashing symbols
ISC bind9 uses ptrsize, better use something else.
Reported-By: Gustavo Zacarias <gustavo(a)zacarias.com.ar>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit 2b83082c20d38b6ff170f63e60c95510e9a640b9
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Fri Jan 29 09:32:21 2016 +0100
mips64: fix memcpy, patch from glibc
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit f5ff52245ff9f260ebdfc011315066446eeb729c
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Mon Jan 25 21:27:44 2016 +0100
add $ORIGIN test-case
Signed-off-by: Leonid Lisovskiy <lly.dev(a)gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit d08f12d953074158178570bf54ff41347613412a
Author: Leonid Lisovskiy <lly.dev(a)gmail.com>
Date: Tue Jan 26 20:12:58 2016 +0300
ldso: Use single rtld_flags interpretation through all the calls
Implement single rtld_flags interpretation through all the
do_dlopen()/_dl_load_shared_library()/_dl_load_elf_shared_library()
calls chain.
This adds the ability to use the flags, passed to dlopen(), in all
underlaying functions and implement rtld_flags inheritance.
Saves a few bytes code.
Signed-off-by: Leonid Lisovskiy <lly.dev(a)gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit 03c9955453af2342492f7f194c6d15eaa504556b
Author: Leonid Lisovskiy <lly.dev(a)gmail.com>
Date: Tue Jan 26 20:12:57 2016 +0300
ldso: Fix fail of $ORIGIN expansion in case of RTLD_NOLOAD
$ORIGIN expansion in search_for_named_library() wrongly
takes into account all bits of rflags.
Signed-off-by: Leonid Lisovskiy <lly.dev(a)gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit 02e1e05c2fb1ec4c0c4aa71028075dbe7d94ca91
Author: Leonid Lisovskiy <lly.dev(a)gmail.com>
Date: Sat Jan 23 23:26:56 2016 +0300
Provide __adjtimex() alias, like glibc.
Althought recent versions of sofware don't require it, old ntpd
wants - see
http://bugs.ntp.org/show_bug.cgi?id=769
Signed-off-by: Leonid Lisovskiy <lly.dev(a)gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit b6b6caea9272ff526033f367811b6618b1b620ed
Author: Leonid Lisovskiy <lly.dev(a)gmail.com>
Date: Fri Jan 22 22:02:49 2016 +0300
tests: Extend OMIT LDFLAGS logic to test binaries too
In continue of 72215487 "tests: add OMIT logic to remove compilation flag."
commit.
Signed-off-by: Leonid Lisovskiy <lly.dev(a)gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit bb01edff0377f2585ce304ecbadcb7b6cde372ac
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Mon Jan 25 21:11:34 2016 +0100
Make sure to always terminate decoded string
Write a terminating '\0' to dest when the first byte of the encoded data
is 0. This corner case was previously missed.
Signed-off-by: Daniel Fahlgren <daniel(a)fahlgren.se>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit 16719c1a7078421928e6d31dd1dec574825ef515
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Jan 17 15:47:22 2016 +0100
Do not follow compressed items forever.
It is possible to get stuck in an infinite loop when receiving a
specially crafted DNS reply. Exit the loop after a number of iteration
and consider the packet invalid.
Signed-off-by: Daniel Fahlgren <daniel(a)fahlgren.se>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit e0ec7f10294250e575b475f5dfe9b5942b0e81e5
Author: Leonid Lisovskiy <lly.dev(a)gmail.com>
Date: Wed Jan 13 21:00:05 2016 +0300
libdl: dlopen() mustn't forget RTLD_NODELETE flag
If RTLD_NODELETE is passed to dlopen() rather than set on shared
library itself, flag propagation to rtld_flags is missed.
Test-case taken from glibc.
Signed-off-by: Leonid Lisovskiy <lly.dev(a)gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
commit 4002a85b077c23d53a9141885fea62157e11e698
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Sat Jan 30 10:36:17 2016 +0100
add exp10() from glibc
Some software make use of exp10, so add it.
Basic testing with LTP.
Signed-off-by: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
-----------------------------------------------------------------------
Summary of changes:
include/dlfcn.h | 3 +
include/sys/timex.h | 2 -
ldso/include/dl-elf.h | 7 +-
ldso/ldso/dl-elf.c | 16 ++-
ldso/ldso/ldso.c | 5 +-
ldso/libdl/libdl.c | 12 +-
libc/inet/resolv.c | 6 +-
libc/string/mips/memcpy.S | 2 +-
libc/sysdeps/linux/common/adjtimex.c | 1 +
libc/sysdeps/linux/common/bits/mathcalls.h | 6 +-
libc/sysdeps/linux/mips/bits/setjmp.h | 12 +-
libc/sysdeps/linux/mips/setjmp_aux.c | 6 +-
libm/Makefile.in | 4 +-
libc/signal/sigignore.c => libm/e_exp10.c | 26 ++--
libm/math_private.h | 1 +
test/Test.mak | 5 +-
test/dlopen/Makefile.in | 19 ++-
test/dlopen/nodelete.c | 205 ++++++++++++++++++++++++++++
test/dlopen/nodelmod1.c | 10 ++
test/dlopen/nodelmod2.c | 10 ++
test/dlopen/nodelmod3.c | 8 ++
test/dlopen/nodelmod4.c | 10 ++
test/dlopen/{test2.c => tst-origin.c} | 22 ++-
23 files changed, 330 insertions(+), 68 deletions(-)
copy libc/signal/sigignore.c => libm/e_exp10.c (63%)
create mode 100644 test/dlopen/nodelete.c
create mode 100644 test/dlopen/nodelmod1.c
create mode 100644 test/dlopen/nodelmod2.c
create mode 100644 test/dlopen/nodelmod3.c
create mode 100644 test/dlopen/nodelmod4.c
copy test/dlopen/{test2.c => tst-origin.c} (51%)
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 241ec54..74825aa 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -26,6 +26,9 @@
/* Collect various system dependent definitions and declarations. */
#include <bits/dlfcn.h>
+/* Internally used flag. */
+#define __RTLD_SECURE 0x04000000 /* Apply additional security checks. */
+
#ifdef __USE_GNU
/* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT
diff --git a/include/sys/timex.h b/include/sys/timex.h
index 57059bd..4cb81d2 100644
--- a/include/sys/timex.h
+++ b/include/sys/timex.h
@@ -120,9 +120,7 @@ struct timex
__BEGIN_DECLS
-#if 0
extern int __adjtimex (struct timex *__ntx) __THROW;
-#endif
extern int adjtimex (struct timex *__ntx) __THROW;
libc_hidden_proto(adjtimex)
diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h
index 4cc9b2b..57f0ddc 100644
--- a/ldso/include/dl-elf.h
+++ b/ldso/include/dl-elf.h
@@ -29,18 +29,15 @@ static __inline__ void _dl_map_cache(void) { }
static __inline__ void _dl_unmap_cache(void) { }
#endif
-#define DL_RESOLVE_SECURE 0x0001
-#define DL_RESOLVE_NOLOAD 0x0002
-
/* Function prototypes for non-static stuff in elfinterp.c */
extern void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
unsigned long rel_addr, unsigned long rel_size);
extern int _dl_parse_relocation_information(struct dyn_elf *rpnt,
struct r_scope_elem *scope, unsigned long rel_addr, unsigned long rel_size);
-extern struct elf_resolve * _dl_load_shared_library(unsigned rflags,
+extern struct elf_resolve * _dl_load_shared_library(unsigned int rflags,
struct dyn_elf **rpnt, struct elf_resolve *tpnt, char *full_libname,
int trace_loaded_objects);
-extern struct elf_resolve * _dl_load_elf_shared_library(unsigned rflags,
+extern struct elf_resolve * _dl_load_elf_shared_library(unsigned int rflags,
struct dyn_elf **rpnt, const char *libname);
extern int _dl_linux_resolve(void);
extern int _dl_fixup(struct dyn_elf *rpnt, struct r_scope_elem *scope, int flag);
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 01b29da..04e8c60 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -132,7 +132,7 @@ _dl_protect_relro (struct elf_resolve *l)
/* This function's behavior must exactly match that
* in uClibc/ldso/util/ldd.c */
static struct elf_resolve *
-search_for_named_library(const char *name, unsigned rflags, const char *path_list,
+search_for_named_library(const char *name, unsigned int rflags, const char *path_list,
struct dyn_elf **rpnt, const char* origin)
{
char *mylibname;
@@ -162,7 +162,9 @@ search_for_named_library(const char *name, unsigned rflags, const char
*path_lis
if (plen >= 7 && _dl_memcmp(p, "$ORIGIN", 7) == 0) {
int olen;
- if (rflags && plen != 7)
+ /* $ORIGIN is not expanded for SUID/GUID programs
+ (except if it is $ORIGIN alone) */
+ if ((rflags & __RTLD_SECURE) && plen != 7)
continue;
if (origin == NULL)
continue;
@@ -194,7 +196,7 @@ search_for_named_library(const char *name, unsigned rflags, const char
*path_lis
unsigned long _dl_error_number;
unsigned long _dl_internal_error_number;
-struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rpnt,
+struct elf_resolve *_dl_load_shared_library(unsigned int rflags, struct dyn_elf **rpnt,
struct elf_resolve *tpnt, char *full_libname, int attribute_unused
trace_loaded_objects)
{
char *pnt;
@@ -493,7 +495,7 @@ map_writeable (int infile, ElfW(Phdr) *ppnt, int piclib, int flags,
* are required.
*/
-struct elf_resolve *_dl_load_elf_shared_library(unsigned rflags,
+struct elf_resolve *_dl_load_elf_shared_library(unsigned int rflags,
struct dyn_elf **rpnt, const char *libname)
{
ElfW(Ehdr) *epnt;
@@ -532,7 +534,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned rflags,
}
/* If we are in secure mode (i.e. a setuid/gid binary using LD_PRELOAD),
we don't load the library if it isn't setuid. */
- if (rflags & DL_RESOLVE_SECURE) {
+ if (rflags & __RTLD_SECURE) {
if (!(st.st_mode & S_ISUID)) {
_dl_close(infile);
return NULL;
@@ -548,7 +550,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned rflags,
return tpnt;
}
}
- if (rflags & DL_RESOLVE_NOLOAD) {
+ if (rflags & RTLD_NOLOAD) {
_dl_close(infile);
return NULL;
}
@@ -812,7 +814,7 @@ struct elf_resolve *_dl_load_elf_shared_library(unsigned rflags,
DL_RELOC_ADDR(DL_GET_RUN_ADDR(tpnt->loadaddr, tpnt->mapaddr),
epnt->e_phoff);
tpnt->n_phent = epnt->e_phnum;
- tpnt->rtld_flags |= rtld_flags;
+ tpnt->rtld_flags = rflags | rtld_flags;
#ifdef __LDSO_STANDALONE_SUPPORT__
tpnt->l_entry = epnt->e_entry;
#endif
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 0cdc91d..9f4e841 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -589,7 +589,8 @@ of this helper program; chances are you did not intend to run this
program.\n\
* but it could be also a shared object (when ld.so used for tracing)
* We keep the misleading app_tpnt name to avoid variable pollution
*/
- app_tpnt = _dl_load_elf_shared_library(_dl_secure, &rpnt, _dl_progname);
+ app_tpnt = _dl_load_elf_shared_library(_dl_secure ? __RTLD_SECURE : 0,
+ &rpnt, _dl_progname);
if (!app_tpnt) {
_dl_dprintf(2, "can't load '%s'\n", _dl_progname);
_dl_exit(16);
@@ -887,7 +888,7 @@ of this helper program; chances are you did not intend to run this
program.\n\
_dl_if_debug_dprint("\tfile='%s'; needed by '%s'\n", str,
_dl_progname);
tpnt1 = _dl_load_shared_library(
- _dl_secure ? DL_RESOLVE_SECURE : 0,
+ _dl_secure ? __RTLD_SECURE : 0,
&rpnt, NULL, str, trace_loaded_objects);
if (!tpnt1) {
#ifdef __LDSO_LDD_SUPPORT__
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 2c4b064..42a09a8 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -59,8 +59,6 @@ extern struct link_map *_dl_update_slotinfo(unsigned long int
req_modid);
* and use a pile of symbols from ldso... */
#include <dl-elf.h>
#if 0
-extern struct elf_resolve * _dl_load_shared_library(unsigned, struct dyn_elf **,
- struct elf_resolve *, char *, int);
extern int _dl_fixup(struct dyn_elf *rpnt, struct r_scope_elem *scope, int lazy);
extern void _dl_protect_relro(struct elf_resolve * tpnt);
#endif
@@ -385,7 +383,7 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr)
from)
_dl_if_debug_print("Trying to dlopen '%s', RTLD_GLOBAL:%d
RTLD_NOW:%d\n",
(char*)libname, (flag & RTLD_GLOBAL ? 1:0), (now_flag & RTLD_NOW ? 1:0));
- tpnt = _dl_load_shared_library((flag & RTLD_NOLOAD) ? DL_RESOLVE_NOLOAD : 0,
+ tpnt = _dl_load_shared_library(flag & (RTLD_NOLOAD | RTLD_GLOBAL | RTLD_NODELETE),
&rpnt, tfrom, (char*)libname, 0);
if (tpnt == NULL) {
_dl_unmap_cache();
@@ -394,7 +392,6 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr)
from)
dyn_chain = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
memset(dyn_chain, 0, sizeof(struct dyn_elf));
dyn_chain->dyn = tpnt;
- tpnt->rtld_flags |= (flag & RTLD_GLOBAL);
dyn_chain->next_handle = _dl_handles;
_dl_handles = dyn_ptr = dyn_chain;
@@ -407,7 +404,7 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr)
from)
dyn_chain->init_fini.init_fini = handle->init_fini.init_fini;
dyn_chain->init_fini.nlist = handle->init_fini.nlist;
for (i = 0; i < dyn_chain->init_fini.nlist; i++)
- dyn_chain->init_fini.init_fini[i]->rtld_flags |= (flag & RTLD_GLOBAL);
+ dyn_chain->init_fini.init_fini[i]->rtld_flags |= (flag &
(RTLD_GLOBAL|RTLD_NODELETE));
dyn_chain->next = handle->next;
break;
}
@@ -435,12 +432,11 @@ static void *do_dlopen(const char *libname, int flag, ElfW(Addr)
from)
dpnt->d_un.d_val);
_dl_if_debug_print("Trying to load '%s', needed by
'%s'\n",
lpntstr, runp->tpnt->libname);
- tpnt1 = _dl_load_shared_library(0, &rpnt, runp->tpnt, lpntstr, 0);
+ tpnt1 = _dl_load_shared_library(flag & (RTLD_GLOBAL | RTLD_NODELETE),
+ &rpnt, runp->tpnt, lpntstr, 0);
if (!tpnt1)
goto oops;
- tpnt1->rtld_flags |= (flag & RTLD_GLOBAL);
-
/* This list is for dlsym() and relocation */
dyn_ptr->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
memset (dyn_ptr->next, 0, sizeof (struct dyn_elf));
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index dea451a..4eb85ee 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -669,11 +669,13 @@ int __decode_dotted(const unsigned char *packet,
bool measure = 1;
unsigned total = 0;
unsigned used = 0;
+ unsigned maxiter = 256;
if (!packet)
return -1;
- while (1) {
+ dest[0] = '\0';
+ while (--maxiter) {
if (offset >= packet_len)
return -1;
b = packet[offset++];
@@ -710,6 +712,8 @@ int __decode_dotted(const unsigned char *packet,
else
dest[used++] = '\0';
}
+ if (!maxiter)
+ return -1;
/* The null byte must be counted too */
if (measure)
diff --git a/libc/string/mips/memcpy.S b/libc/string/mips/memcpy.S
index 2a187ef..3afdb2c 100644
--- a/libc/string/mips/memcpy.S
+++ b/libc/string/mips/memcpy.S
@@ -565,11 +565,11 @@ L(lastw):
#ifdef USE_DOUBLE
andi t8,a2,3 /* a2 is the remainder past 4 byte chunks. */
beq t8,a2,L(lastb)
+ move a2,t8
lw REG3,0(a1)
sw REG3,0(a0)
PTR_ADDIU a0,a0,4
PTR_ADDIU a1,a1,4
- move a2,t8
#endif
/* Copy the last 8 (or 16) bytes */
diff --git a/libc/sysdeps/linux/common/adjtimex.c b/libc/sysdeps/linux/common/adjtimex.c
index 45cb384..1996502 100644
--- a/libc/sysdeps/linux/common/adjtimex.c
+++ b/libc/sysdeps/linux/common/adjtimex.c
@@ -13,6 +13,7 @@
_syscall1(int, adjtimex, struct timex *, buf)
libc_hidden_def(adjtimex)
+weak_alias(adjtimex,__adjtimex)
#if defined __UCLIBC_NTP_LEGACY__
strong_alias(adjtimex,ntp_adjtime)
#endif
diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h
b/libc/sysdeps/linux/common/bits/mathcalls.h
index 9bebb51..8ab8075 100644
--- a/libc/sysdeps/linux/common/bits/mathcalls.h
+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
@@ -145,11 +145,11 @@ __MATHCALLI (log10,, (_Mdouble_ __x))
__MATHCALLI (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr))
_Mdouble_END_NAMESPACE
-#if 0 /*def __USE_GNU*/
+#if defined __USE_GNU
/* A function missing in all standards: compute exponent to base ten. */
-__MATHCALL (exp10,, (_Mdouble_ __x))
+__MATHCALLI (exp10,, (_Mdouble_ __x))
/* Another name occasionally used. */
-__MATHCALL (pow10,, (_Mdouble_ __x))
+__MATHCALLI (pow10,, (_Mdouble_ __x))
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
diff --git a/libc/sysdeps/linux/mips/bits/setjmp.h
b/libc/sysdeps/linux/mips/bits/setjmp.h
index 375e537..51f972e 100644
--- a/libc/sysdeps/linux/mips/bits/setjmp.h
+++ b/libc/sysdeps/linux/mips/bits/setjmp.h
@@ -26,18 +26,18 @@
#include <sgidefs.h>
#if _MIPS_SIM == _MIPS_SIM_ABI32
-#define ptrsize void *
+#define __ptr_size void *
#else
-#define ptrsize long long
+#define __ptr_size long long
#endif
typedef struct
{
/* Program counter. */
- ptrsize __pc;
+ __ptr_size __pc;
/* Stack pointer. */
- ptrsize __sp;
+ __ptr_size __sp;
/* Callee-saved registers s0 through s7. */
#if _MIPS_SIM == _MIPS_SIM_ABI32
@@ -47,10 +47,10 @@ typedef struct
#endif
/* The frame pointer. */
- ptrsize __fp;
+ __ptr_size __fp;
/* The global pointer. */
- ptrsize __gp;
+ __ptr_size __gp;
/* Floating point status register. */
int __fpc_csr;
diff --git a/libc/sysdeps/linux/mips/setjmp_aux.c b/libc/sysdeps/linux/mips/setjmp_aux.c
index 9cffcc6..4338838 100644
--- a/libc/sysdeps/linux/mips/setjmp_aux.c
+++ b/libc/sysdeps/linux/mips/setjmp_aux.c
@@ -62,14 +62,14 @@ __sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp)
#endif
/* .. and the stack pointer; */
- env[0].__jmpbuf[0].__sp = (ptrsize) sp;
+ env[0].__jmpbuf[0].__sp = (__ptr_size) sp;
/* .. and the FP; it'll be in s8. */
- env[0].__jmpbuf[0].__fp = (ptrsize) fp;
+ env[0].__jmpbuf[0].__fp = (__ptr_size) fp;
/* .. and the GP; */
#if _MIPS_SIM == _MIPS_SIM_ABI64
- env[0].__jmpbuf[0].__gp = (ptrsize) gp;
+ env[0].__jmpbuf[0].__gp = (__ptr_size) gp;
#else
__asm__ __volatile__ ("sw $gp, %0" : : "m"
(env[0].__jmpbuf[0].__gp));
#endif
diff --git a/libm/Makefile.in b/libm/Makefile.in
index d886cdb..f0e5528 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -56,7 +56,7 @@ LD_MSRC := ldouble_wrappers.c
ifeq ($(DO_C99_MATH),y)
libm_CSRC := \
e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \
- e_exp.c e_fmod.c e_hypot.c \
+ e_exp.c e_exp10.c e_fmod.c e_hypot.c \
e_lgamma_r.c e_log.c e_log2.c e_log10.c \
e_pow.c e_remainder.c e_rem_pio2.c e_scalb.c e_sinh.c \
e_sqrt.c k_cos.c k_rem_pio2.c k_sin.c k_standard.c k_tan.c \
@@ -238,7 +238,7 @@ libm_CSRC := \
s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \
k_cos.c e_cosh.c e_exp.c e_fmod.c e_log.c e_log10.c e_pow.c \
k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
- s_finite.c
+ s_finite.c e_exp10.c
# We'll add sqrtf to avoid problems with libstdc++
FL_MOBJ := sqrtf.o
endif
diff --git a/libc/signal/sigignore.c b/libm/e_exp10.c
similarity index 63%
copy from libc/signal/sigignore.c
copy to libm/e_exp10.c
index 1ddce81..f0ee878 100644
--- a/libc/signal/sigignore.c
+++ b/libm/e_exp10.c
@@ -1,5 +1,4 @@
-/* Set the disposition of SIG to SIG_IGN.
- Copyright (C) 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)cygnus.com>om>, 1998.
@@ -17,17 +16,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#define __need_NULL
-#include <stddef.h>
-#include <signal.h>
-#include <string.h>
+#include "math.h"
+#include "math_private.h"
+#include <float.h>
-int sigignore (int sig)
+double __ieee754_exp10 (double arg)
{
- struct sigaction act;
-
- memset(&act, 0, sizeof(act));
- act.sa_handler = SIG_IGN;
-
- return sigaction (sig, &act, NULL);
+ if (isfinite (arg) && arg < DBL_MIN_10_EXP - DBL_DIG - 10)
+ return DBL_MIN * DBL_MIN;
+ else
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_exp (M_LN10 * arg);
}
+strong_alias(__ieee754_exp10, exp10)
+libm_hidden_def(exp10)
diff --git a/libm/math_private.h b/libm/math_private.h
index be8031e..b62dcfe 100644
--- a/libm/math_private.h
+++ b/libm/math_private.h
@@ -158,6 +158,7 @@ extern double __ieee754_atanh (double) attribute_hidden;
extern double __ieee754_asin (double) attribute_hidden;
extern double __ieee754_atan2 (double,double) attribute_hidden;
extern double __ieee754_exp (double) attribute_hidden;
+extern double __ieee754_exp10 (double) attribute_hidden;
extern double __ieee754_cosh (double) attribute_hidden;
extern double __ieee754_fmod (double,double) attribute_hidden;
extern double __ieee754_pow (double,double) attribute_hidden;
diff --git a/test/Test.mak b/test/Test.mak
index 98939e7..c1b34a7 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -121,14 +121,15 @@ MAKE_SRCS := Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak
$(TESTDIR)Test.mak
$(U_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS)
$(showlink)
$(Q)$(CC) $(filter-out $(CFLAGS-OMIT-$@),$(CFLAGS)) $(EXTRA_CFLAGS) $(CFLAGS_$(notdir
$(CURDIR))) $(CFLAGS_$@) -c $@.c -o $@.o
- $(Q)$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@)
+ $(Q)$(CC) $(filter-out $(LDFLAGS-OMIT-$@),$(LDFLAGS)) $@.o -o $@ $(EXTRA_LDFLAGS)
$(LDFLAGS_$@)
$(G_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS)
$(showlink)
$(Q)$(HOSTCC) $(filter-out $(HOST_CFLAGS-OMIT-$(patsubst %_glibc,%,$@)),$(HOST_CFLAGS))
\
$(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$(patsubst %_glibc,%,$@)) \
-c $(patsubst %_glibc,%,$(a)).c -o $@.o
- $(Q)$(HOSTCC) $(HOST_LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst
%_glibc,%,$@)) $(LDFLAGS_$@)
+ $(Q)$(HOSTCC) $(filter-out $(LDFLAGS-OMIT-$(patsubst %_glibc,%,$@)),$(HOST_LDFLAGS)) \
+ $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@)) $(LDFLAGS_$@)
shell_%:
diff --git a/test/dlopen/Makefile.in b/test/dlopen/Makefile.in
index 85996de..0bed0f7 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
+ testscope nodelete tst-origin
ifneq ($(HAVE_SHARED),y)
TESTS_DISABLED := test3
@@ -25,10 +25,19 @@ LDFLAGS_test2 := -ldl
LDFLAGS_test3 := -ldl ./libtest1.so ./libtest2.so -Wl,-rpath,.
LDFLAGS_dladdr := -ldl
LDFLAGS_testscope:= -ldl
+LDFLAGS_tst-origin:= -ldl -Wl,-rpath,\$$ORIGIN/testlib
DEBUG_LIBS := X
WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
+testlib:
+ @mkdir $@
+
+testlib/libtest31.so: libtest3.so | testlib
+ @cp $^ $@
+
+EXTRA_DIRS := testlib
+
# Build libC.so without -mprefergot compilation flag to force a
# R_SH_JMP_SLOT relocation instead of R_SH_GLOB_DAT for _libC_fini. This is
# needed to resolve the _libC_fini symbol when used (by libC.so destructor),
@@ -53,6 +62,7 @@ LDFLAGS_libafk.so := ./libafk-temp.so -Wl,-rpath,.
test1: libtest1.so
test2: libtest1.so libtest2.so
test3: libtest1.so libtest2.so
+tst-origin: testlib/libtest31.so
libtest1.so: libtest2.so
libB.so: libC.so
libA.so: libB.so
@@ -63,3 +73,10 @@ LDFLAGS_libtest3.so := -lpthread -Wl,-rpath,.
LDFLAGS_libC.so := -ldl
LDFLAGS_libB.so := ./libC.so -Wl,-rpath,.
LDFLAGS_libA.so := ./libB.so -Wl,-rpath,.
+
+nodelete: nodelmod1.so nodelmod2.so nodelmod3.so
+nodelmod3.so: nodelmod4.so
+LDFLAGS_nodelete := -rdynamic -ldl
+LDFLAGS_nodelmod1.so := -Wl,-z,nodelete
+LDFLAGS_nodelmod3.so := ./nodelmod4.so
+LDFLAGS_nodelmod4.so := -Wl,-z,nodelete
diff --git a/test/dlopen/nodelete.c b/test/dlopen/nodelete.c
new file mode 100644
index 0000000..07ff961
--- /dev/null
+++ b/test/dlopen/nodelete.c
@@ -0,0 +1,205 @@
+#include <dlfcn.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static sigjmp_buf jmpbuf;
+
+
+int fini_ran;
+
+
+static void
+__attribute__ ((noreturn))
+handler (int sig)
+{
+ siglongjmp (jmpbuf, 1);
+}
+
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+ /* We are testing the two possibilities to mark an object as not deletable:
+ - marked on the linker commandline with `-z nodelete'
+ - with the RTLD_NODELETE flag at dlopen()-time.
+
+ The test we are performing should be safe. We are loading the objects,
+ get the address of variables in the respective object, unload the object
+ and then try to read the variable. If the object is unloaded this
+ should lead to an segmentation fault. */
+ void *p;
+ struct sigaction sa;
+
+ sa.sa_handler = handler;
+ sigfillset (&sa.sa_mask);
+ sa.sa_flags = SA_RESTART;
+
+ if (sigaction (SIGSEGV, &sa, NULL) == -1)
+ puts ("cannot install signal handler: %m");
+
+ p = dlopen ("nodelmod1.so", RTLD_LAZY);
+ if (p == NULL)
+ {
+ printf ("failed to load \"nodelmod1.so\": %s\n", dlerror ());
+ exit (1);
+ }
+ else
+ {
+ int *varp;
+
+ varp = dlsym (p, "var1");
+ if (varp == NULL)
+ {
+ puts ("failed to get address of \"var1\" in
\"nodelmod1.so\"");
+ exit (1);
+ }
+ else
+ {
+ *varp = 20000720;
+
+ /* Now close the object. */
+ fini_ran = 0;
+ if (dlclose (p) != 0)
+ {
+ puts ("failed to close \"nodelmod1.so\"");
+ exit (1);
+ }
+ else if (! sigsetjmp (jmpbuf, 1))
+ {
+ /* Access the variable again. */
+ if (*varp != 20000720)
+ {
+ puts ("\"var1\" value not correct");
+ exit (1);
+ }
+ else if (fini_ran != 0)
+ {
+ puts ("destructor of \"nodelmod1.so\" ran");
+ exit (1);
+ }
+ else
+ puts ("-z nodelete test succeeded");
+ }
+ else
+ {
+ /* We caught an segmentation fault. */
+ puts ("\"nodelmod1.so\" got deleted!");
+ exit (1);
+ }
+ }
+ }
+
+ p = dlopen ("nodelmod2.so", RTLD_LAZY | RTLD_NODELETE);
+ if (p == NULL)
+ {
+ printf ("failed to load \"nodelmod2.so\": %s\n", dlerror ());
+ exit (1);
+ }
+ else
+ {
+ int *varp;
+
+ varp = dlsym (p, "var2");
+ if (varp == NULL)
+ {
+ puts ("failed to get address of \"var2\" in
\"nodelmod2.so\"");
+ exit (1);
+ }
+ else
+ {
+ *varp = 42;
+
+ /* Now close the object. */
+ fini_ran = 0;
+ if (dlclose (p) != 0)
+ {
+ puts ("failed to close \"nodelmod2.so\"");
+ exit (1);
+ }
+ else if (! sigsetjmp (jmpbuf, 1))
+ {
+ /* Access the variable again. */
+ if (*varp != 42)
+ {
+ puts ("\"var2\" value not correct");
+ exit (1);
+ }
+ else if (fini_ran != 0)
+ {
+ puts ("destructor of \"nodelmod2.so\" ran");
+ exit (1);
+ }
+ else
+ puts ("RTLD_NODELETE test succeeded");
+ }
+ else
+ {
+ /* We caught an segmentation fault. */
+ puts ("\"nodelmod2.so\" got deleted!");
+ exit (1);
+ }
+ }
+ }
+
+ p = dlopen ("nodelmod3.so", RTLD_LAZY);
+ if (p == NULL)
+ {
+ printf ("failed to load \"nodelmod3.so\": %s\n", dlerror ());
+ exit (1);
+ }
+ else
+ {
+ int *(*fctp) (void);
+
+ fctp = dlsym (p, "addr");
+ if (fctp == NULL)
+ {
+ puts ("failed to get address of \"addr\" in
\"nodelmod3.so\"");
+ exit (1);
+ }
+ else
+ {
+ int *varp = fctp ();
+
+ *varp = -1;
+
+ /* Now close the object. */
+ fini_ran = 0;
+ if (dlclose (p) != 0)
+ {
+ puts ("failed to close \"nodelmod3.so\"");
+ exit (1);
+ }
+ else if (! sigsetjmp (jmpbuf, 1))
+ {
+ /* Access the variable again. */
+ if (*varp != -1)
+ {
+ puts ("\"var_in_mod4\" value not correct");
+ exit (1);
+ }
+ else if (fini_ran != 0)
+ {
+ puts ("destructor of \"nodelmod4.so\" ran");
+ exit (1);
+ }
+ else
+ puts ("-z nodelete in dependency succeeded");
+ }
+ else
+ {
+ /* We caught an segmentation fault. */
+ puts ("\"nodelmod4.so\" got deleted!");
+ exit (1);
+ }
+ }
+ }
+
+ return 0;
+}
+
+#include "../test-skeleton.c"
diff --git a/test/dlopen/nodelmod1.c b/test/dlopen/nodelmod1.c
new file mode 100644
index 0000000..51be080
--- /dev/null
+++ b/test/dlopen/nodelmod1.c
@@ -0,0 +1,10 @@
+extern int fini_ran;
+
+int var1 = 42;
+
+static void
+__attribute__ ((__destructor__))
+destr (void)
+{
+ fini_ran = 1;
+}
diff --git a/test/dlopen/nodelmod2.c b/test/dlopen/nodelmod2.c
new file mode 100644
index 0000000..ff2ffc2
--- /dev/null
+++ b/test/dlopen/nodelmod2.c
@@ -0,0 +1,10 @@
+extern int fini_ran;
+
+int var2 = 100;
+
+static void
+__attribute__ ((__destructor__))
+destr (void)
+{
+ fini_ran = 1;
+}
diff --git a/test/dlopen/nodelmod3.c b/test/dlopen/nodelmod3.c
new file mode 100644
index 0000000..817c94d
--- /dev/null
+++ b/test/dlopen/nodelmod3.c
@@ -0,0 +1,8 @@
+extern int var_in_mod4;
+extern int *addr (void);
+
+int *
+addr (void)
+{
+ return &var_in_mod4;
+}
diff --git a/test/dlopen/nodelmod4.c b/test/dlopen/nodelmod4.c
new file mode 100644
index 0000000..d7fa893
--- /dev/null
+++ b/test/dlopen/nodelmod4.c
@@ -0,0 +1,10 @@
+extern int fini_ran;
+
+int var_in_mod4 = 99;
+
+static void
+__attribute__ ((__destructor__))
+destr (void)
+{
+ fini_ran = 1;
+}
diff --git a/test/dlopen/test2.c b/test/dlopen/tst-origin.c
similarity index 51%
copy from test/dlopen/test2.c
copy to test/dlopen/tst-origin.c
index d8428f7..a12be41 100644
--- a/test/dlopen/test2.c
+++ b/test/dlopen/tst-origin.c
@@ -8,32 +8,30 @@ extern void _dlinfo(void);
#endif
int main(int argc, char **argv) {
- void *handle;
+ void *h1, *h2;
int (*mydltest)(const char *s);
char *error;
- handle = dlopen ("./libtest2.so", RTLD_LAZY);
- if (!handle) {
- fprintf(stderr, "Could not open ./libtest2.so: %s\n", dlerror());
+ h1 = dlopen ("libtest31.so", RTLD_LAZY);
+ if (!h1) {
+ fprintf(stderr, "Could not open libtest31.so: %s\n", dlerror());
exit(1);
}
- handle = dlopen ("./libtest1.so", RTLD_LAZY);
- if (!handle) {
- fprintf(stderr, "Could not open ./libtest1.so: %s\n", dlerror());
+ h2 = dlopen ("libtest31.so", RTLD_NOLOAD);
+ if (!h2) {
+ fprintf(stderr, "Could not open libtest31.so(RTLD_NOLOAD): %s\n",
dlerror());
exit(1);
}
- mydltest = dlsym(handle, "dltest");
+ mydltest = dlsym(h1, "dltest");
if ((error = dlerror()) != NULL) {
fprintf(stderr, "Could not locate symbol 'dltest': %s\n", error);
exit(1);
}
- mydltest("hello world!");
-
- dlclose(handle);
+ dlclose(h2);
+ dlclose(h1);
return EXIT_SUCCESS;
}
-
hooks/post-receive
--
uClibc-ng - small C library for embedded systems