diff options
| -rw-r--r-- | include/elf.h | 40 | ||||
| -rw-r--r-- | include/features.h | 2 | ||||
| -rw-r--r-- | include/libc-internal.h | 6 | ||||
| -rw-r--r-- | include/libc-symbols.h | 111 | ||||
| -rw-r--r-- | include/string.h | 12 | ||||
| -rw-r--r-- | include/strings.h | 54 | ||||
| -rw-r--r-- | include/wchar.h | 6 |
7 files changed, 156 insertions, 75 deletions
diff --git a/include/elf.h b/include/elf.h index 44fcb2370..8ee65267a 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1253,6 +1253,46 @@ typedef struct /* Keep this the last entry. */ #define R_386_NUM 38 +/* Blackfin specific definitions. */ +#define R_BFIN_unused0 0x00 +#define R_BFIN_pcrel5m2 0x01 +#define R_BFIN_unused1 0x02 +#define R_BFIN_pcrel10 0x03 +#define R_BFIN_pcrel12_jump 0x04 +#define R_BFIN_rimm16 0x05 +#define R_BFIN_luimm16 0x06 +#define R_BFIN_huimm16 0x07 +#define R_BFIN_pcrel12_jump_s 0x08 +#define R_BFIN_pcrel24_jump_x 0x09 +#define R_BFIN_pcrel24 0x0a +#define R_BFIN_unusedb 0x0b +#define R_BFIN_unusedc 0x0c +#define R_BFIN_pcrel24_jump_l 0x0d +#define R_BFIN_pcrel24_call_x 0x0e +#define R_BFIN_var_eq_symb 0x0f +#define R_BFIN_byte_data 0x10 +#define R_BFIN_byte2_data 0x11 +#define R_BFIN_byte4_data 0x12 +#define R_BFIN_pcrel11 0x13 + +#define R_BFIN_GOT17M4 0x14 +#define R_BFIN_GOTHI 0x15 +#define R_BFIN_GOTLO 0x16 +#define R_BFIN_FUNCDESC 0x17 +#define R_BFIN_FUNCDESC_GOT17M4 0x18 +#define R_BFIN_FUNCDESC_GOTHI 0x19 +#define R_BFIN_FUNCDESC_GOTLO 0x1a +#define R_BFIN_FUNCDESC_VALUE 0x1b +#define R_BFIN_FUNCDESC_GOTOFF17M4 0x1c +#define R_BFIN_FUNCDESC_GOTOFFHI 0x1d +#define R_BFIN_FUNCDESC_GOTOFFLO 0x1e +#define R_BFIN_GOTOFF17M4 0x1f +#define R_BFIN_GOTOFFHI 0x20 +#define R_BFIN_GOTOFFLO 0x21 + +#define EF_BFIN_PIC 0x00000001 /* -fpic */ +#define EF_BFIN_FDPIC 0x00000002 /* -mfdpic */ + /* FR-V specific definitions. */ #define R_FRV_NONE 0 /* No reloc. */ #define R_FRV_32 1 /* Direct 32 bit. */ diff --git a/include/features.h b/include/features.h index c690e7ec2..c94d531e8 100644 --- a/include/features.h +++ b/include/features.h @@ -292,6 +292,8 @@ # define __USE_REENTRANT 1 #endif +/* uClibc does not support _FORTIFY_SOURCE */ +#undef _FORTIFY_SOURCE #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \ && __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 # if _FORTIFY_SOURCE > 1 diff --git a/include/libc-internal.h b/include/libc-internal.h index c7838b51e..80bac2362 100644 --- a/include/libc-internal.h +++ b/include/libc-internal.h @@ -35,7 +35,7 @@ #include <sys/cdefs.h> /* --- this is added to integrate linuxthreads */ -#define __USE_UNIX98 1 +/*#define __USE_UNIX98 1*/ #ifndef __ASSEMBLER__ # ifdef IS_IN_libc @@ -44,7 +44,11 @@ # include <stddef.h> /* sources are built w/ _GNU_SOURCE, this gets undefined */ +#ifdef __USE_GNU extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen); +#else +extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen); +#endif /* #include <pthread.h> */ # ifndef __UCLIBC_HAS_THREADS__ diff --git a/include/libc-symbols.h b/include/libc-symbols.h index c5ec2814f..bdc9ee23d 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -1,4 +1,7 @@ -/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Support macros for making weak and strong aliases for symbols, + and for using symbol sets and linker warnings with GNU ld. + Copyright (C) 1995-1998,2000-2003,2004,2005,2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,14 +20,38 @@ 02111-1307 USA. */ #ifndef _LIBC_SYMBOLS_H -#define _LIBC_SYMBOLS_H 1 +#define _LIBC_SYMBOLS_H 1 + +/* This file's macros are included implicitly in the compilation of every + file in the C library by -imacros. + + We include uClibc_arch_features.h which is defined by arch devs. + It should define for us the following symbols: + + * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. + * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. + * ASM_TYPE_DIRECTIVE_PREFIX with `@' or `#' or whatever for .type, + or leave it undefined if there is no .type directive. + * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. + * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. + * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. + + */ #include <bits/uClibc_arch_features.h> -#define _LIBC 1 + +/* This is defined for the compilation of all C library code. features.h + tests this to avoid inclusion of stubs.h while compiling the library, + before stubs.h has been generated. Some library code that is shared + with other packages also tests this symbol to see if it is being + compiled as part of the C library. We must define this before including + config.h, because it makes some definitions conditional on whether libc + itself is being compiled, or just some generator program. */ +#define _LIBC 1 /* Enable declarations of GNU extensions, since we are compiling them. */ -#define _GNU_SOURCE 1 +#define _GNU_SOURCE 1 /* Prepare for the case that `__builtin_expect' is not available. */ #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 @@ -128,13 +155,13 @@ # define _strong_alias(name, aliasname) \ extern __typeof (name) aliasname __attribute__ ((alias (#name))); -# ifdef HAVE_WEAK_SYMBOLS - /* This comes between the return type and function name in a function definition to make that definition weak. */ # define weak_function __attribute__ ((weak)) # define weak_const_function __attribute__ ((weak, __const__)) +# ifdef HAVE_WEAK_SYMBOLS + /* Define ALIASNAME as a weak alias for NAME. If weak aliases are not available, this defines a strong alias. */ # define weak_alias(name, aliasname) _weak_alias (name, aliasname) @@ -235,7 +262,7 @@ functions not exported) a bit faster by using a different calling convention. */ #ifndef internal_function -# define internal_function /* empty */ +# define internal_function /* empty */ #endif /* We want the .gnu.warning.SYMBOL section to be unallocated. */ @@ -315,7 +342,7 @@ } libc_hidden_weak (foo) - Similarly for global data. If references to foo within libc.so should + Similarly for global data. If references to foo within libc.so should always go to foo defined in libc.so, then in include/foo.h you add: libc_hidden_proto (foo) @@ -330,7 +357,7 @@ int foo = INITIAL_FOO_VALUE; libc_hidden_data_weak (foo) - If foo is normally just an alias (strong or weak) of some other function, + If foo is normally just an alias (strong or weak) to some other function, you should use the normal strong_alias first, then add libc_hidden_def or libc_hidden_weak: @@ -385,63 +412,31 @@ #if !defined STATIC && !defined __BCC__ # ifndef __ASSEMBLER__ -# define hidden_proto(name, attrs...) __hidden_proto (name, __GI_##name, ##attrs) -# define __hidden_proto(name, internal, attrs...) \ - extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \ - __hidden_proto_hiddenattr (attrs); -# define __hidden_asmname(name) __hidden_asmname1 (__USER_LABEL_PREFIX__, name) -# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name) -# define __hidden_asmname2(prefix, name) #prefix name -# define __hidden_ver1(local, internal, name) \ - extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \ - extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local)))) -# define hidden_def(name) __hidden_ver1(__GI_##name, name, name); -# define hidden_data_def(name) hidden_def(name) -# define hidden_weak(name) __hidden_ver1(__GI_##name, name, name) __attribute__((weak)); -# define hidden_data_weak(name) hidden_weak(name) +# define hidden_proto(name, attrs...) +# define hidden_def(name) +# define hidden_data_def(name) +# define hidden_weak(name) +# define hidden_data_weak(name) # else /* __ASSEMBLER__ */ # ifdef HAVE_ASM_SET_DIRECTIVE # ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define _hidden_strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) ASM_LINE_SEP \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ - .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ - .set C_SYMBOL_DOT_NAME (alias),C_SYMBOL_DOT_NAME (original) +# define _hidden_strong_alias(original, alias) # else -# define _hidden_strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) +# define _hidden_strong_alias(original, alias) # endif # else # ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define _hidden_strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ - .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) +# define _hidden_strong_alias(original, alias) # else -# define _hidden_strong_alias(original, alias) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) +# define _hidden_strong_alias(original, alias) # endif # endif # ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define _hidden_weak_alias(original, alias) \ - .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ - weak_alias(original, alias) +# define _hidden_weak_alias(original, alias) # else -# define _hidden_weak_alias(original, alias) \ - .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ - weak_alias(original, alias) +# define _hidden_weak_alias(original, alias) # endif /* For assembly, we need to do the opposite of what we do in C: @@ -453,11 +448,11 @@ but we provide it for consistency with the C usage. hidden_proto doesn't make sense for assembly but the equivalent is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */ -# define hidden_def(name) _hidden_strong_alias (name, __GI_##name) -# define hidden_data_def(name) _hidden_strong_alias (name, __GI_##name) -# define hidden_weak(name) _hidden_weak_alias (name, __GI_##name) -# define hidden_data_weak(name) _hidden_weak_alias (name, __GI_##name) -# define HIDDEN_JUMPTARGET(name) __GI_##name +# define hidden_def(name) +# define hidden_data_def(name) +# define hidden_weak(name) +# define hidden_data_weak(name) +# define HIDDEN_JUMPTARGET(name) # endif /* __ASSEMBLER__ */ #else /* SHARED */ # ifndef __ASSEMBLER__ @@ -674,4 +669,4 @@ # define libpthread_hidden_data_ver(local, name) #endif -#endif /* _LIBC_SYMBOLS_H */ +#endif /* libc-symbols.h */ diff --git a/include/string.h b/include/string.h index a98248c96..dd5f23f2b 100644 --- a/include/string.h +++ b/include/string.h @@ -301,6 +301,7 @@ extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); #endif #ifdef __USE_BSD +# ifdef __UCLIBC_SUSV3_LEGACY__ /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW __nonnull ((1, 2)); @@ -319,6 +320,17 @@ extern char *index (__const char *__s, int __c) /* Find the last occurrence of C in S (same as strrchr). */ extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); +# else +/* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3. + * They are replaced as proposed by SuSv3. Don't sync this part + * with glibc and keep it in sync with strings.h. */ + +# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0) +# define bzero(s,n) (memset((s), '\0', (n)), (void) 0) +# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n)) +# define index(s,c) strchr((s), (c)) +# define rindex(s,c) strrchr((s), (c)) +# endif /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ diff --git a/include/strings.h b/include/strings.h index 3ba2b04c8..fe089d960 100644 --- a/include/strings.h +++ b/include/strings.h @@ -22,6 +22,9 @@ /* We don't need and should not read this file if <string.h> was already read. The one exception being that if __USE_BSD isn't defined, then these aren't defined in string.h, so we need to define them here. */ + +/* keep this file in sync w/ string.h, the glibc version is out of date */ + #if !defined _STRING_H || !defined __USE_BSD # include <features.h> @@ -30,33 +33,58 @@ __BEGIN_DECLS -/* Compare N bytes of S1 and S2 (same as memcmp). */ -extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) - __THROW __attribute_pure__; - +# ifdef __UCLIBC_SUSV3_LEGACY__ /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ -extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW; +extern void bcopy (__const void *__src, void *__dest, size_t __n) + __THROW __nonnull ((1, 2)); /* Set N bytes of S to 0. */ -extern void bzero (void *__s, size_t __n) __THROW; +extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); -/* Return the position of the first bit set in I, or 0 if none are set. - The least-significant bit is position 1, the most-significant 32. */ -extern int ffs (int __i) __THROW __attribute__ ((const)); +/* Compare N bytes of S1 and S2 (same as memcmp). */ +extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); /* Find the first occurrence of C in S (same as strchr). */ -extern char *index (__const char *__s, int __c) __THROW __attribute_pure__; +extern char *index (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); /* Find the last occurrence of C in S (same as strrchr). */ -extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__; +extern char *rindex (__const char *__s, int __c) + __THROW __attribute_pure__ __nonnull ((1)); +# else +/* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3. + * They are replaced as proposed by SuSv3. Don't sync this part + * with glibc and keep it in sync with string.h. */ + +# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0) +# define bzero(s,n) (memset((s), '\0', (n)), (void) 0) +# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n)) +# define index(s,c) strchr((s), (c)) +# define rindex(s,c) strrchr((s), (c)) +# endif + +/* Return the position of the first bit set in I, or 0 if none are set. + The least-significant bit is position 1, the most-significant 32. */ +extern int ffs (int __i) __THROW __attribute__ ((__const__)); + +/* The following two functions are non-standard but necessary for non-32 bit + platforms. */ +#if 0 /*def __USE_GNU*/ +extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); +# ifdef __GNUC__ +__extension__ extern int ffsll (long long int __ll) + __THROW __attribute__ ((__const__)); +# endif +# endif /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (__const char *__s1, __const char *__s2) - __THROW __attribute_pure__; + __THROW __attribute_pure__ __nonnull ((1, 2)); /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) - __THROW __attribute_pure__; + __THROW __attribute_pure__ __nonnull ((1, 2)); __END_DECLS diff --git a/include/wchar.h b/include/wchar.h index bd6447b96..e461f7184 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -329,8 +329,10 @@ extern size_t wcrtomb (char *__restrict __s, wchar_t __wc, mbstate_t *__restrict __ps) __THROW; /* Return number of bytes in multibyte character pointed to by S. */ +#if 0 /* uClibc: disabled */ extern size_t __mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW; +#endif extern size_t mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW; @@ -721,8 +723,7 @@ extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, __const struct tm *__restrict __tp) __THROW; __END_NAMESPACE_C99 -# ifdef __USE_GNU -#ifdef __UCLIBC_HAS_XLOCALE__ +# if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ # include <xlocale.h> /* Similar to `wcsftime' but takes the information from @@ -731,7 +732,6 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, __const wchar_t *__restrict __format, __const struct tm *__restrict __tp, __locale_t __loc) __THROW; -#endif /* __UCLIBC_HAS_XLOCALE__ */ # endif /* The X/Open standard demands that most of the functions defined in |
