summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
Diffstat (limited to 'ldso')
-rw-r--r--ldso/include/dl-string.h43
-rw-r--r--ldso/libdl/libdl.c6
2 files changed, 15 insertions, 34 deletions
diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
index a7e2f47ff..dc965330a 100644
--- a/ldso/include/dl-string.h
+++ b/ldso/include/dl-string.h
@@ -19,25 +19,11 @@
# define do_div_10(result, remain) ((result) /= 10)
#endif
-static size_t _dl_strlen(const char *str);
-static char *_dl_strcat(char *dst, const char *src);
-static char *_dl_strcpy(char *dst, const char *src);
-static int _dl_strcmp(const char *s1, const char *s2);
-static int _dl_strncmp(const char *s1, const char *s2, size_t len);
-static char *_dl_strchr(const char *str, int c);
-static char *_dl_strrchr(const char *str, int c);
-static char *_dl_strstr(const char *s1, const char *s2);
-static void *_dl_memcpy(void *dst, const void *src, size_t len);
-static int _dl_memcmp(const void *s1, const void *s2, size_t len);
-static void *_dl_memset(void *str, int c, size_t len);
-static char *_dl_get_last_path_component(char *path);
-static char *_dl_simple_ltoa(char *local, unsigned long i);
-static char *_dl_simple_ltoahex(char *local, unsigned long i);
-
#ifndef NULL
#define NULL ((void *) 0)
#endif
+#ifndef IS_IN_libdl
static __always_inline size_t _dl_strlen(const char *str)
{
register const char *ptr = (char *) str-1;
@@ -84,22 +70,6 @@ static __always_inline int _dl_strcmp(const char *s1, const char *s2)
return c1 - c2;
}
-static __always_inline int _dl_strncmp(const char *s1, const char *s2, size_t len)
-{
- register unsigned char c1 = '\0';
- register unsigned char c2 = '\0';
-
- s1--;s2--;
- while (len > 0) {
- c1 = (unsigned char) *++s1;
- c2 = (unsigned char) *++s2;
- if (c1 == '\0' || c1 != c2)
- return c1 - c2;
- len--;
- }
- return c1 - c2;
-}
-
static __always_inline char * _dl_strchr(const char *str, int c)
{
register char ch;
@@ -228,6 +198,17 @@ static __always_inline char * _dl_get_last_path_component(char *path)
;/* empty */
return ptr == path ? ptr : ptr+1;
}
+#else /* IS_IN_libdl */
+# define _dl_strlen strlen
+# define _dl_strcat strcat
+# define _dl_strcpy strcpy
+# define _dl_strcmp strcmp
+# define _dl_strrchr strrchr
+# define _dl_strstr strstr
+# define _dl_memcpy memcpy
+# define _dl_memcmp memcmp
+# define _dl_memset memset
+#endif /* IS_IN_libdl */
/* Early on, we can't call printf, so use this to print out
* numbers using the SEND_STDERR() macro. Avoid using mod
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 51bcf7d25..540dd9459 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -32,7 +32,7 @@
#include <ldso.h>
#include <stdio.h>
-#include <string.h> /* Needed for 'strstr' prototype' */
+#include <string.h>
#include <stdbool.h>
#include <bits/uClibc_mutex.h>
@@ -393,7 +393,7 @@ static void *do_dlopen(const char *libname, int flag)
return NULL;
}
dyn_chain = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
- _dl_memset(dyn_chain, 0, sizeof(struct dyn_elf));
+ memset(dyn_chain, 0, sizeof(struct dyn_elf));
dyn_chain->dyn = tpnt;
tpnt->rtld_flags |= (flag & RTLD_GLOBAL);
@@ -444,7 +444,7 @@ static void *do_dlopen(const char *libname, int flag)
/* This list is for dlsym() and relocation */
dyn_ptr->next = (struct dyn_elf *) malloc(sizeof(struct dyn_elf));
- _dl_memset (dyn_ptr->next, 0, sizeof (struct dyn_elf));
+ memset (dyn_ptr->next, 0, sizeof (struct dyn_elf));
dyn_ptr = dyn_ptr->next;
dyn_ptr->dyn = tpnt1;
/* Used to record RTLD_LOCAL scope */