summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-06-30 02:26:21 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-06-30 02:26:21 +0000
commit1f5e605b3521a59c72d670a656293592d622fe57 (patch)
tree4e19520c9a736da5eb5e96a0cb8003df4c14caa5
parent5188f9d3b22ec9953c65d611f1152eb9f04e0abb (diff)
The function '_dl_memset' should always be inlined regardless of the
optimization level chosen. This allows uClibc to be compiled with the latest GCC-4.1.0. While tracking down the specific culprit causing the segmentation fault of the dynamic loader with GCC-4.1.0 I was able to force inlining of other functions such that I shaved 512 bytes off the size of the loader, yay. Also fixed warning in 'dl-hash.c'.
-rw-r--r--ldso/include/dl-string.h28
-rw-r--r--ldso/ldso/dl-hash.c2
2 files changed, 15 insertions, 15 deletions
diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
index a52f83f36..9636c2764 100644
--- a/ldso/include/dl-string.h
+++ b/ldso/include/dl-string.h
@@ -22,7 +22,7 @@ static char *_dl_simple_ltoahex(char * local, unsigned long i);
#define NULL ((void *) 0)
#endif
-static inline size_t _dl_strlen(const char * str)
+static inline size_t __attribute__((__always_inline__)) _dl_strlen(const char * str)
{
register const char *ptr = (char *) str-1;
@@ -30,7 +30,7 @@ static inline size_t _dl_strlen(const char * str)
return (ptr - str);
}
-static inline char *_dl_strcat(char *dst, const char *src)
+static inline char * __attribute__((__always_inline__)) _dl_strcat(char *dst, const char *src)
{
register char *ptr = dst-1;
@@ -43,7 +43,7 @@ static inline char *_dl_strcat(char *dst, const char *src)
return dst;
}
-static inline char * _dl_strcpy(char * dst,const char *src)
+static inline char * __attribute__((__always_inline__)) _dl_strcpy(char * dst,const char *src)
{
register char *ptr = dst;
@@ -53,7 +53,7 @@ static inline char * _dl_strcpy(char * dst,const char *src)
return ptr;
}
-static inline int _dl_strcmp(const char * s1,const char * s2)
+static inline int __attribute__((__always_inline__)) _dl_strcmp(const char * s1,const char * s2)
{
register unsigned char c1, c2;
s1--;s2--;
@@ -68,7 +68,7 @@ static inline int _dl_strcmp(const char * s1,const char * s2)
return c1 - c2;
}
-static inline int _dl_strncmp(const char * s1,const char * s2,size_t len)
+static inline int __attribute__((__always_inline__)) _dl_strncmp(const char * s1,const char * s2,size_t len)
{
register unsigned char c1 = '\0';
register unsigned char c2 = '\0';
@@ -84,7 +84,7 @@ static inline int _dl_strncmp(const char * s1,const char * s2,size_t len)
return c1 - c2;
}
-static inline char * _dl_strchr(const char * str,int c)
+static inline char * __attribute__((__always_inline__)) _dl_strchr(const char * str,int c)
{
register char ch;
str--;
@@ -97,7 +97,7 @@ static inline char * _dl_strchr(const char * str,int c)
return 0;
}
-static inline char *_dl_strrchr(const char *str, int c)
+static inline char * _dl_strrchr(const char *str, int c)
{
register char *prev = 0;
register char *ptr = (char *) str-1;
@@ -111,7 +111,7 @@ static inline char *_dl_strrchr(const char *str, int c)
return(prev);
}
-static inline char *_dl_strstr(const char *s1, const char *s2)
+static inline char * _dl_strstr(const char *s1, const char *s2)
{
register const char *s = s1;
register const char *p = s2;
@@ -145,7 +145,7 @@ static inline void * _dl_memcpy(void * dst, const void * src, size_t len)
return dst;
}
-static inline int _dl_memcmp(const void * s1,const void * s2,size_t len)
+static inline int __attribute__((__always_inline__)) _dl_memcmp(const void * s1,const void * s2,size_t len)
{
unsigned char *c1 = (unsigned char *)s1-1;
unsigned char *c2 = (unsigned char *)s2-1;
@@ -160,7 +160,7 @@ static inline int _dl_memcmp(const void * s1,const void * s2,size_t len)
#if defined(powerpc)
/* Will generate smaller and faster code due to loop unrolling.*/
-static inline void *_dl_memset(void *to, int c, size_t n)
+static inline void * __attribute__((__always_inline__)) _dl_memset(void *to, int c, size_t n)
{
unsigned long chunks;
unsigned long *tmp_to;
@@ -185,7 +185,7 @@ static inline void *_dl_memset(void *to, int c, size_t n)
return to;
}
#else
-static inline void * _dl_memset(void * str,int c,size_t len)
+static inline void * __attribute__((__always_inline__)) _dl_memset(void * str,int c,size_t len)
{
register char *a = str;
@@ -196,7 +196,7 @@ static inline void * _dl_memset(void * str,int c,size_t len)
}
#endif
-static inline char *_dl_get_last_path_component(char *path)
+static inline char * __attribute__((__always_inline__)) _dl_get_last_path_component(char *path)
{
register char *ptr = path-1;
@@ -217,7 +217,7 @@ static inline char *_dl_get_last_path_component(char *path)
/* Early on, we can't call printf, so use this to print out
* numbers using the SEND_STDERR() macro. Avoid using mod
* or using long division */
-static inline char *_dl_simple_ltoa(char * local, unsigned long i)
+static inline char * __attribute__((__always_inline__)) _dl_simple_ltoa(char * local, unsigned long i)
{
/* 20 digits plus a null terminator should be good for
* 64-bit or smaller ints (2^64 - 1)*/
@@ -232,7 +232,7 @@ static inline char *_dl_simple_ltoa(char * local, unsigned long i)
return p;
}
-static inline char *_dl_simple_ltoahex(char * local, unsigned long i)
+static inline char * __attribute__((__always_inline__)) _dl_simple_ltoahex(char * local, unsigned long i)
{
/* 16 digits plus a leading "0x" plus a null terminator,
* should be good for 64-bit or smaller ints */
diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c
index 5de38a61e..55026b4db 100644
--- a/ldso/ldso/dl-hash.c
+++ b/ldso/ldso/dl-hash.c
@@ -57,7 +57,7 @@ struct dyn_elf *_dl_handles = NULL;
/* This is the hash function that is used by the ELF linker to generate the
* hash table that each executable and library is required to have. We need
* it to decode the hash table. */
-static inline unsigned long _dl_elf_hash(const unsigned char *name)
+static inline unsigned long _dl_elf_hash(const char *name)
{
unsigned long hash=0;
unsigned long tmp;