summaryrefslogtreecommitdiff
path: root/ldso/ldso/ld_string.h
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-08 14:35:49 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-08 14:35:49 +0000
commit9cba52f0aedbb95671e8a14e3fd5ff98381ff2b0 (patch)
treedd82b29998103d7d8ba34351e6fc3a12dc0ed7ac /ldso/ldso/ld_string.h
parent4c69b9f793fc1eae9190d8ba26dba25db616272f (diff)
Patch from Stefan Allius and Edie C. Dost to add SuperH
shared library support. This also adds some cleaner error handling, which I (Erik) then ported over to x86 and arm. In addition Stefan added the following fixes: - in hash.c was the lvalue handling of global library functions wrong. To fix this I had to change the prototype of _dl_find_hash. (==> TIS and ELF spec. Vers. 1.2) - in ldso.c was the order of the .init sections calls wrong. Before we call the initialization code of a library we have to check that all dependend libraries are already initialized. This can easily made by calling it in the revers loading order. For this I added a previous pointer chain. - in ldso.c the ELF magics wasn't checked fo PPC, MIPS and SH architecture
Diffstat (limited to 'ldso/ldso/ld_string.h')
-rw-r--r--ldso/ldso/ld_string.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/ldso/ldso/ld_string.h b/ldso/ldso/ld_string.h
index e2b1f28c3..1de9f8d76 100644
--- a/ldso/ldso/ld_string.h
+++ b/ldso/ldso/ld_string.h
@@ -17,6 +17,7 @@ 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);
@@ -122,6 +123,29 @@ static inline char *_dl_strrchr(const char *str, int c)
return(prev);
}
+
+static inline char *_dl_strstr(const char *s1, const char *s2)
+{
+ register const char *s = s1;
+ register const char *p = s2;
+
+ do {
+ if (!*p) {
+ return (char *) s1;;
+ }
+ if (*p == *s) {
+ ++p;
+ ++s;
+ } else {
+ p = s2;
+ if (!*s) {
+ return NULL;
+ }
+ s = ++s1;
+ }
+ } while (1);
+}
+
static inline void * _dl_memcpy(void * dst, const void * src, size_t len)
{
register char *a = dst;
@@ -221,7 +245,7 @@ static inline char *_dl_simple_ltoahex(char * local, unsigned long i)
}
-#if defined mc68000 || defined __arm__ || defined __mips__
+#if defined mc68000 || defined __arm__ || defined __mips__ || defined __sh__
/* On some arches constant strings are referenced through the GOT. */
/* XXX Requires load_addr to be defined. */
#define SEND_STDERR(X) \