From bugs at busybox.net Wed Nov 7 02:44:32 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Nov 2007 02:44:32 -0800 Subject: [uClibc 0001577]: strtol accepts backtick as valid digit Message-ID: <07bae68f66f49e110558fb2e872b08f1@busybox.net> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1577 ====================================================================== Reported By: patchman Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1577 Category: Other Reproducibility: always Severity: trivial Priority: normal Status: assigned ====================================================================== Date Submitted: 11-07-2007 02:44 PST Last Modified: 11-07-2007 02:44 PST ====================================================================== Summary: strtol accepts backtick as valid digit Description: strtol will not report an error if a backtick is part of the number-string to convert. E.g. "5000`" will be converted to 50009. Looking at the code I see that this is a corner case that is not checked: ... digit = (((Wuchar)(*str - '0')) <= 9) ? (*str - '0') : ((*str >= 'A') ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */ : 40); if (digit >= base) { break; } ... A backtick is 0x60. So it is greater than 'A'. 0x20|0x60 is 0x80. 0x80-'a'+10 evaluates to '9' which is accepted as a valid digit. This piece of code occurs more than once in the code. The trunk seems to contain the bug, too. The solution would be to explicitly check for this case. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 11-07-07 02:44 patchman New Issue 11-07-07 02:44 patchman Status new => assigned 11-07-07 02:44 patchman Assigned To => uClibc ====================================================================== From bugs at busybox.net Wed Nov 7 03:12:54 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Nov 2007 03:12:54 -0800 Subject: [uClibc 0001577]: strtol accepts backtick as valid digit Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1577 ====================================================================== Reported By: patchman Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1577 Category: Other Reproducibility: always Severity: trivial Priority: normal Status: assigned ====================================================================== Date Submitted: 11-07-2007 02:44 PST Last Modified: 11-07-2007 03:12 PST ====================================================================== Summary: strtol accepts backtick as valid digit Description: strtol will not report an error if a backtick is part of the number-string to convert. E.g. "5000`" will be converted to 50009. Looking at the code I see that this is a corner case that is not checked: ... digit = (((Wuchar)(*str - '0')) <= 9) ? (*str - '0') : ((*str >= 'A') ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */ : 40); if (digit >= base) { break; } ... A backtick is 0x60. So it is greater than 'A'. 0x20|0x60 is 0x80. 0x80-'a'+10 evaluates to '9' which is accepted as a valid digit. This piece of code occurs more than once in the code. The trunk seems to contain the bug, too. The solution would be to explicitly check for this case. ====================================================================== ---------------------------------------------------------------------- patchman - 11-07-07 03:12 ---------------------------------------------------------------------- Similar code seems to exist in the floating point versions of this routines. At least when hexadecimal floats are enabled. Issue History Date Modified Username Field Change ====================================================================== 11-07-07 02:44 patchman New Issue 11-07-07 02:44 patchman Status new => assigned 11-07-07 02:44 patchman Assigned To => uClibc 11-07-07 03:12 patchman Note Added: 0002894 ====================================================================== From bugs at busybox.net Wed Nov 7 04:36:10 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Nov 2007 04:36:10 -0800 Subject: [uClibc 0001577]: strtol accepts backtick as valid digit Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1577 ====================================================================== Reported By: patchman Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1577 Category: Other Reproducibility: always Severity: trivial Priority: normal Status: assigned ====================================================================== Date Submitted: 11-07-2007 02:44 PST Last Modified: 11-07-2007 04:36 PST ====================================================================== Summary: strtol accepts backtick as valid digit Description: strtol will not report an error if a backtick is part of the number-string to convert. E.g. "5000`" will be converted to 50009. Looking at the code I see that this is a corner case that is not checked: ... digit = (((Wuchar)(*str - '0')) <= 9) ? (*str - '0') : ((*str >= 'A') ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */ : 40); if (digit >= base) { break; } ... A backtick is 0x60. So it is greater than 'A'. 0x20|0x60 is 0x80. 0x80-'a'+10 evaluates to '9' which is accepted as a valid digit. This piece of code occurs more than once in the code. The trunk seems to contain the bug, too. The solution would be to explicitly check for this case. ====================================================================== ---------------------------------------------------------------------- patchman - 11-07-07 03:12 ---------------------------------------------------------------------- Similar code seems to exist in the floating point versions of this routines. At least when hexadecimal floats are enabled. ---------------------------------------------------------------------- patchman - 11-07-07 04:36 ---------------------------------------------------------------------- Small correction: 0x20|0x60 is 0x60. 0x60-'a'+10 evaluates to 9. I append a patch that will fix this - maybe there is a more elegant way ... Issue History Date Modified Username Field Change ====================================================================== 11-07-07 02:44 patchman New Issue 11-07-07 02:44 patchman Status new => assigned 11-07-07 02:44 patchman Assigned To => uClibc 11-07-07 03:12 patchman Note Added: 0002894 11-07-07 04:36 patchman Note Added: 0002895 ====================================================================== From carmelo at uclibc.org Wed Nov 7 07:14:51 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Wed, 7 Nov 2007 07:14:51 -0800 (PST) Subject: svn commit: trunk/uClibc: extra/Configs include ldso/include ldso etc... Message-ID: <20071107151451.8B025A65AA@busybox.net> Author: carmelo Date: 2007-11-07 07:14:50 -0800 (Wed, 07 Nov 2007) New Revision: 20378 Log: Added support for GNU hash style into dynamic linker Modified: trunk/uClibc/Rules.mak trunk/uClibc/extra/Configs/Config.in trunk/uClibc/include/elf.h trunk/uClibc/ldso/include/dl-elf.h trunk/uClibc/ldso/include/dl-hash.h trunk/uClibc/ldso/include/ldso.h trunk/uClibc/ldso/ldso/dl-hash.c trunk/uClibc/test/Rules.mak Changeset: Modified: trunk/uClibc/Rules.mak =================================================================== --- trunk/uClibc/Rules.mak 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/Rules.mak 2007-11-07 15:14:50 UTC (rev 20378) @@ -408,6 +408,16 @@ LDFLAGS_NOSTRIP+=-Wl,-z,now endif +ifeq ($(LDSO_GNU_HASH_SUPPORT),y) +# Be sure that binutils support it +LDFLAGS_GNUHASH :=$(call check_ld,--hash-style=gnu) +ifeq ($(LDFLAGS_GNUHASH),) +$(error Your binutils don't support --hash-style option, while you want to use it) +else +LDFLAGS_NOSTRIP += -Wl,$(LDFLAGS_GNUHASH) +endif +endif + LDFLAGS:=$(LDFLAGS_NOSTRIP) -Wl,-z,defs ifeq ($(DODEBUG),y) #CFLAGS += -g3 Modified: trunk/uClibc/extra/Configs/Config.in =================================================================== --- trunk/uClibc/extra/Configs/Config.in 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/extra/Configs/Config.in 2007-11-07 15:14:50 UTC (rev 20378) @@ -322,6 +322,21 @@ or dtors and want your binaries to be as small as possible, then answer N. +config LDSO_GNU_HASH_SUPPORT + bool "Enable GNU hash style support" + depends on HAVE_SHARED + default n + help + Newest binutils support a new hash style named GNU-hash. The dynamic + linker will use the new GNU-hash section (.gnu.hash) for symbol lookup + if present into the ELF binaries, otherwise it will use the old SysV + hash style (.hash). This ensures that it is completely backward compatible. + Further, being the hash table implementation self-contained into each + executable and shared libraries, objects with mixed hash style can + peacefully coexist in the same process. + + If you want to use this new feature, answer Y + config HAS_NO_THREADS bool default n Modified: trunk/uClibc/include/elf.h =================================================================== --- trunk/uClibc/include/elf.h 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/include/elf.h 2007-11-07 15:14:50 UTC (rev 20378) @@ -431,6 +431,7 @@ #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ #define SHT_NUM 19 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ @@ -813,6 +814,7 @@ If any adjustment is made to the ELF object after it has been built these entries will need to be adjusted. */ #define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ #define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ #define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ #define DT_CONFIG 0x6ffffefa /* Configuration information. */ Modified: trunk/uClibc/ldso/include/dl-elf.h =================================================================== --- trunk/uClibc/ldso/include/dl-elf.h 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/ldso/include/dl-elf.h 2007-11-07 15:14:50 UTC (rev 20378) @@ -84,8 +84,11 @@ #endif /* OS and/or GNU dynamic extensions */ -#define OS_NUM 1 -#define DT_RELCONT_IDX DT_NUM +#ifdef __LDSO_GNU_HASH_SUPPORT__ +# define OS_NUM 2 /* for DT_RELOCCOUNT and DT_GNU_HASH entries */ +#else +# define OS_NUM 1 /* for DT_RELOCCOUNT entry */ +#endif #ifndef ARCH_DYNAMIC_INFO /* define in arch specific code, if needed */ @@ -93,7 +96,14 @@ #endif #define DYNAMIC_SIZE (DT_NUM+OS_NUM+ARCH_NUM) +/* Keep ARCH specific entries into dynamic section at the end of the array */ +#define DT_RELCONT_IDX (DYNAMIC_SIZE - OS_NUM - ARCH_NUM) +#ifdef __LDSO_GNU_HASH_SUPPORT__ +/* GNU hash comes just after the relocation count */ +# define DT_GNU_HASH_IDX (DT_RELCONT_IDX + 1) +#endif + extern void _dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[], void *debug_addr, DL_LOADADDR_TYPE load_off); @@ -131,6 +141,10 @@ if (dpnt->d_tag == DT_FLAGS_1 && (dpnt->d_un.d_val & DF_1_NOW)) dynamic_info[DT_BIND_NOW] = 1; +#ifdef __LDSO_GNU_HASH_SUPPORT__ + if (dpnt->d_tag == DT_GNU_HASH) + dynamic_info[DT_GNU_HASH_IDX] = dpnt->d_un.d_ptr; +#endif } #ifdef ARCH_DYNAMIC_INFO else { @@ -149,6 +163,9 @@ ADJUST_DYN_INFO(DT_SYMTAB, load_off); ADJUST_DYN_INFO(DT_RELOC_TABLE_ADDR, load_off); ADJUST_DYN_INFO(DT_JMPREL, load_off); +#ifdef __LDSO_GNU_HASH_SUPPORT__ + ADJUST_DYN_INFO(DT_GNU_HASH_IDX, load_off); +#endif #undef ADJUST_DYN_INFO } Modified: trunk/uClibc/ldso/include/dl-hash.h =================================================================== --- trunk/uClibc/ldso/include/dl-hash.h 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/ldso/include/dl-hash.h 2007-11-07 15:14:50 UTC (rev 20378) @@ -40,14 +40,39 @@ unsigned short int init_flag; unsigned long rtld_flags; /* RTLD_GLOBAL, RTLD_NOW etc. */ Elf_Symndx nbucket; + +#ifdef __LDSO_GNU_HASH_SUPPORT__ + /* Data needed to support GNU hash style */ + Elf32_Word l_gnu_bitmask_idxbits; + Elf32_Word l_gnu_shift; + const ElfW(Addr) *l_gnu_bitmask; + + union + { + const Elf32_Word *l_gnu_chain_zero; + const Elf_Symndx *elf_buckets; + }; +#else Elf_Symndx *elf_buckets; +#endif + struct init_fini_list *init_fini; struct init_fini_list *rtld_local; /* keep tack of RTLD_LOCAL libs in same group */ /* * These are only used with ELF style shared libraries */ Elf_Symndx nchain; + +#ifdef __LDSO_GNU_HASH_SUPPORT__ + union + { + const Elf32_Word *l_gnu_buckets; + const Elf_Symndx *chains; + }; +#else Elf_Symndx *chains; +#endif + unsigned long dynamic_info[DYNAMIC_SIZE]; unsigned long n_phent; Modified: trunk/uClibc/ldso/include/ldso.h =================================================================== --- trunk/uClibc/ldso/include/ldso.h 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/ldso/include/ldso.h 2007-11-07 15:14:50 UTC (rev 20378) @@ -66,9 +66,17 @@ _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args); # define _dl_if_debug_dprint(fmt, args...) \ do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0) +# define _dl_assert(expr) \ + do { \ + if (!(expr)) { \ + __dl_debug_dprint("assert(%s)\n", #expr); \ + _dl_exit(45); \ + } \ + } while (0) #else -# define _dl_debug_dprint(fmt, args...) +# define __dl_debug_dprint(fmt, args...) # define _dl_if_debug_dprint(fmt, args...) +# define _dl_assert(expr) # define _dl_debug_file 2 #endif /* __SUPPORT_LD_DEBUG__ */ Modified: trunk/uClibc/ldso/ldso/dl-hash.c =================================================================== --- trunk/uClibc/ldso/ldso/dl-hash.c 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/ldso/ldso/dl-hash.c 2007-11-07 15:14:50 UTC (rev 20378) @@ -53,6 +53,19 @@ */ struct dyn_elf *_dl_handles = NULL; +#ifdef __LDSO_GNU_HASH_SUPPORT__ +/* This is the new hash function that is used by the ELF linker to generate the + * GNU hash table that each executable and library will have if --hash-style=[gnu,both] + * is passed to the linker. We need it to decode the GNU hash table. */ +static inline Elf_Symndx _dl_gnu_hash (const unsigned char *name) +{ + unsigned long h = 5381; + unsigned char c; + for (c = *name; c != '\0'; c = *++name) + h = h * 33 + c; + return h & 0xffffffff; +} +#endif /* 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 @@ -108,7 +121,30 @@ tpnt->libname = _dl_strdup(libname); tpnt->dynamic_addr = (ElfW(Dyn) *)dynamic_addr; tpnt->libtype = loaded_file; + +#ifdef __LDSO_GNU_HASH_SUPPORT__ + if (dynamic_info[DT_GNU_HASH_IDX] != 0) { + + Elf32_Word *hash32 = (Elf_Symndx*)dynamic_info[DT_GNU_HASH_IDX]; + + tpnt->nbucket = *hash32++; + Elf32_Word symbias = *hash32++; + Elf32_Word bitmask_nwords = *hash32++; + /* Must be a power of two. */ + _dl_assert ((bitmask_nwords & (bitmask_nwords - 1)) == 0); + tpnt->l_gnu_bitmask_idxbits = bitmask_nwords - 1; + tpnt->l_gnu_shift = *hash32++; + tpnt->l_gnu_bitmask = (ElfW(Addr) *) hash32; + hash32 += __ELF_NATIVE_CLASS / 32 * bitmask_nwords; + + tpnt->l_gnu_buckets = hash32; + hash32 += tpnt->nbucket; + tpnt->l_gnu_chain_zero = hash32 - symbias; + } else + /* Fall using old SysV hash table if GNU hash is not present */ +#endif + if (dynamic_info[DT_HASH] != 0) { hash_addr = (Elf_Symndx*)dynamic_info[DT_HASH]; tpnt->nbucket = *hash_addr++; @@ -124,22 +160,117 @@ } +/* Routine to check whether the symbol matches. */ +static __attribute_noinline__ const ElfW(Sym) * +check_match (const ElfW(Sym) *sym, char *strtab, const char* undef_name, int type_class) { + + if (type_class & (sym->st_shndx == SHN_UNDEF)) + /* undefined symbol itself */ + return NULL; + + if (sym->st_value == 0) + /* No value */ + return NULL; + + if (ELF_ST_TYPE(sym->st_info) > STT_FUNC + && ELF_ST_TYPE(sym->st_info) != STT_COMMON) + /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC + * and STT_COMMON entries since these are no + * code/data definitions + */ + return NULL; + + if (_dl_strcmp(strtab + sym->st_name, undef_name) != 0) + return NULL; + + /* This is the matching symbol */ + return sym; +} + + +#ifdef __LDSO_GNU_HASH_SUPPORT__ + +static __always_inline const ElfW(Sym) * +_dl_lookup_gnu_hash(struct elf_resolve *tpnt, ElfW(Sym) *symtab, unsigned long hash, + const char* undef_name, int type_class) { + + Elf_Symndx symidx; + const ElfW(Sym) *sym; + char *strtab; + + const ElfW(Addr) *bitmask = tpnt->l_gnu_bitmask; + + ElfW(Addr) bitmask_word = bitmask[(hash / __ELF_NATIVE_CLASS) & tpnt->l_gnu_bitmask_idxbits]; + + unsigned int hashbit1 = hash & (__ELF_NATIVE_CLASS - 1); + unsigned int hashbit2 = ((hash >> tpnt->l_gnu_shift) & (__ELF_NATIVE_CLASS - 1)); + + _dl_assert (bitmask != NULL); + + if (unlikely((bitmask_word >> hashbit1) & (bitmask_word >> hashbit2) & 1)) { + + Elf32_Word bucket = tpnt->l_gnu_buckets[hash % tpnt->nbucket]; + + if (bucket != 0) { + const Elf32_Word *hasharr = &tpnt->l_gnu_chain_zero[bucket]; + do { + if (((*hasharr ^ hash) >> 1) == 0) { + symidx = hasharr - tpnt->l_gnu_chain_zero; + strtab = (char *) (tpnt->dynamic_info[DT_STRTAB]); + sym = check_match (&symtab[symidx], strtab, undef_name, type_class); + if (sym != NULL) + return sym; + } + } while ((*hasharr++ & 1u) == 0); + } + } + /* No symbol found. */ + return NULL; +} +#endif + +static __always_inline const ElfW(Sym) * +_dl_lookup_sysv_hash(struct elf_resolve *tpnt, ElfW(Sym) *symtab, unsigned long hash, const char* undef_name, int type_class) { + + unsigned long hn; + char *strtab; + const ElfW(Sym) *sym; + Elf_Symndx symidx; + + /* Avoid calling .urem here. */ + do_rem(hn, hash, tpnt->nbucket); + strtab = (char *) (tpnt->dynamic_info[DT_STRTAB]); + + _dl_assert(tpnt->elf_buckets != NULL); + + for (symidx = tpnt->elf_buckets[hn]; symidx != STN_UNDEF; symidx = tpnt->chains[symidx]) { + sym = check_match (&symtab[symidx], strtab, undef_name, type_class); + if (sym != NULL) + /* At this point the symbol is that we are looking for */ + return sym; + } + /* No symbol found into the current module*/ + return NULL; +} + /* * This function resolves externals, and this is either called when we process * relocations or when we call an entry in the PLT table for the first time. */ char *_dl_find_hash(const char *name, struct dyn_elf *rpnt, struct elf_resolve *mytpnt, int type_class) { - struct elf_resolve *tpnt; - int si; - char *strtab; + struct elf_resolve *tpnt = NULL; ElfW(Sym) *symtab; - unsigned long elf_hash_number, hn; - const ElfW(Sym) *sym; + + unsigned long elf_hash_number = 0xffffffff; + const ElfW(Sym) *sym = NULL; + char *weak_result = NULL; - elf_hash_number = _dl_elf_hash((const unsigned char *)name); - +#ifdef __LDSO_GNU_HASH_SUPPORT__ + unsigned long gnu_hash_number = _dl_gnu_hash((const unsigned char *)name); +#endif + for (; rpnt; rpnt = rpnt->next) { tpnt = rpnt->dyn; @@ -165,29 +296,32 @@ if (tpnt->nbucket == 0) continue; - /* Avoid calling .urem here. */ - do_rem(hn, elf_hash_number, tpnt->nbucket); - symtab = (ElfW(Sym) *) tpnt->dynamic_info[DT_SYMTAB]; - strtab = (char *) (tpnt->dynamic_info[DT_STRTAB]); + symtab = (ElfW(Sym) *) (intptr_t) (tpnt->dynamic_info[DT_SYMTAB]); + +#ifdef __LDSO_GNU_HASH_SUPPORT__ + /* Prefer GNU hash style, if any */ + if(tpnt->l_gnu_bitmask) { + if((sym = _dl_lookup_gnu_hash(tpnt, symtab, gnu_hash_number, name, type_class)) != NULL) + /* If sym has been found, do not search further */ + break; + } else { +#endif + /* Use the old SysV-style hash table */ + + /* Calculate the old sysv hash number only once */ + if(elf_hash_number == 0xffffffff) + elf_hash_number = _dl_elf_hash((const unsigned char *)name); - for (si = tpnt->elf_buckets[hn]; si != STN_UNDEF; si = tpnt->chains[si]) { - sym = &symtab[si]; + if((sym = _dl_lookup_sysv_hash(tpnt, symtab, elf_hash_number, name, type_class)) != NULL ) + break; +#ifdef __LDSO_GNU_HASH_SUPPORT__ + } +#endif + } /* end of for (; rpnt; rpnt = rpnt->next) { */ - if (type_class & (sym->st_shndx == SHN_UNDEF)) - continue; - if (sym->st_value == 0) - continue; - if (ELF_ST_TYPE(sym->st_info) > STT_FUNC - && ELF_ST_TYPE(sym->st_info) != STT_COMMON) - /* Ignore all but STT_NOTYPE, STT_OBJECT, STT_FUNC - * and STT_COMMON entries since these are no - * code/data definitions - */ - continue; - if (_dl_strcmp(strtab + sym->st_name, name) != 0) - continue; - - switch (ELF_ST_BIND(sym->st_info)) { + if(sym) { + /* At this point we have found the requested symbol, do binding */ + switch (ELF_ST_BIND(sym->st_info)) { case STB_WEAK: #if 0 /* Perhaps we should support old style weak symbol handling @@ -200,7 +334,6 @@ return (char*) DL_RELOC_ADDR(tpnt->loadaddr, sym->st_value); default: /* Local symbols not handled here */ break; - } } } return weak_result; Modified: trunk/uClibc/test/Rules.mak =================================================================== --- trunk/uClibc/test/Rules.mak 2007-11-07 00:23:47 UTC (rev 20377) +++ trunk/uClibc/test/Rules.mak 2007-11-07 15:14:50 UTC (rev 20378) @@ -107,7 +107,12 @@ LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO) endif +ifeq ($(LDSO_GNU_HASH_SUPPORT),y) +# Check for binutils support is done on root Rules.mak +LDFLAGS += -Wl,${LDFLAGS_GNUHASH} +endif + # Filter output MAKEFLAGS += --no-print-directory ifneq ($(findstring s,$(MAKEFLAGS)),) From aldot at uclibc.org Wed Nov 7 12:35:39 2007 From: aldot at uclibc.org (aldot at uclibc.org) Date: Wed, 7 Nov 2007 12:35:39 -0800 (PST) Subject: svn commit: trunk/uClibc Message-ID: <20071107203539.65F9BA6886@busybox.net> Author: aldot Date: 2007-11-07 12:35:37 -0800 (Wed, 07 Nov 2007) New Revision: 20381 Log: - fix whitespace Modified: trunk/uClibc/Rules.mak Changeset: Modified: trunk/uClibc/Rules.mak =================================================================== --- trunk/uClibc/Rules.mak 2007-11-07 16:01:28 UTC (rev 20380) +++ trunk/uClibc/Rules.mak 2007-11-07 20:35:37 UTC (rev 20381) @@ -410,7 +410,7 @@ ifeq ($(LDSO_GNU_HASH_SUPPORT),y) # Be sure that binutils support it -LDFLAGS_GNUHASH :=$(call check_ld,--hash-style=gnu) +LDFLAGS_GNUHASH:=$(call check_ld,--hash-style=gnu) ifeq ($(LDFLAGS_GNUHASH),) $(error Your binutils don't support --hash-style option, while you want to use it) else From carmelo at uclibc.org Fri Nov 9 01:17:36 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Fri, 9 Nov 2007 01:17:36 -0800 (PST) Subject: svn commit: trunk/uClibc/ldso/include Message-ID: <20071109091736.8C79BA6808@busybox.net> Author: carmelo Date: 2007-11-09 01:17:35 -0800 (Fri, 09 Nov 2007) New Revision: 20388 Log: Define _dl_assert in libdl only if __DOASSERTS__ is defined. Thanks to Peter Mazinger Modified: trunk/uClibc/ldso/include/ldso.h Changeset: Modified: trunk/uClibc/ldso/include/ldso.h =================================================================== --- trunk/uClibc/ldso/include/ldso.h 2007-11-08 21:11:43 UTC (rev 20387) +++ trunk/uClibc/ldso/include/ldso.h 2007-11-09 09:17:35 UTC (rev 20388) @@ -65,20 +65,29 @@ # define __dl_debug_dprint(fmt, args...) \ _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args); # define _dl_if_debug_dprint(fmt, args...) \ - do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0) -# define _dl_assert(expr) \ + do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0) +#else +# define __dl_debug_dprint(fmt, args...) +# define _dl_if_debug_dprint(fmt, args...) +# define _dl_debug_file 2 +#endif /* __SUPPORT_LD_DEBUG__ */ + +#ifdef IS_IN_rtld +# ifdef __SUPPORT_LD_DEBUG__ +# define _dl_assert(expr) \ do { \ if (!(expr)) { \ __dl_debug_dprint("assert(%s)\n", #expr); \ _dl_exit(45); \ } \ } while (0) +# else +# define _dl_assert(expr) ((void)0) +# endif #else -# define __dl_debug_dprint(fmt, args...) -# define _dl_if_debug_dprint(fmt, args...) -# define _dl_assert(expr) -# define _dl_debug_file 2 -#endif /* __SUPPORT_LD_DEBUG__ */ +# include +# define _dl_assert(expr) assert(expr) +#endif #ifdef __SUPPORT_LD_DEBUG_EARLY__ # define _dl_debug_early(fmt, args...) __dl_debug_dprint(fmt, ## args) From bugs at busybox.net Fri Nov 9 01:44:10 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 9 Nov 2007 01:44:10 -0800 Subject: [uClibc 0001583]: segfault in _dl_get_ready_to_run Message-ID: <6c27368c9899de894ff5542c40ce8de7@busybox.net> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1583 ====================================================================== Reported By: tobias Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1583 Category: Architecture Specific Reproducibility: always Severity: crash Priority: normal Status: assigned ====================================================================== Date Submitted: 11-09-2007 01:44 PST Last Modified: 11-09-2007 01:44 PST ====================================================================== Summary: segfault in _dl_get_ready_to_run Description: I am using busybox/uclibc under an OpenEmbedded installation on an xscale board. Running portmap segfaults which can be traced down to a segfault in _dl_get_ready_to_run() ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 11-09-07 01:44 tobias New Issue 11-09-07 01:44 tobias Status new => assigned 11-09-07 01:44 tobias Assigned To => uClibc ====================================================================== From bugs at busybox.net Fri Nov 9 01:50:15 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 9 Nov 2007 01:50:15 -0800 Subject: [uClibc 0001583]: segfault in _dl_get_ready_to_run Message-ID: <1f5bfe61e9d77ec402e814f46cbc509f@busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1583 ====================================================================== Reported By: tobias Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1583 Category: Architecture Specific Reproducibility: always Severity: crash Priority: normal Status: assigned ====================================================================== Date Submitted: 11-09-2007 01:44 PST Last Modified: 11-09-2007 01:50 PST ====================================================================== Summary: segfault in _dl_get_ready_to_run Description: I am using busybox/uclibc under an OpenEmbedded installation on an xscale board. Running portmap segfaults which can be traced down to a segfault in _dl_get_ready_to_run() ====================================================================== ---------------------------------------------------------------------- tobias - 11-09-07 01:50 ---------------------------------------------------------------------- 577 ldso/ldso/ldso.c: No such file or directory. in ldso/ldso/ldso.c (gdb) print this_dpnt $1 = (Elf32_Dyn *) 0x936c4375 (gdb) print this_dpnt->d_tag Cannot access memory at address 0x936c4375 Issue History Date Modified Username Field Change ====================================================================== 11-09-07 01:44 tobias New Issue 11-09-07 01:44 tobias Status new => assigned 11-09-07 01:44 tobias Assigned To => uClibc 11-09-07 01:50 tobias Note Added: 0002902 ====================================================================== From carmelo at uclibc.org Fri Nov 9 05:04:27 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Fri, 9 Nov 2007 05:04:27 -0800 (PST) Subject: svn commit: trunk/uClibc: extra/locale Message-ID: <20071109130427.A8F213006E@busybox.net> Author: carmelo Date: 2007-11-09 05:04:26 -0800 (Fri, 09 Nov 2007) New Revision: 20395 Log: Fix build system to generate locale data instead of using pregenerated ones Modified: trunk/uClibc/Makefile.in trunk/uClibc/extra/locale/Makefile.in Changeset: Modified: trunk/uClibc/Makefile.in =================================================================== --- trunk/uClibc/Makefile.in 2007-11-09 10:07:15 UTC (rev 20394) +++ trunk/uClibc/Makefile.in 2007-11-09 13:04:26 UTC (rev 20395) @@ -103,7 +103,7 @@ mv -f $$tmp include/bits/sysnum.h; \ fi ifeq ($(UCLIBC_HAS_LOCALE),y) - $(MAKE) locale_headers + $(MAKE) -C extra/locale locale_headers endif pregen: headers Modified: trunk/uClibc/extra/locale/Makefile.in =================================================================== --- trunk/uClibc/extra/locale/Makefile.in 2007-11-09 10:07:15 UTC (rev 20394) +++ trunk/uClibc/extra/locale/Makefile.in 2007-11-09 13:04:26 UTC (rev 20395) @@ -24,6 +24,8 @@ BUILD_CFLAGS-gen_ldc += -D__WCHAR_ENABLED=1 endif +BUILD_CFLAGS-gen_locale := -D_GNU_SOURCE + DEPH-locale := $(top_builddir)include/bits/sysnum.h DEPH-gen_locale := c8tables.h DEPH-gen_ldc := c8tables.h wctables.h locale_tables.h locale_collate.h @@ -161,7 +163,7 @@ $(locale_OUT)/uClibc_locale_data.h: $(locale_OUT)/lt_defines.h $(locale_OUT)/c8tables.h $(locale_OUT)/wctables.h $(locale_DIR)/locale_mmap.h | $(locale_SRC) grep -v "define __LC" $< > $@ - cat $(wordlist 2,3,4,$^) >> $@ + cat $(wordlist 2,4,$^) >> $@ endif From bugs at busybox.net Fri Nov 9 05:14:47 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 9 Nov 2007 05:14:47 -0800 Subject: [uClibc 0001583]: segfault in _dl_get_ready_to_run Message-ID: <5552f79a59ec0ccd8e6f4a6dac58ed71@bugs.uclibc.org> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1583 ====================================================================== Reported By: tobias Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1583 Category: Architecture Specific Reproducibility: always Severity: crash Priority: normal Status: assigned ====================================================================== Date Submitted: 11-09-2007 01:44 PST Last Modified: 11-09-2007 05:14 PST ====================================================================== Summary: segfault in _dl_get_ready_to_run Description: I am using busybox/uclibc under an OpenEmbedded installation on an xscale board. Running portmap segfaults which can be traced down to a segfault in _dl_get_ready_to_run() ====================================================================== ---------------------------------------------------------------------- tobias - 11-09-07 01:50 ---------------------------------------------------------------------- 577 ldso/ldso/ldso.c: No such file or directory. in ldso/ldso/ldso.c (gdb) print this_dpnt $1 = (Elf32_Dyn *) 0x936c4375 (gdb) print this_dpnt->d_tag Cannot access memory at address 0x936c4375 ---------------------------------------------------------------------- tobias - 11-09-07 05:14 ---------------------------------------------------------------------- Same behavior with a daily subversion snapshot. snapshot used: http://www.angstrom-distribution.org/unstable/sources/uClibc_uclibc.org_.trunk_20388_.tar.gz Which is from today (Nov 9th) Issue History Date Modified Username Field Change ====================================================================== 11-09-07 01:44 tobias New Issue 11-09-07 01:44 tobias Status new => assigned 11-09-07 01:44 tobias Assigned To => uClibc 11-09-07 01:50 tobias Note Added: 0002902 11-09-07 05:14 tobias Note Added: 0002903 ====================================================================== From kraj at uclibc.org Fri Nov 9 22:42:46 2007 From: kraj at uclibc.org (kraj at uclibc.org) Date: Fri, 9 Nov 2007 22:42:46 -0800 (PST) Subject: svn commit: trunk/uClibc/libc/misc/mntent Message-ID: <20071110064246.C82CFA69F5@busybox.net> Author: kraj Date: 2007-11-09 22:42:45 -0800 (Fri, 09 Nov 2007) New Revision: 20406 Log: Do not return error when fprintf returns 0 in addmntent(). fprintf is considered failing if the return is less than 0 Modified: trunk/uClibc/libc/misc/mntent/mntent.c Changeset: Modified: trunk/uClibc/libc/misc/mntent/mntent.c =================================================================== --- trunk/uClibc/libc/misc/mntent/mntent.c 2007-11-10 03:24:21 UTC (rev 20405) +++ trunk/uClibc/libc/misc/mntent/mntent.c 2007-11-10 06:42:45 UTC (rev 20406) @@ -98,11 +98,8 @@ if (fseek(filep, 0, SEEK_END) < 0) return 1; - if (fprintf (filep, "%s %s %s %s %d %d\n", mnt->mnt_fsname, mnt->mnt_dir, - mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq, mnt->mnt_passno) < 1) - return 1; - - return 0; + return (fprintf (filep, "%s %s %s %s %d %d\n", mnt->mnt_fsname, mnt->mnt_dir, + mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq, mnt->mnt_passno) < 0 ? 1 : 0); } char *hasmntopt(const struct mntent *mnt, const char *opt) From ricardw at uclibc.org Mon Nov 12 04:08:32 2007 From: ricardw at uclibc.org (ricardw at uclibc.org) Date: Mon, 12 Nov 2007 04:08:32 -0800 (PST) Subject: svn commit: trunk/uClibc/libc/string: cris Message-ID: <20071112120832.4A1783004E@busybox.net> Author: ricardw Date: 2007-11-12 04:08:31 -0800 (Mon, 12 Nov 2007) New Revision: 20410 Log: CRIS/CRISv32 architecture specific memcpy, memmove and memset. Added: trunk/uClibc/libc/string/cris/ trunk/uClibc/libc/string/cris/memcopy.h trunk/uClibc/libc/string/cris/memcpy.c trunk/uClibc/libc/string/cris/memmove.c trunk/uClibc/libc/string/cris/memset.c Changeset: Property changes on: trunk/uClibc/libc/string/cris ___________________________________________________________________ Name: svn:ignore + *.os Added: trunk/uClibc/libc/string/cris/memcopy.h =================================================================== --- trunk/uClibc/libc/string/cris/memcopy.h (rev 0) +++ trunk/uClibc/libc/string/cris/memcopy.h 2007-11-12 12:08:31 UTC (rev 20410) @@ -0,0 +1,62 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + Modified for use in uClibc (C) 2007 Axis Communications AB. + Minimal modifications: include path name and #undef of WORD_COPY_FWD/BWD + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "../generic/memcopy.h" + +/* We override the word-copying macros, partly because misalignment in one + pointer isn't cause for a special function, partly because we want to + get rid of all the static functions in generic/memcopy.c; these macros + are only used in memmove.c since we have arch-specific mempcpy, memcpy and + memset. */ + +#undef OP_T_THRES +#define OP_T_THRES OPSIZ + +#undef WORD_COPY_FWD +#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \ + do \ + { \ + unsigned long enddst_bp = dst_bp + nbytes - (nbytes % OPSIZ); \ + nbytes_left = (nbytes % OPSIZ); \ + while (dst_bp < (unsigned long) enddst_bp) \ + { \ + op_t x = *(op_t *) src_bp; \ + src_bp += sizeof x; \ + *(op_t *) dst_bp = x; \ + dst_bp += sizeof x; \ + } \ + } while (0) + +#undef WORD_COPY_BWD +#define WORD_COPY_BWD(dst_bp, src_bp, nbytes_left, nbytes) \ + do \ + { \ + unsigned long enddst_bp = dst_bp - nbytes + (nbytes % OPSIZ); \ + nbytes_left = (nbytes % OPSIZ); \ + while (dst_bp > enddst_bp) \ + { \ + op_t x; \ + src_bp -= sizeof x; \ + x = *(op_t *) src_bp; \ + dst_bp -= sizeof x; \ + *(op_t *) dst_bp = x; \ + } \ + } while (0) Added: trunk/uClibc/libc/string/cris/memcpy.c =================================================================== --- trunk/uClibc/libc/string/cris/memcpy.c (rev 0) +++ trunk/uClibc/libc/string/cris/memcpy.c 2007-11-12 12:08:31 UTC (rev 20410) @@ -0,0 +1,264 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 2000 Axis Communications AB. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/*#************************************************************************#*/ +/*#-------------------------------------------------------------------------*/ +/*# */ +/*# FUNCTION NAME: memcpy() */ +/*# */ +/*# PARAMETERS: void* dst; Destination address. */ +/*# void* src; Source address. */ +/*# int len; Number of bytes to copy. */ +/*# */ +/*# RETURNS: dst. */ +/*# */ +/*# DESCRIPTION: Copies len bytes of memory from src to dst. No guarantees */ +/*# about copying of overlapping memory areas. This routine is */ +/*# very sensitive to compiler changes in register allocation. */ +/*# Should really be rewritten to avoid this problem. */ +/*# */ +/*#-------------------------------------------------------------------------*/ +/*# */ +/*# HISTORY */ +/*# */ +/*# DATE NAME CHANGES */ +/*# ---- ---- ------- */ +/*# 941007 Kenny R Creation */ +/*# 941011 Kenny R Lots of optimizations and inlining. */ +/*# 941129 Ulf A Adapted for use in libc. */ +/*# 950216 HP N==0 forgotten if non-aligned src/dst. */ +/*# Added some optimizations. */ +/*# 001025 HP Make src and dst char *. Align dst to */ +/*# dword, not just word-if-both-src-and-dst- */ +/*# are-misaligned. */ +/*# 070806 RW Modified for uClibc */ +/*# (__arch_v32 -> __CONFIG_CRISV32__, */ +/*# include features.h to reach it.) */ +/*# */ +/*#-------------------------------------------------------------------------*/ + +#include + +#ifdef __CONFIG_CRISV32__ +/* For CRISv32, movem is very cheap. */ +#define MEMCPY_BLOCK_THRESHOLD (44) +#else +/* Break even between movem and move16 is at 38.7*2, but modulo 44. */ +#define MEMCPY_BLOCK_THRESHOLD (44*2) +#endif + +void *memcpy(void *, const void *, unsigned int); + +libc_hidden_proto(memcpy) +void *memcpy(void *pdst, + const void *psrc, + unsigned int pn) +{ + /* Ok. Now we want the parameters put in special registers. + Make sure the compiler is able to make something useful of this. + As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). + + If gcc was allright, it really would need no temporaries, and no + stack space to save stuff on. */ + +#ifndef MEMPCPY + register void *return_dst __asm__ ("r10") = pdst; +#else + /* FIXME: Use R10 for something. */ +# define return_dst dst +#endif + + register char *dst __asm__ ("r13") = pdst; + register char *src __asm__ ("r11") = (char *) psrc; + register int n __asm__ ("r12") = pn; + + + /* When src is aligned but not dst, this makes a few extra needless + cycles. I believe it would take as many to check that the + re-alignment was unnecessary. */ + if (((unsigned long) dst & 3) != 0 + /* Don't align if we wouldn't copy more than a few bytes; so we + don't have to check further for overflows. */ + && n >= 3) + { + if ((unsigned long) dst & 1) + { + n--; + *(char*)dst = *(char*)src; + src++; + dst++; + } + + if ((unsigned long) dst & 2) + { + n -= 2; + *(short*)dst = *(short*)src; + src += 2; + dst += 2; + } + } + + /* Decide which copying method to use. */ + if (n >= MEMCPY_BLOCK_THRESHOLD) + { + /* For large copies we use 'movem' */ + + /* It is not optimal to tell the compiler about clobbering any + registers; that will move the saving/restoring of those registers + to the function prologue/epilogue, and make non-movem sizes + suboptimal. + + This method is not foolproof; it assumes that the "register asm" + declarations at the beginning of the function really are used + here (beware: they may be moved to temporary registers). + This way, we do not have to save/move the registers around into + temporaries; we can safely use them straight away. */ + __asm__ volatile ("\ + .syntax no_register_prefix \n\ + \n\ + ;; Check that the register asm declaration got right. \n\ + ;; The GCC manual explicitly says TRT will happen. \n\ + .ifnc %0-%1-%2,$r13-$r11-$r12 \n\ + .err \n\ + .endif \n\ + \n\ + ;; Save the registers we'll use in the movem process \n\ + ;; on the stack. \n\ + subq 11*4,sp \n\ + movem r10,[sp] \n\ + \n\ + ;; Now we've got this: \n\ + ;; r11 - src \n\ + ;; r13 - dst \n\ + ;; r12 - n \n\ + \n\ + ;; Update n for the first loop \n\ + subq 44,r12 \n\ +0: \n\ + movem [r11+],r10 \n\ + subq 44,r12 \n\ + bge 0b \n\ + movem r10,[r13+] \n\ + \n\ + addq 44,r12 ;; compensate for last loop underflowing n \n\ + \n\ + ;; Restore registers from stack \n\ + movem [sp+],r10" + + /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n) + /* Inputs */ : "0" (dst), "1" (src), "2" (n)); + } + + /* Either we directly starts copying, using dword copying + in a loop, or we copy as much as possible with 'movem' + and then the last block (<44 bytes) is copied here. + This will work since 'movem' will have updated src,dst,n. */ + + while ( n >= 16 ) + { + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + n -= 16; + } + + /* A switch() is definitely the fastest although it takes a LOT of code. + * Particularly if you inline code this. + */ + switch (n) + { + case 0: + break; + case 1: + *((char*)dst)++ = *((char*)src)++; + break; + case 2: + *((short*)dst)++ = *((short*)src)++; + break; + case 3: + *((short*)dst)++ = *((short*)src)++; + *((char*)dst)++ = *((char*)src)++; + break; + case 4: + *((long*)dst)++ = *((long*)src)++; + break; + case 5: + *((long*)dst)++ = *((long*)src)++; + *((char*)dst)++ = *((char*)src)++; + break; + case 6: + *((long*)dst)++ = *((long*)src)++; + *((short*)dst)++ = *((short*)src)++; + break; + case 7: + *((long*)dst)++ = *((long*)src)++; + *((short*)dst)++ = *((short*)src)++; + *((char*)dst)++ = *((char*)src)++; + break; + case 8: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + break; + case 9: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((char*)dst)++ = *((char*)src)++; + break; + case 10: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((short*)dst)++ = *((short*)src)++; + break; + case 11: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((short*)dst)++ = *((short*)src)++; + *((char*)dst)++ = *((char*)src)++; + break; + case 12: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + break; + case 13: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((char*)dst)++ = *((char*)src)++; + break; + case 14: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((short*)dst)++ = *((short*)src)++; + break; + case 15: + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((long*)dst)++ = *((long*)src)++; + *((short*)dst)++ = *((short*)src)++; + *((char*)dst)++ = *((char*)src)++; + break; + } + + return return_dst; /* destination pointer. */ +} /* memcpy() */ +libc_hidden_def(memcpy) Added: trunk/uClibc/libc/string/cris/memmove.c =================================================================== --- trunk/uClibc/libc/string/cris/memmove.c (rev 0) +++ trunk/uClibc/libc/string/cris/memmove.c 2007-11-12 12:08:31 UTC (rev 20410) @@ -0,0 +1,101 @@ +/* Taken from generic/memmove.c; trivially modified to work with + arch-specific memcopy.h for Cris. + + Copy memory to memory until the specified number of bytes + has been copied. Overlap is handled correctly. + Copyright (C) 1991, 1995, 1996, 1997, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Torbjorn Granlund (tege at sics.se). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "memcopy.h" +#include "../generic/pagecopy.h" + +libc_hidden_proto(memmove) +void *memmove (void *dest, const void *src, size_t len) +{ + unsigned long int dstp = (long int) dest; + unsigned long int srcp = (long int) src; + + /* This test makes the forward copying code be used whenever possible. + Reduces the working set. */ + if (dstp - srcp >= len) /* *Unsigned* compare! */ + { +#if 1 +#warning REMINDER: Cris arch-opt memmove assumes memcpy does forward copying! + memcpy(dest, src, len); +#else + /* Copy from the beginning to the end. */ + + /* If there not too few bytes to copy, use word copy. */ + if (len >= OP_T_THRES) + { + /* Copy just a few bytes to make DSTP aligned. */ + len -= (-dstp) % OPSIZ; + BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ); + + /* Copy whole pages from SRCP to DSTP by virtual address + manipulation, as much as possible. */ + + PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len); + + /* Copy from SRCP to DSTP taking advantage of the known + alignment of DSTP. Number of bytes remaining is put + in the third argument, i.e. in LEN. This number may + vary from machine to machine. */ + + WORD_COPY_FWD (dstp, srcp, len, len); + + /* Fall out and copy the tail. */ + } + + /* There are just a few bytes to copy. Use byte memory operations. */ + BYTE_COPY_FWD (dstp, srcp, len); +#endif + } + else + { + /* Copy from the end to the beginning. */ + srcp += len; + dstp += len; + + /* If there not too few bytes to copy, use word copy. */ + if (len >= OP_T_THRES) + { + /* Copy just a few bytes to make DSTP aligned. */ + len -= dstp % OPSIZ; + BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ); + + /* Copy from SRCP to DSTP taking advantage of the known + alignment of DSTP. Number of bytes remaining is put + in the third argument, i.e. in LEN. This number may + vary from machine to machine. */ + + WORD_COPY_BWD (dstp, srcp, len, len); + + /* Fall out and copy the tail. */ + } + + /* There are just a few bytes to copy. Use byte memory operations. */ + BYTE_COPY_BWD (dstp, srcp, len); + } + + return (dest); +} +libc_hidden_def(memmove) Added: trunk/uClibc/libc/string/cris/memset.c =================================================================== --- trunk/uClibc/libc/string/cris/memset.c (rev 0) +++ trunk/uClibc/libc/string/cris/memset.c 2007-11-12 12:08:31 UTC (rev 20410) @@ -0,0 +1,271 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Axis Communications AB. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/*#************************************************************************#*/ +/*#-------------------------------------------------------------------------*/ +/*# */ +/*# FUNCTION NAME: memset() */ +/*# */ +/*# PARAMETERS: void* dst; Destination address. */ +/*# int c; Value of byte to write. */ +/*# int len; Number of bytes to write. */ +/*# */ +/*# RETURNS: dst. */ +/*# */ +/*# DESCRIPTION: Sets the memory dst of length len bytes to c, as standard. */ +/*# Framework taken from memcpy. This routine is */ +/*# very sensitive to compiler changes in register allocation. */ +/*# Should really be rewritten to avoid this problem. */ +/*# */ +/*#-------------------------------------------------------------------------*/ +/*# */ +/*# HISTORY */ +/*# */ +/*# DATE NAME CHANGES */ +/*# ---- ---- ------- */ +/*# 990713 HP Tired of watching this function (or */ +/*# really, the nonoptimized generic */ +/*# implementation) take up 90% of simulator */ +/*# output. Measurements needed. */ +/*# */ +/*#-------------------------------------------------------------------------*/ + +/* No, there's no macro saying 12*4, since it is "hard" to get it into + the asm in a good way. Thus better to expose the problem everywhere. + */ + +/* Assuming 1 cycle per dword written or read (ok, not really true), and + one per instruction, then 43+3*(n/48-1) <= 24+24*(n/48-1) + so n >= 45.7; n >= 0.9; we win on the first full 48-byte block to set. */ + +#define ZERO_BLOCK_SIZE (1*12*4) + +void *memset(void *, int, unsigned long); + +libc_hidden_proto(memset) +void *memset(void *pdst, + int c, + unsigned long plen) +{ + /* Ok. Now we want the parameters put in special registers. + Make sure the compiler is able to make something useful of this. */ + + register char *return_dst __asm__ ("r10") = pdst; + register long n __asm__ ("r12") = plen; + register int lc __asm__ ("r11") = c; + + /* Most apps use memset sanely. Only those memsetting about 3..4 + bytes or less get penalized compared to the generic implementation + - and that's not really sane use. */ + + /* Ugh. This is fragile at best. Check with newer GCC releases, if + they compile cascaded "x |= x << 8" sanely! */ + __asm__("movu.b %0,$r13 \n\ + lslq 8,$r13 \n\ + move.b %0,$r13 \n\ + move.d $r13,%0 \n\ + lslq 16,$r13 \n\ + or.d $r13,%0" + : "=r" (lc) : "0" (lc) : "r13"); + + { + register char *dst __asm__ ("r13") = pdst; + + if (((unsigned long) pdst & 3) != 0 + /* Oops! n=0 must be a legal call, regardless of alignment. */ + && n >= 3) + { + if ((unsigned long)dst & 1) + { + *dst = (char) lc; + n--; + dst++; + } + + if ((unsigned long)dst & 2) + { + *(short *)dst = lc; + n -= 2; + dst += 2; + } + } + + /* Now the fun part. For the threshold value of this, check the equation + above. */ + /* Decide which copying method to use. */ + if (n >= ZERO_BLOCK_SIZE) + { + /* For large copies we use 'movem' */ + + /* It is not optimal to tell the compiler about clobbering any + registers; that will move the saving/restoring of those registers + to the function prologue/epilogue, and make non-movem sizes + suboptimal. + + This method is not foolproof; it assumes that the "asm reg" + declarations at the beginning of the function really are used + here (beware: they may be moved to temporary registers). + This way, we do not have to save/move the registers around into + temporaries; we can safely use them straight away. */ + __asm__ volatile (" \n\ + .syntax no_register_prefix \n\ + \n\ + ;; Check that the register asm declaration got right. \n\ + ;; The GCC manual explicitly says there's no warranty for that (too). \n\ + .ifnc %0-%1-%4,$r13-$r12-$r11 \n\ + .err \n\ + .endif \n\ + \n\ + ;; Save the registers we'll clobber in the movem process \n\ + ;; on the stack. Don't mention them to gcc, it will only be \n\ + ;; upset. \n\ + subq 11*4,sp \n\ + movem r10,[sp] \n\ + \n\ + move.d r11,r0 \n\ + move.d r11,r1 \n\ + move.d r11,r2 \n\ + move.d r11,r3 \n\ + move.d r11,r4 \n\ + move.d r11,r5 \n\ + move.d r11,r6 \n\ + move.d r11,r7 \n\ + move.d r11,r8 \n\ + move.d r11,r9 \n\ + move.d r11,r10 \n\ + \n\ + ;; Now we've got this: \n\ + ;; r13 - dst \n\ + ;; r12 - n \n\ + \n\ + ;; Update n for the first loop \n\ + subq 12*4,r12 \n\ +0: \n\ + subq 12*4,r12 \n\ + bge 0b \n\ + movem r11,[r13+] \n\ + \n\ + addq 12*4,r12 ;; compensate for last loop underflowing n \n\ + \n\ + ;; Restore registers from stack \n\ + movem [sp+],r10" + + /* Outputs */ : "=r" (dst), "=r" (n) + /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); + + } + + /* Either we directly starts copying, using dword copying + in a loop, or we copy as much as possible with 'movem' + and then the last block (<44 bytes) is copied here. + This will work since 'movem' will have updated src,dst,n. */ + + while ( n >= 16 ) + { + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + n -= 16; + } + + /* A switch() is definitely the fastest although it takes a LOT of code. + * Particularly if you inline code this. + */ + switch (n) + { + case 0: + break; + case 1: + *(char*)dst = (char) lc; + break; + case 2: + *(short*)dst = (short) lc; + break; + case 3: + *((short*)dst)++ = (short) lc; + *(char*)dst = (char) lc; + break; + case 4: + *((long*)dst)++ = lc; + break; + case 5: + *((long*)dst)++ = lc; + *(char*)dst = (char) lc; + break; + case 6: + *((long*)dst)++ = lc; + *(short*)dst = (short) lc; + break; + case 7: + *((long*)dst)++ = lc; + *((short*)dst)++ = (short) lc; + *(char*)dst = (char) lc; + break; + case 8: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + break; + case 9: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *(char*)dst = (char) lc; + break; + case 10: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *(short*)dst = (short) lc; + break; + case 11: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((short*)dst)++ = (short) lc; + *(char*)dst = (char) lc; + break; + case 12: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + break; + case 13: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *(char*)dst = (char) lc; + break; + case 14: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *(short*)dst = (short) lc; + break; + case 15: + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((long*)dst)++ = lc; + *((short*)dst)++ = (short) lc; + *(char*)dst = (char) lc; + break; + } + } + + return return_dst; /* destination pointer. */ +} /* memset() */ +libc_hidden_def(memset) From sjhill at uclibc.org Mon Nov 12 20:05:32 2007 From: sjhill at uclibc.org (sjhill at uclibc.org) Date: Mon, 12 Nov 2007 20:05:32 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/libpthread/nptl/sysdeps: sh unix unix/sh unix/sysv/linux/sh unix/ etc... Message-ID: <20071113040532.57AB8A65CC@busybox.net> Author: sjhill Date: 2007-11-12 20:05:31 -0800 (Mon, 12 Nov 2007) New Revision: 20412 Log: Begin merging of SuperH NPTL port. See the mailing list for further information. Added: branches/uClibc-nptl/libpthread/nptl/sysdeps/sh/Makefile.arch branches/uClibc-nptl/libpthread/nptl/sysdeps/sh/sysdep.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sh/ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sh/sysdep.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sh4/sysdep.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep.h Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/sh/jmpbuf-unwind.h branches/uClibc-nptl/libpthread/nptl/sysdeps/sh/tls.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/createthread.c branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/fork.c branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevel-atomic.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/not-cancel.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_timedwait.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_trywait.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sem_wait.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S Changeset: Sorry, the patch is too large to include (1571 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20412 From carmelo at uclibc.org Fri Nov 16 06:26:50 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Fri, 16 Nov 2007 06:26:50 -0800 (PST) Subject: svn commit: trunk/uClibc: extra/Configs extra/Configs/defconfigs etc... Message-ID: <20071116142650.C38D530040@busybox.net> Author: carmelo Date: 2007-11-16 06:26:46 -0800 (Fri, 16 Nov 2007) New Revision: 20437 Log: Added AVR32 support to uClibc. Signed-off-by: Hans-Christian Egtvedt Added: trunk/uClibc/extra/Configs/Config.avr32 trunk/uClibc/extra/Configs/defconfigs/avr32 trunk/uClibc/ldso/ldso/avr32/ trunk/uClibc/ldso/ldso/avr32/dl-debug.h trunk/uClibc/ldso/ldso/avr32/dl-startup.h trunk/uClibc/ldso/ldso/avr32/dl-syscalls.h trunk/uClibc/ldso/ldso/avr32/dl-sysdep.h trunk/uClibc/ldso/ldso/avr32/elfinterp.c trunk/uClibc/ldso/ldso/avr32/resolve.S trunk/uClibc/libc/string/avr32/ trunk/uClibc/libc/string/avr32/Makefile trunk/uClibc/libc/string/avr32/bcopy.S trunk/uClibc/libc/string/avr32/bzero.S trunk/uClibc/libc/string/avr32/memcmp.S trunk/uClibc/libc/string/avr32/memcpy.S trunk/uClibc/libc/string/avr32/memmove.S trunk/uClibc/libc/string/avr32/memset.S trunk/uClibc/libc/string/avr32/strcmp.S trunk/uClibc/libc/string/avr32/strlen.S trunk/uClibc/libc/sysdeps/linux/avr32/ trunk/uClibc/libc/sysdeps/linux/avr32/Makefile trunk/uClibc/libc/sysdeps/linux/avr32/Makefile.arch trunk/uClibc/libc/sysdeps/linux/avr32/__longjmp.S trunk/uClibc/libc/sysdeps/linux/avr32/bits/ trunk/uClibc/libc/sysdeps/linux/avr32/bits/atomic.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/byteswap.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/endian.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/fcntl.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/kernel_stat.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/kernel_types.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/mman.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/setjmp.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/stackinfo.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/syscalls.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h trunk/uClibc/libc/sysdeps/linux/avr32/bits/wordsize.h trunk/uClibc/libc/sysdeps/linux/avr32/brk.c trunk/uClibc/libc/sysdeps/linux/avr32/bsd-_setjmp.S trunk/uClibc/libc/sysdeps/linux/avr32/bsd-setjmp.S trunk/uClibc/libc/sysdeps/linux/avr32/clone.c trunk/uClibc/libc/sysdeps/linux/avr32/crt1.S trunk/uClibc/libc/sysdeps/linux/avr32/crti.S trunk/uClibc/libc/sysdeps/linux/avr32/crtn.S trunk/uClibc/libc/sysdeps/linux/avr32/mmap.c trunk/uClibc/libc/sysdeps/linux/avr32/setjmp.S trunk/uClibc/libc/sysdeps/linux/avr32/sigaction.c trunk/uClibc/libc/sysdeps/linux/avr32/sigrestorer.S trunk/uClibc/libc/sysdeps/linux/avr32/sys/ trunk/uClibc/libc/sysdeps/linux/avr32/sys/elf.h trunk/uClibc/libc/sysdeps/linux/avr32/sys/procfs.h trunk/uClibc/libc/sysdeps/linux/avr32/sys/ucontext.h trunk/uClibc/libc/sysdeps/linux/avr32/sys/user.h trunk/uClibc/libc/sysdeps/linux/avr32/syscall.S trunk/uClibc/libc/sysdeps/linux/avr32/vfork.S trunk/uClibc/libpthread/linuxthreads.old/sysdeps/avr32/ trunk/uClibc/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h trunk/uClibc/libpthread/linuxthreads/sysdeps/avr32/ trunk/uClibc/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h Modified: trunk/uClibc/Rules.mak trunk/uClibc/extra/Configs/Config.in trunk/uClibc/include/elf.h trunk/uClibc/ldso/include/dl-string.h trunk/uClibc/ldso/ldso/dl-startup.c trunk/uClibc/utils/ldd.c Changeset: Sorry, the patch is too large to include (3405 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20437 From carmelo at uclibc.org Fri Nov 16 06:32:36 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Fri, 16 Nov 2007 06:32:36 -0800 (PST) Subject: svn commit: trunk/uClibc/ldso/ldso Message-ID: <20071116143236.AD5A330040@busybox.net> Author: carmelo Date: 2007-11-16 06:32:35 -0800 (Fri, 16 Nov 2007) New Revision: 20438 Log: If uClibc's ld.so encounters text relocations in a shared library - one containing an object built without -fpic/-fPIC - then: * If __FORCE_SHAREABLE_TEXT_SEGMENTS__, then it gives an error "Can't modify %s's text section. Use GCC option -fPIC for shared objects, please.\n" and exits. * Otherwise, it makes the library's pages writable and relocates it. If it encounters text relocations in a position-independent executable - one containing an object built without -fpie/-fPIE/-fpic/-fPIC - then: * If __FORCE_SHAREABLE_TEXT_SEGMENTS__, it does nothing about making the pages writable, leading to a crash. * Otherwise, the loop to make the pages writable uses the same variable ppnt as used in an outer loop, messing up that outer loop and also causing a crash. This patch fixes both cases, by giving an error if __FORCE_SHAREABLE_TEXT_SEGMENTS__ and saving and restoring ppnt otherwise. Tested in both cases on ARM EABI. Joseph S. Myers joseph at codesourcery.com Modified: trunk/uClibc/ldso/ldso/ldso.c Changeset: Modified: trunk/uClibc/ldso/ldso/ldso.c =================================================================== --- trunk/uClibc/ldso/ldso/ldso.c 2007-11-16 14:26:46 UTC (rev 20437) +++ trunk/uClibc/ldso/ldso/ldso.c 2007-11-16 14:32:35 UTC (rev 20438) @@ -286,6 +286,7 @@ _dl_debug_early("calling mprotect on the application program\n"); /* Now cover the application program. */ if (app_tpnt->dynamic_info[DT_TEXTREL]) { + ElfW(Phdr) *ppnt_outer = ppnt; ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val; for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) { if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W)) @@ -294,7 +295,13 @@ (unsigned long) ppnt->p_filesz, PROT_READ | PROT_WRITE | PROT_EXEC); } + ppnt = ppnt_outer; } +#else + if (app_tpnt->dynamic_info[DT_TEXTREL]) { + _dl_dprintf(_dl_debug_file, "Can't modify application's text section; use the GCC option -fPIE for position-independent executables.\n"); + _dl_exit(1); + } #endif #ifndef ALLOW_ZERO_PLTGOT From carmelo at uclibc.org Mon Nov 19 05:36:59 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Mon, 19 Nov 2007 05:36:59 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/test: dlopen math misc nptl rpc setjmp string etc... Message-ID: <20071119133659.1F877A6881@busybox.net> Author: carmelo Date: 2007-11-19 05:36:57 -0800 (Mon, 19 Nov 2007) New Revision: 20453 Log: Push back various fixes in testcases Added: branches/uClibc-nptl/test/setjmp/setjmp_test.c branches/uClibc-nptl/test/string/string.c branches/uClibc-nptl/test/unistd/preadwrite.c Modified: branches/uClibc-nptl/test/Makefile branches/uClibc-nptl/test/Rules.mak branches/uClibc-nptl/test/Test.mak branches/uClibc-nptl/test/dlopen/Makefile branches/uClibc-nptl/test/math/Makefile branches/uClibc-nptl/test/misc/seek.c branches/uClibc-nptl/test/nptl/tst-mqueue1.c branches/uClibc-nptl/test/rpc/Makefile branches/uClibc-nptl/test/time/tst-ftime_l.c branches/uClibc-nptl/test/tls/tst-tls6.c Changeset: Sorry, the patch is too large to include (1993 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20453 From carmelo at uclibc.org Mon Nov 19 05:54:04 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Mon, 19 Nov 2007 05:54:04 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/ldso: include ldso ldso/sh libdl Message-ID: <20071119135404.AF1D030057@busybox.net> Author: carmelo Date: 2007-11-19 05:54:03 -0800 (Mon, 19 Nov 2007) New Revision: 20454 Log: Added GNU hash support to ld.so Added TLS support to sh4 Replaced _dl_find_hash implementation with sh4 based code. Merged some fixes into libdl.c Changes committes as requested by sjhill for the mips-sh4 nptl merge. Signed-off-by: Carmelo Amoroso Modified: branches/uClibc-nptl/ldso/include/dl-elf.h branches/uClibc-nptl/ldso/include/dl-hash.h branches/uClibc-nptl/ldso/include/ldsodefs.h branches/uClibc-nptl/ldso/ldso/Makefile.in branches/uClibc-nptl/ldso/ldso/dl-elf.c branches/uClibc-nptl/ldso/ldso/dl-hash.c branches/uClibc-nptl/ldso/ldso/dl-tls.c branches/uClibc-nptl/ldso/ldso/ldso.c branches/uClibc-nptl/ldso/ldso/sh/dl-debug.h branches/uClibc-nptl/ldso/ldso/sh/dl-startup.h branches/uClibc-nptl/ldso/ldso/sh/dl-sysdep.h branches/uClibc-nptl/ldso/ldso/sh/elfinterp.c branches/uClibc-nptl/ldso/libdl/Makefile.in branches/uClibc-nptl/ldso/libdl/libdl.c Changeset: Sorry, the patch is too large to include (1453 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20454 From carmelo at uclibc.org Mon Nov 19 07:35:12 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Mon, 19 Nov 2007 07:35:12 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/libpthread: nptl nptl/sysdeps/generic nptl/sysdeps/p etc... Message-ID: <20071119153512.06F82A6813@busybox.net> Author: carmelo Date: 2007-11-19 07:35:12 -0800 (Mon, 19 Nov 2007) New Revision: 20455 Log: Synch nptl branch with SH port: as requested by sjhill for mips-ash4 merge Added: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysdep.h branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/sigwait.c branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S Modified: branches/uClibc-nptl/libpthread/nptl/Makefile.in branches/uClibc-nptl/libpthread/nptl/cancellation.c branches/uClibc-nptl/libpthread/nptl/descr.h branches/uClibc-nptl/libpthread/nptl/forward.c branches/uClibc-nptl/libpthread/nptl/init.c branches/uClibc-nptl/libpthread/nptl/pt-system.c branches/uClibc-nptl/libpthread/nptl/pthread_cancel.c branches/uClibc-nptl/libpthread/nptl/res.c branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/dl-support.c branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/dl-tls.c branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/libc-tls.c branches/uClibc-nptl/libpthread/nptl/sysdeps/generic/sysdep.h branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/Makefile.in branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/bits/libc-lock.h branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/pthread.h branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/sigaction.c branches/uClibc-nptl/libpthread/nptl/sysdeps/pthread/unwind-resume.c branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/close.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/open.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/read.S branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/write.S branches/uClibc-nptl/libpthread/nptl_db/structs.def branches/uClibc-nptl/libpthread/nptl_db/td_thr_tlsbase.c Changeset: Sorry, the patch is too large to include (1122 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20455 From carmelo at uclibc.org Mon Nov 19 23:43:19 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Mon, 19 Nov 2007 23:43:19 -0800 (PST) Subject: svn commit: trunk/uClibc/libc/sysdeps/linux/arm/bits Message-ID: <20071120074319.0889EA6ABC@busybox.net> Author: carmelo Date: 2007-11-19 23:43:19 -0800 (Mon, 19 Nov 2007) New Revision: 20456 Log: ARM SHMLBA = (4 * PAGE_SIZE). Currently in uclibc arm used shm.h from common directory where SHMLBA = __getpagesize() This patch fixes the issue. Khem Raj MontaVista Software Inc. Added: trunk/uClibc/libc/sysdeps/linux/arm/bits/shm.h Changeset: Added: trunk/uClibc/libc/sysdeps/linux/arm/bits/shm.h =================================================================== --- trunk/uClibc/libc/sysdeps/linux/arm/bits/shm.h (rev 0) +++ trunk/uClibc/libc/sysdeps/linux/arm/bits/shm.h 2007-11-20 07:43:19 UTC (rev 20456) @@ -0,0 +1,103 @@ +/* Copyright (C) 1995,1996,1997,2000,2002,2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +#include + +/* Permission flag for shmget. */ +#define SHM_R 0400 /* or S_IRUGO from */ +#define SHM_W 0200 /* or S_IWUGO from */ + +/* Flags for `shmat'. */ +#define SHM_RDONLY 010000 /* attach read-only else read-write */ +#define SHM_RND 020000 /* round attach address to SHMLBA */ +#define SHM_REMAP 040000 /* take-over region on attach */ + +/* Commands for `shmctl'. */ +#define SHM_LOCK 11 /* lock segment (root only) */ +#define SHM_UNLOCK 12 /* unlock segment (root only) */ + +__BEGIN_DECLS + +/* Segment low boundary address multiple. */ +#define SHMLBA (__getpagesize () << 2) +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + + +/* Type to count number of attaches. */ +typedef unsigned long int shmatt_t; + +/* Data structure describing a set of semaphores. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ + __time_t shm_atime; /* time of last shmat() */ + unsigned long int __unused1; + __time_t shm_dtime; /* time of last shmdt() */ + unsigned long int __unused2; + __time_t shm_ctime; /* time of last change by shmctl() */ + unsigned long int __unused3; + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + unsigned long int __unused4; + unsigned long int __unused5; + }; + +#ifdef __USE_MISC + +/* ipcs ctl commands */ +# define SHM_STAT 13 +# define SHM_INFO 14 + +/* shm_mode upper byte flags */ +# define SHM_DEST 01000 /* segment will be destroyed on last detach */ +# define SHM_LOCKED 02000 /* segment will not be swapped */ +# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ +# define SHM_NORESERVE 010000 /* don't check for reservations */ + +struct shminfo + { + unsigned long int shmmax; + unsigned long int shmmin; + unsigned long int shmmni; + unsigned long int shmseg; + unsigned long int shmall; + unsigned long int __unused1; + unsigned long int __unused2; + unsigned long int __unused3; + unsigned long int __unused4; + }; + +struct shm_info + { + int used_ids; + unsigned long int shm_tot; /* total allocated shm */ + unsigned long int shm_rss; /* total resident shm */ + unsigned long int shm_swp; /* total swapped shm */ + unsigned long int swap_attempts; + unsigned long int swap_successes; + }; + +#endif /* __USE_MISC */ + +__END_DECLS From carmelo at uclibc.org Tue Nov 20 01:39:53 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Tue, 20 Nov 2007 01:39:53 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/libc/sysdeps/linux/sh: bits sys Message-ID: <20071120093953.9555BA65EA@busybox.net> Author: carmelo Date: 2007-11-20 01:39:52 -0800 (Tue, 20 Nov 2007) New Revision: 20457 Log: Push latest libc SH4 specific implementations Modified: branches/uClibc-nptl/libc/sysdeps/linux/sh/Makefile.arch branches/uClibc-nptl/libc/sysdeps/linux/sh/bits/atomic.h branches/uClibc-nptl/libc/sysdeps/linux/sh/bits/fcntl.h branches/uClibc-nptl/libc/sysdeps/linux/sh/bits/syscalls.h branches/uClibc-nptl/libc/sysdeps/linux/sh/bits/uClibc_arch_features.h branches/uClibc-nptl/libc/sysdeps/linux/sh/clone.S branches/uClibc-nptl/libc/sysdeps/linux/sh/crti.S branches/uClibc-nptl/libc/sysdeps/linux/sh/pread_write.c branches/uClibc-nptl/libc/sysdeps/linux/sh/sys/procfs.h branches/uClibc-nptl/libc/sysdeps/linux/sh/sys/ucontext.h branches/uClibc-nptl/libc/sysdeps/linux/sh/sys/user.h branches/uClibc-nptl/libc/sysdeps/linux/sh/syscall_error.S Changeset: Sorry, the patch is too large to include (1082 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20457 From carmelo at uclibc.org Tue Nov 20 01:41:18 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Tue, 20 Nov 2007 01:41:18 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/librt Message-ID: <20071120094118.7F308A65EA@busybox.net> Author: carmelo Date: 2007-11-20 01:41:17 -0800 (Tue, 20 Nov 2007) New Revision: 20458 Log: Fix mq_timed[receive,send]. Signed-off-by: Carmelo Amoroso Modified: branches/uClibc-nptl/librt/Makefile.in branches/uClibc-nptl/librt/clock_gettime.c branches/uClibc-nptl/librt/mq_timedreceive.S branches/uClibc-nptl/librt/mq_timedsend.S Changeset: Modified: branches/uClibc-nptl/librt/Makefile.in =================================================================== --- branches/uClibc-nptl/librt/Makefile.in 2007-11-20 09:39:52 UTC (rev 20457) +++ branches/uClibc-nptl/librt/Makefile.in 2007-11-20 09:41:17 UTC (rev 20458) @@ -34,6 +34,9 @@ librt_OBJ := $(patsubst $(librt_DIR)/%.c,$(librt_OUT)/%.o,$(librt_SRC)) endif +ASFLAGS-mq_timedreceive.S = -D_LIBC_REENTRANT +ASFLAGS-mq_timedsend.S = -D_LIBC_REENTRANT + ifeq ($(DOPIC),y) librt-a-y += $(librt_OBJ:.o=.os) else Modified: branches/uClibc-nptl/librt/clock_gettime.c =================================================================== --- branches/uClibc-nptl/librt/clock_gettime.c 2007-11-20 09:39:52 UTC (rev 20457) +++ branches/uClibc-nptl/librt/clock_gettime.c 2007-11-20 09:41:17 UTC (rev 20458) @@ -252,7 +252,7 @@ return retval; } - +librt_hidden_proto (clock_gettime) /* Get current value of CLOCK and store it in TP. */ int clock_gettime (clockid_t clock_id, struct timespec *tp) Modified: branches/uClibc-nptl/librt/mq_timedreceive.S =================================================================== --- branches/uClibc-nptl/librt/mq_timedreceive.S 2007-11-20 09:39:52 UTC (rev 20457) +++ branches/uClibc-nptl/librt/mq_timedreceive.S 2007-11-20 09:41:17 UTC (rev 20458) @@ -5,6 +5,6 @@ PSEUDO (__mq_timedreceive, mq_timedreceive, 5) ret PSEUDO_END(__mq_timedreceive) -libc_hidden_def (__mq_timedreceive) +librt_hidden_def (__mq_timedreceive) weak_alias (__mq_timedreceive, mq_timedreceive) -libc_hidden_weak (mq_timedreceive) +librt_hidden_weak (mq_timedreceive) Modified: branches/uClibc-nptl/librt/mq_timedsend.S =================================================================== --- branches/uClibc-nptl/librt/mq_timedsend.S 2007-11-20 09:39:52 UTC (rev 20457) +++ branches/uClibc-nptl/librt/mq_timedsend.S 2007-11-20 09:41:17 UTC (rev 20458) @@ -5,6 +5,6 @@ PSEUDO (__mq_timedsend, mq_timedsend, 5) ret PSEUDO_END(__mq_timedsend) -libc_hidden_def (__mq_timedsend) +librt_hidden_def (__mq_timedsend) weak_alias (__mq_timedsend, mq_timedsend) -libc_hidden_weak (mq_timedsend) +librt_hidden_weak (mq_timedsend) From carmelo at uclibc.org Tue Nov 20 02:00:47 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Tue, 20 Nov 2007 02:00:47 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/include Message-ID: <20071120100047.5847C30040@busybox.net> Author: carmelo Date: 2007-11-20 02:00:46 -0800 (Tue, 20 Nov 2007) New Revision: 20459 Log: A bunch of fixes into include directory - [elf.h] Add missing macro for GNU hash support - [fcntl.h] Add extern declaration for fcntl64 - [libc-symbols] Re-enale 'hidden_proto' macro and others. Synch it with trunk - [tls.h] export USE___THREAD macro to librt too - [unistd.h] Fix sysconf prototype - [errno.h] Avoid warnings for duplicated macro definitions Signed-off-by: Carmelo Amoroso Modified: branches/uClibc-nptl/include/elf.h branches/uClibc-nptl/include/errno.h branches/uClibc-nptl/include/fcntl.h branches/uClibc-nptl/include/libc-symbols.h branches/uClibc-nptl/include/tls.h branches/uClibc-nptl/include/unistd.h Changeset: Modified: branches/uClibc-nptl/include/elf.h =================================================================== --- branches/uClibc-nptl/include/elf.h 2007-11-20 09:41:17 UTC (rev 20458) +++ branches/uClibc-nptl/include/elf.h 2007-11-20 10:00:46 UTC (rev 20459) @@ -431,6 +431,7 @@ #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ #define SHT_NUM 19 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */ #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ @@ -813,6 +814,7 @@ If any adjustment is made to the ELF object after it has been built these entries will need to be adjusted. */ #define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */ #define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */ #define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */ #define DT_CONFIG 0x6ffffefa /* Configuration information. */ Modified: branches/uClibc-nptl/include/errno.h =================================================================== --- branches/uClibc-nptl/include/errno.h 2007-11-20 09:41:17 UTC (rev 20458) +++ branches/uClibc-nptl/include/errno.h 2007-11-20 10:00:46 UTC (rev 20459) @@ -70,7 +70,9 @@ # endif #endif +#ifndef __set_errno #define __set_errno(val) (errno = (val)) +#endif #ifndef __ASSEMBLER__ extern int *__errno_location (void) __THROW __attribute__ ((__const__)); Modified: branches/uClibc-nptl/include/fcntl.h =================================================================== --- branches/uClibc-nptl/include/fcntl.h 2007-11-20 09:41:17 UTC (rev 20458) +++ branches/uClibc-nptl/include/fcntl.h 2007-11-20 10:00:46 UTC (rev 20459) @@ -75,6 +75,10 @@ extern int __fcntl_nocancel (int fd, int cmd, ...); #endif +#ifdef __USE_LARGEFILE64 +extern int fcntl64 (int __fd, int __cmd, ...); +#endif + /* Open FILE and return a new file descriptor for it, or -1 on error. OFLAG determines the type of access used. If O_CREAT is on OFLAG, the third argument is taken as a `mode_t', the mode of the created file. Modified: branches/uClibc-nptl/include/libc-symbols.h =================================================================== --- branches/uClibc-nptl/include/libc-symbols.h 2007-11-20 09:41:17 UTC (rev 20458) +++ branches/uClibc-nptl/include/libc-symbols.h 2007-11-20 10:00:46 UTC (rev 20459) @@ -233,6 +233,19 @@ # else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +# ifdef HAVE_ASM_SET_DIRECTIVE +# ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) ASM_LINE_SEP \ + .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original) +# else +# define weak_alias(original, alias) \ + .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + .set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) +# endif +# else /* ! HAVE_ASM_SET_DIRECTIVE */ # ifdef HAVE_ASM_GLOBAL_DOT_NAME # define weak_alias(original, alias) \ .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ @@ -244,7 +257,7 @@ .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) # endif - +# endif # define weak_extern(symbol) \ .weak C_SYMBOL_NAME (symbol) @@ -412,31 +425,63 @@ #if !defined STATIC && !defined __BCC__ # ifndef __ASSEMBLER__ -# define hidden_proto(name, attrs...) -# define hidden_def(name) -# define hidden_data_def(name) -# define hidden_weak(name) -# define hidden_data_weak(name) +# 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) # else /* __ASSEMBLER__ */ # ifdef HAVE_ASM_SET_DIRECTIVE # ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define _hidden_strong_alias(original, alias) +# 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) # else -# define _hidden_strong_alias(original, alias) +# 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) # endif # else # ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define _hidden_strong_alias(original, alias) +# 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) # else -# define _hidden_strong_alias(original, alias) +# 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) # endif # endif # ifdef HAVE_ASM_GLOBAL_DOT_NAME -# define _hidden_weak_alias(original, alias) +# 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) # else -# define _hidden_weak_alias(original, alias) +# define _hidden_weak_alias(original, alias) \ + .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \ + weak_alias(original, alias) # endif /* For assembly, we need to do the opposite of what we do in C: @@ -448,11 +493,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) -# define hidden_data_def(name) -# define hidden_weak(name) -# define hidden_data_weak(name) -# define HIDDEN_JUMPTARGET(name) +# 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 # endif /* __ASSEMBLER__ */ #else /* SHARED */ # ifndef __ASSEMBLER__ Modified: branches/uClibc-nptl/include/tls.h =================================================================== --- branches/uClibc-nptl/include/tls.h 2007-11-20 09:41:17 UTC (rev 20458) +++ branches/uClibc-nptl/include/tls.h 2007-11-20 10:00:46 UTC (rev 20459) @@ -6,7 +6,7 @@ #include_next #if USE_TLS && HAVE___THREAD \ - && (!defined NOT_IN_libc || defined IS_IN_libpthread) + && (!defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt) # define USE___THREAD 1 Modified: branches/uClibc-nptl/include/unistd.h =================================================================== --- branches/uClibc-nptl/include/unistd.h 2007-11-20 09:41:17 UTC (rev 20458) +++ branches/uClibc-nptl/include/unistd.h 2007-11-20 10:00:46 UTC (rev 20459) @@ -561,7 +561,7 @@ extern long int fpathconf (int __fd, int __name) __THROW; /* Get the value of the system variable NAME. */ -extern long int sysconf (int __name) __THROW __attribute__ ((__const__)); +extern long int sysconf (int __name) __THROW; #ifdef __USE_POSIX2 /* Get the value of the string-valued system variable NAME. */ From carmelo at uclibc.org Tue Nov 20 02:09:17 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Tue, 20 Nov 2007 02:09:17 -0800 (PST) Subject: svn commit: branches/uClibc-nptl: extra/Configs extra/locale libc libc/in etc... Message-ID: <20071120100917.79AA23004C@busybox.net> Author: carmelo Date: 2007-11-20 02:09:16 -0800 (Tue, 20 Nov 2007) New Revision: 20460 Log: Fix Makefile.in and synch them with trunk. Signed-off-by: Carmelo Amoroso Modified: branches/uClibc-nptl/Rules.mak branches/uClibc-nptl/extra/Configs/Config.in branches/uClibc-nptl/extra/locale/Makefile.in branches/uClibc-nptl/libc/Makefile.in branches/uClibc-nptl/libc/inet/Makefile.in branches/uClibc-nptl/libc/inet/getaddrinfo.c branches/uClibc-nptl/libc/inet/inet_net.c branches/uClibc-nptl/libc/inet/rpc/Makefile.in branches/uClibc-nptl/libc/inet/rpc/rcmd.c branches/uClibc-nptl/libc/misc/Makefile.in branches/uClibc-nptl/libc/misc/assert/Makefile.in branches/uClibc-nptl/libc/misc/ctype/Makefile.in branches/uClibc-nptl/libc/misc/dirent/Makefile.in branches/uClibc-nptl/libc/misc/error/Makefile.in branches/uClibc-nptl/libc/misc/file/Makefile.in branches/uClibc-nptl/libc/misc/file/lockf64.c branches/uClibc-nptl/libc/misc/fnmatch/Makefile.in branches/uClibc-nptl/libc/misc/ftw/Makefile.in branches/uClibc-nptl/libc/misc/glob/Makefile.in branches/uClibc-nptl/libc/misc/gnu/Makefile.in branches/uClibc-nptl/libc/misc/internals/Makefile.in branches/uClibc-nptl/libc/misc/internals/__uClibc_main.c branches/uClibc-nptl/libc/misc/internals/tempname.c branches/uClibc-nptl/libc/misc/locale/Makefile.in branches/uClibc-nptl/libc/misc/mntent/Makefile.in branches/uClibc-nptl/libc/misc/pthread/weaks.c branches/uClibc-nptl/libc/misc/regex/Makefile.in branches/uClibc-nptl/libc/misc/search/Makefile.in branches/uClibc-nptl/libc/misc/statfs/Makefile.in branches/uClibc-nptl/libc/misc/syslog/Makefile.in branches/uClibc-nptl/libc/misc/sysvipc/Makefile.in branches/uClibc-nptl/libc/misc/time/Makefile.in branches/uClibc-nptl/libc/misc/ttyent/Makefile.in branches/uClibc-nptl/libc/misc/utmp/Makefile.in branches/uClibc-nptl/libc/misc/wchar/Makefile.in branches/uClibc-nptl/libc/misc/wctype/Makefile.in branches/uClibc-nptl/libc/misc/wordexp/Makefile.in branches/uClibc-nptl/libc/pwd_grp/Makefile.in branches/uClibc-nptl/libc/pwd_grp/lckpwdf.c branches/uClibc-nptl/libc/signal/Makefile.in branches/uClibc-nptl/libc/stdio/Makefile.in branches/uClibc-nptl/libc/stdio/popen.c branches/uClibc-nptl/libc/stdlib/Makefile.in branches/uClibc-nptl/libc/stdlib/_atexit.c branches/uClibc-nptl/libc/stdlib/malloc-simple/alloc.c branches/uClibc-nptl/libc/stdlib/malloc-standard/Makefile.in branches/uClibc-nptl/libc/stdlib/malloc-standard/malloc.c branches/uClibc-nptl/libc/stdlib/malloc/heap_debug.c branches/uClibc-nptl/libc/stdlib/malloc/malloc.c branches/uClibc-nptl/libc/stdlib/malloc/realloc.c branches/uClibc-nptl/libc/stdlib/mkdtemp.c branches/uClibc-nptl/libc/stdlib/random.c branches/uClibc-nptl/libc/stdlib/realpath.c branches/uClibc-nptl/libc/stdlib/setenv.c branches/uClibc-nptl/libc/stdlib/system.c branches/uClibc-nptl/libc/sysdeps/linux/Makefile.commonarch branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile.in branches/uClibc-nptl/libc/sysdeps/linux/common/__rt_sigtimedwait.c branches/uClibc-nptl/libc/sysdeps/linux/common/__rt_sigwaitinfo.c branches/uClibc-nptl/libc/sysdeps/linux/common/__syscall_rt_sigaction.c branches/uClibc-nptl/libc/sysdeps/linux/common/bits/kernel_sigaction.h branches/uClibc-nptl/libc/sysdeps/linux/common/bits/posix1_lim.h branches/uClibc-nptl/libc/termios/Makefile.in branches/uClibc-nptl/libc/termios/tcgetpgrp.c branches/uClibc-nptl/libc/unistd/Makefile.in branches/uClibc-nptl/libc/unistd/sleep.c branches/uClibc-nptl/libc/unistd/sysconf.c branches/uClibc-nptl/libc/unistd/usleep.c Changeset: Sorry, the patch is too large to include (1617 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20460 From bugs at busybox.net Tue Nov 20 13:42:02 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 20 Nov 2007 13:42:02 -0800 Subject: [uClibc 0001598]: armeb-linux-uclibc-objcopy convert 2.8MB vmlinuz file into >3000MB Image file Message-ID: <40112b396e0f840f427524c4d0d31b93@bugs.uclibc.org> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1598 ====================================================================== Reported By: lga Assigned To: uClibc ====================================================================== Project: uClibc Issue ID: 1598 Category: Architecture Specific Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 11-20-2007 13:42 PST Last Modified: 11-20-2007 13:42 PST ====================================================================== Summary: armeb-linux-uclibc-objcopy convert 2.8MB vmlinuz file into >3000MB Image file Description: uclibc-0.9.29 It seems to me that it is the same bug as discussed concerning OpenEmbedded. (http://article.gmane.org/gmane.comp.handhelds.openembedded.user/67) My buildroot config (br.config) and kernel config (kern.config) is attached. The patch suggested in link above make Image file of good size (<1MB). But I haven't run it yet. Patch (by Philip Balister balister.org>): diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 5ff5406..538fcb5 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -94,6 +94,7 @@ SECTIONS TEXT_TEXT SCHED_TEXT LOCK_TEXT + *(.note.*) #ifdef CONFIG_MMU *(.fixup) #endif ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 11-20-07 13:42 lga New Issue 11-20-07 13:42 lga Status new => assigned 11-20-07 13:42 lga Assigned To => uClibc 11-20-07 13:42 lga File Added: br.config ====================================================================== From pkj at uclibc.org Wed Nov 21 04:34:42 2007 From: pkj at uclibc.org (pkj at uclibc.org) Date: Wed, 21 Nov 2007 04:34:42 -0800 (PST) Subject: svn commit: trunk/uClibc/libc/string/cris Message-ID: <20071121123442.94F77A4550@busybox.net> Author: pkj Date: 2007-11-21 04:34:41 -0800 (Wed, 21 Nov 2007) New Revision: 20461 Log: Added optimized versions of strcpy() and strncpy() for CRIS/CRISv32. Added: trunk/uClibc/libc/string/cris/strcpy.c trunk/uClibc/libc/string/cris/strncpy.c Changeset: Added: trunk/uClibc/libc/string/cris/strcpy.c =================================================================== --- trunk/uClibc/libc/string/cris/strcpy.c (rev 0) +++ trunk/uClibc/libc/string/cris/strcpy.c 2007-11-21 12:34:41 UTC (rev 20461) @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2006-2007 Axis Communications AB + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include + +libc_hidden_proto(strcpy) +char *strcpy(char *dest, const char *src) +{ + char *ret = dest; + unsigned long himagic = 0x80808080L; + unsigned long lomagic = 0x01010101L; + + while ((unsigned long)src & (sizeof src - 1)) + { + if (!(*dest++ = *src++)) + { + return ret; + } + } + + while (1) + { + unsigned long value = *(unsigned long*)src; + unsigned long magic; + + src += sizeof (unsigned long); + + if ((magic = (value - lomagic) & himagic)) + { + if (magic & ~value) + { + break; + } + } + + *(unsigned long*)dest = value; + dest += sizeof (unsigned long); + } + + src -= sizeof (unsigned long); + + while ((*dest++ = *src++)) + { + } + + return ret; +} +libc_hidden_def(strcpy) Added: trunk/uClibc/libc/string/cris/strncpy.c =================================================================== --- trunk/uClibc/libc/string/cris/strncpy.c (rev 0) +++ trunk/uClibc/libc/string/cris/strncpy.c 2007-11-21 12:34:41 UTC (rev 20461) @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2006-2007 Axis Communications AB + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include + +libc_hidden_proto(memset) + +libc_hidden_proto(strncpy) +char *strncpy(char *dest, const char *src, size_t count) +{ + char *ret = dest; + unsigned long himagic = 0x80808080L; + unsigned long lomagic = 0x01010101L; + + while (count && (unsigned long)src & (sizeof src - 1)) + { + count--; + if (!(*dest++ = *src++)) + { + goto finalize; + } + } + + while (count >= sizeof (unsigned long)) + { + unsigned long value = *(unsigned long*)src; + unsigned long magic; + + if ((magic = (value - lomagic) & himagic)) + { + if (magic & ~value) + { + break; + } + } + + *(unsigned long*)dest = value; + dest += sizeof (unsigned long); + src += sizeof (unsigned long); + count -= sizeof (unsigned long); + } + + while (count) + { + count--; + if (!(*dest++ = *src++)) + break; + } + +finalize: + if (count) + { + memset(dest, '\0', count); + } + + return ret; +} +libc_hidden_def(strncpy) From carmelo at uclibc.org Wed Nov 21 09:21:55 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Wed, 21 Nov 2007 09:21:55 -0800 (PST) Subject: svn commit: branches/uClibc-nptl: include libm libm/sh libm/sh/fpu Message-ID: <20071121172155.9BA34A4647@busybox.net> Author: carmelo Date: 2007-11-21 09:21:53 -0800 (Wed, 21 Nov 2007) New Revision: 20462 Log: Add SH minimal support for floating point exceptioins. Required for example by qt-embedded libraries. Signed-off-by: Carmelo Amoroso Added: branches/uClibc-nptl/include/fenv.h branches/uClibc-nptl/libm/sh/ branches/uClibc-nptl/libm/sh/fpu/ branches/uClibc-nptl/libm/sh/fpu/Makefile.arch branches/uClibc-nptl/libm/sh/fpu/feholdexcpt.c branches/uClibc-nptl/libm/sh/fpu/fesetenv.c Modified: branches/uClibc-nptl/libm/Makefile.in Changeset: Added: branches/uClibc-nptl/include/fenv.h =================================================================== --- branches/uClibc-nptl/include/fenv.h (rev 0) +++ branches/uClibc-nptl/include/fenv.h 2007-11-21 17:21:53 UTC (rev 20462) @@ -0,0 +1,69 @@ +/* + * + * Copyright (c) 2007 STMicroelectronics Ltd + * Filippo Arcidiacono (filippo.arcidiacono at st.com) + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + * Taken from glibc 2.6 + * + */ + + +/* + * ISO C99 7.6: Floating-point environment + */ + +#ifndef _FENV_H +#define _FENV_H 1 + +#include + +/* Get the architecture dependend definitions. The following definitions + are expected to be done: + + fenv_t type for object representing an entire floating-point + environment + + FE_DFL_ENV macro of type pointer to fenv_t to be used as the argument + to functions taking an argument of type fenv_t; in this + case the default environment will be used + + fexcept_t type for object representing the floating-point exception + flags including status associated with the flags + + The following macros are defined iff the implementation supports this + kind of exception. + FE_INEXACT inexact result + FE_DIVBYZERO division by zero + FE_UNDERFLOW result not representable due to underflow + FE_OVERFLOW result not representable due to overflow + FE_INVALID invalid operation + + FE_ALL_EXCEPT bitwise OR of all supported exceptions + + The next macros are defined iff the appropriate rounding mode is + supported by the implementation. + FE_TONEAREST round to nearest + FE_UPWARD round toward +Inf + FE_DOWNWARD round toward -Inf + FE_TOWARDZERO round toward 0 +*/ +#include + +__BEGIN_DECLS + +/* Floating-point exception handling. */ + +/* Save the current environment in the object pointed to by ENVP, clear + exception flags and install a non-stop mode (if available) for all + exceptions. */ +extern int feholdexcept (fenv_t *__envp) __THROW; + +/* Establish the floating-point environment represented by the object + pointed to by ENVP. */ +extern int fesetenv (__const fenv_t *__envp) __THROW; + +__END_DECLS + +#endif /* fenv.h */ Modified: branches/uClibc-nptl/libm/Makefile.in =================================================================== --- branches/uClibc-nptl/libm/Makefile.in 2007-11-21 12:34:41 UTC (rev 20461) +++ branches/uClibc-nptl/libm/Makefile.in 2007-11-21 17:21:53 UTC (rev 20462) @@ -38,6 +38,7 @@ ifeq ($(UCLIBC_HAS_FPU),y) ifeq ($(DO_C99_MATH),y) -include $(libm_ARCH_DIR)/Makefile.arch +-include $(libm_ARCH_fpu_DIR)/Makefile.arch endif endif Added: branches/uClibc-nptl/libm/sh/fpu/Makefile.arch =================================================================== --- branches/uClibc-nptl/libm/sh/fpu/Makefile.arch (rev 0) +++ branches/uClibc-nptl/libm/sh/fpu/Makefile.arch 2007-11-21 17:21:53 UTC (rev 20462) @@ -0,0 +1,18 @@ +# Makefile for uClibc +# +# Copyright (c) 2007 STMicroelectronics Ltd +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +libm_ARCH_SRC:=$(wildcard $(libm_ARCH_fpu_DIR)/*.c) +libm_ARCH_OBJ:=$(patsubst $(libm_ARCH_fpu_DIR)/%.c,$(libm_ARCH_fpu_OUT)/%.o,$(libm_ARCH_SRC)) + +libm_ARCH_OBJS:=$(libm_ARCH_OBJ) + +ifeq ($(DOPIC),y) +libm-a-y+=$(libm_ARCH_OBJS:.o=.os) +else +libm-a-y+=$(libm_ARCH_OBJS) +endif +libm-so-y+=$(libm_ARCH_OBJS:.o=.os) Added: branches/uClibc-nptl/libm/sh/fpu/feholdexcpt.c =================================================================== --- branches/uClibc-nptl/libm/sh/fpu/feholdexcpt.c (rev 0) +++ branches/uClibc-nptl/libm/sh/fpu/feholdexcpt.c 2007-11-21 17:21:53 UTC (rev 20462) @@ -0,0 +1,30 @@ +/* + * + * Copyright (c) 2007 STMicroelectronics Ltd + * Filippo Arcidiacono (filippo.arcidiacono at st.com) + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + * Taken from glibc 2.6 + * + */ + +#include +#include + +int +feholdexcept (fenv_t *envp) +{ + unsigned long int temp; + + /* Store the environment. */ + _FPU_GETCW (temp); + envp->__fpscr = temp; + + /* Now set all exceptions to non-stop. */ + temp &= ~FE_ALL_EXCEPT; + _FPU_SETCW (temp); + + return 1; +} +libm_hidden_def (feholdexcept) Added: branches/uClibc-nptl/libm/sh/fpu/fesetenv.c =================================================================== --- branches/uClibc-nptl/libm/sh/fpu/fesetenv.c (rev 0) +++ branches/uClibc-nptl/libm/sh/fpu/fesetenv.c 2007-11-21 17:21:53 UTC (rev 20462) @@ -0,0 +1,27 @@ +/* + * + * Copyright (c) 2007 STMicroelectronics Ltd + * Filippo Arcidiacono (filippo.arcidiacono at st.com) + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + * Taken from glibc 2.6 + * + */ + +#include +#include + +int +fesetenv (const fenv_t *envp) +{ + if (envp == FE_DFL_ENV) + _FPU_SETCW (_FPU_DEFAULT); + else + { + unsigned long int temp = envp->__fpscr; + _FPU_SETCW (temp); + } + return 0; +} +libm_hidden_def (fesetenv) From carmelo at uclibc.org Wed Nov 21 09:29:49 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Wed, 21 Nov 2007 09:29:49 -0800 (PST) Subject: svn commit: branches/uClibc-nptl: extra/Configs libc/string libc/string/ge etc... Message-ID: <20071121172949.D6478A495E@busybox.net> Author: carmelo Date: 2007-11-21 09:29:48 -0800 (Wed, 21 Nov 2007) New Revision: 20463 Log: Added optmized memcpy implementation for SH4 (backward memcpy algorithm) Modified libc/string/generic/Makefile.in to handle subtarget implementations. Fixed generic memmove code to handle backward memcpy by using a selectable config option __ARCH_HAS_BWD_MEMCPY__ This option is on for SH4 arch Signed-off-by: Carmelo Amoroso Added: branches/uClibc-nptl/libc/string/sh/ branches/uClibc-nptl/libc/string/sh/sh4/ branches/uClibc-nptl/libc/string/sh/sh4/memcpy.S Modified: branches/uClibc-nptl/extra/Configs/Config.sh branches/uClibc-nptl/libc/string/Makefile.in branches/uClibc-nptl/libc/string/generic/memcopy.h branches/uClibc-nptl/libc/string/generic/memcpy.c branches/uClibc-nptl/libc/string/generic/memmove.c Changeset: Sorry, the patch is too large to include (1390 lines). Please use ViewCVS to see it! http://uclibc.org/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20463 From carmelo at uclibc.org Wed Nov 21 09:32:33 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Wed, 21 Nov 2007 09:32:33 -0800 (PST) Subject: svn commit: branches/uClibc-nptl Message-ID: <20071121173233.65B87A6044@busybox.net> Author: carmelo Date: 2007-11-21 09:32:32 -0800 (Wed, 21 Nov 2007) New Revision: 20464 Log: Split 'headers' target into three sub-target to work when cross-compiler is not yet available. Signed-off-by: Carmelo Amoroso Modified: branches/uClibc-nptl/Makefile.in Changeset: Modified: branches/uClibc-nptl/Makefile.in =================================================================== --- branches/uClibc-nptl/Makefile.in 2007-11-21 17:29:48 UTC (rev 20463) +++ branches/uClibc-nptl/Makefile.in 2007-11-21 17:32:32 UTC (rev 20464) @@ -53,7 +53,22 @@ HEADERS_BITS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/bits/*.h)) HEADERS_BITS_ARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h)) HEADERS_BITS_COMMON := $(filter-out $(HEADERS_BITS_ARCH),$(HEADERS_BITS_COMMON)) -headers: include/bits/uClibc_config.h + +headers_sysnum: + $(Q)\ + set -e; \ + cd $(top_builddir); \ + tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \ + [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \ + KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) $(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \ + if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \ + $(RM) $$tmp; \ + else \ + mv -f $$tmp include/bits/sysnum.h; \ + fi + +# Make bootstrap only header files: not requiring any cross-compilation +headers_bootstrap: include/bits/uClibc_config.h $(Q)$(MAKE) headers-y $(Q)\ set -e; \ @@ -85,29 +100,27 @@ $(LN) -fs $$i .; \ done; \ fi - $(Q)\ - set -e; \ - cd $(top_builddir); \ - tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \ - [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \ - KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) $(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \ - if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \ - $(RM) $$tmp; \ - else \ - mv -f $$tmp include/bits/sysnum.h; \ - fi -ifeq ($(UCLIBC_HAS_LOCALE),y) - $(MAKE) locale_headers -endif ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) - $(MAKE) nptl_headers - ifeq ($(shell $(CC) --help >& /dev/null && echo yes),yes) - $(MAKE) nptl_arch_headers - $(MAKE) nptl_linux_headers - endif -endif + $(MAKE) nptl_headers_bootstrap + $(MAKE) nptl_linux_headers_bootstrap +endif + +headers_extra: + ifeq ($(UCLIBC_HAS_LOCALE),y) + $(MAKE) -C extra/locale locale_headers + endif + ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) + $(MAKE) nptl_headers + ifeq ($(shell $(CC) --help >& /dev/null && echo yes),yes) + $(MAKE) nptl_arch_headers + $(MAKE) nptl_linux_headers + endif + endif + pregen: headers +# Make all headers +headers: headers_bootstrap headers_sysnum headers_extra install: install_runtime install_dev From carmelo at uclibc.org Wed Nov 21 09:33:33 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Wed, 21 Nov 2007 09:33:33 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/libc/inet/rpc Message-ID: <20071121173333.B7AE130042@busybox.net> Author: carmelo Date: 2007-11-21 09:33:32 -0800 (Wed, 21 Nov 2007) New Revision: 20465 Log: Synch with SH4 port (and trunk) Modified: branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c Changeset: Modified: branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c =================================================================== --- branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c 2007-11-21 17:32:32 UTC (rev 20464) +++ branches/uClibc-nptl/libc/inet/rpc/rpc_thread.c 2007-11-21 17:33:32 UTC (rev 20465) @@ -22,7 +22,7 @@ /* Variable used in non-threaded applications or for the first thread. */ static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; -__libc_tsd_define (static, RPC_VARS) +__libc_tsd_define (, RPC_VARS) /* * Task-variable destructor From carmelo at uclibc.org Wed Nov 21 09:45:57 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Wed, 21 Nov 2007 09:45:57 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/libc: misc/pthread sysdeps/linux/common sysdep etc... Message-ID: <20071121174557.3D84F30048@busybox.net> Author: carmelo Date: 2007-11-21 09:45:53 -0800 (Wed, 21 Nov 2007) New Revision: 20466 Log: Added some missing files: creat.c: to provide creat function longjmp.c: to provide longjmp implementation for sh4 tsd.c: to provide implementation of __libc_dl_error_tsd Signed-off-by: Carmelo Amoroso Added: branches/uClibc-nptl/libc/misc/pthread/tsd.c branches/uClibc-nptl/libc/sysdeps/linux/common/creat.c branches/uClibc-nptl/libc/sysdeps/linux/sh/longjmp.c Changeset: Added: branches/uClibc-nptl/libc/misc/pthread/tsd.c =================================================================== --- branches/uClibc-nptl/libc/misc/pthread/tsd.c (rev 0) +++ branches/uClibc-nptl/libc/misc/pthread/tsd.c 2007-11-21 17:45:53 UTC (rev 20466) @@ -0,0 +1,11 @@ +/* libpthread sets _dl_error_catch_tsd to point to this function. + We define it here instead of in libpthread so t here instead of in libpthread so that it doesn't + need to have a TLS segment of its own just for this one pointer. */ + +void ** __attribute__ ((const)) +__libc_dl_error_tsd (void) +{ + static __thread void *data __attribute__ ((tls_model ("initial-exec"))); + return &data; +} + Added: branches/uClibc-nptl/libc/sysdeps/linux/common/creat.c =================================================================== --- branches/uClibc-nptl/libc/sysdeps/linux/common/creat.c (rev 0) +++ branches/uClibc-nptl/libc/sysdeps/linux/common/creat.c 2007-11-21 17:45:53 UTC (rev 20466) @@ -0,0 +1,16 @@ +/* vi: set sw=4 ts=4: */ +/* + * open() for uClibc + * + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +#include + +extern int __libc_open(const char *file, int flags, ...); + +int creat(const char *file, mode_t mode) +{ + return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode); +} Added: branches/uClibc-nptl/libc/sysdeps/linux/sh/longjmp.c =================================================================== --- branches/uClibc-nptl/libc/sysdeps/linux/sh/longjmp.c (rev 0) +++ branches/uClibc-nptl/libc/sysdeps/linux/sh/longjmp.c 2007-11-21 17:45:53 UTC (rev 20466) @@ -0,0 +1,56 @@ +/* Copyright (C) 1991, 92, 94, 95, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 2001 Hewlett-Packard Australia + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Library General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more + details. + + You should have received a copy of the GNU Library General Public License + along with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Derived in part from the Linux-8086 C library, the GNU C Library, and several + other sundry sources. Files within this library are copyright by their + respective copyright holders. +*/ + +#include +#include +#include + +libc_hidden_proto(sigprocmask) + +extern int __longjmp(char *env, int val); +libc_hidden_proto(__longjmp) + +extern void _longjmp_unwind (jmp_buf env, int val); + + +/* Set the signal mask to the one specified in ENV, and jump + to the position specified in ENV, causing the setjmp + call there to return VAL, or 1 if VAL is 0. */ +void __libc_siglongjmp (sigjmp_buf env, int val) +{ + /* Perform any cleanups needed by the frames being unwound. */ + + _longjmp_unwind (env, val); + + if (env[0].__mask_was_saved) + /* Restore the saved signal mask. */ + (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask, + (sigset_t *) NULL); + + /* Call the machine-dependent function to restore machine state. */ + __longjmp ((char *) env[0].__jmpbuf, val ?: 1); +} + +__asm__(".weak longjmp; longjmp = __libc_siglongjmp"); +__asm__(".weak _longjmp; _longjmp = __libc_siglongjmp"); +__asm__(".weak siglongjmp; siglongjmp = __libc_siglongjmp"); +strong_alias(__libc_siglongjmp, __libc_longjmp) From carmelo at uclibc.org Thu Nov 22 01:57:06 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Thu, 22 Nov 2007 01:57:06 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/ldso: ldso/sh libdl Message-ID: <20071122095706.B12DD30048@busybox.net> Author: carmelo Date: 2007-11-22 01:57:06 -0800 (Thu, 22 Nov 2007) New Revision: 20471 Log: Removed #if USE_TLS guard around tls_tpnt, otherwise it will not compile if TLS is disabled (once merged into the trunk) Pointed out by Peter Mazinger. Signed-off-by: Carmelo Amoroso Modified: branches/uClibc-nptl/ldso/ldso/sh/elfinterp.c branches/uClibc-nptl/ldso/libdl/libdl.c Changeset: Modified: branches/uClibc-nptl/ldso/ldso/sh/elfinterp.c =================================================================== --- branches/uClibc-nptl/ldso/ldso/sh/elfinterp.c 2007-11-22 08:16:57 UTC (rev 20470) +++ branches/uClibc-nptl/ldso/ldso/sh/elfinterp.c 2007-11-22 09:57:06 UTC (rev 20471) @@ -167,9 +167,8 @@ #if defined (__SUPPORT_LD_DEBUG__) unsigned long old_val; #endif -#if USE_TLS + struct elf_resolve *tls_tpnt = NULL; -#endif reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset); Modified: branches/uClibc-nptl/ldso/libdl/libdl.c =================================================================== --- branches/uClibc-nptl/ldso/libdl/libdl.c 2007-11-22 08:16:57 UTC (rev 20470) +++ branches/uClibc-nptl/ldso/libdl/libdl.c 2007-11-22 09:57:06 UTC (rev 20471) @@ -606,11 +606,8 @@ struct dyn_elf *rpnt; void *ret; -#if defined USE_TLS -struct elf_resolve *tls_tpnt = NULL; -#endif + struct elf_resolve *tls_tpnt = NULL; - handle = (struct dyn_elf *) vhandle; /* First of all verify that we have a real handle From carmelo at uclibc.org Thu Nov 22 08:09:57 2007 From: carmelo at uclibc.org (carmelo at uclibc.org) Date: Thu, 22 Nov 2007 08:09:57 -0800 (PST) Subject: svn commit: branches/uClibc-nptl/libc: inet sysdeps/linux/common Message-ID: <20071122160957.7321FA6AC5@busybox.net> Author: carmelo Date: 2007-11-22 08:09:55 -0800 (Thu, 22 Nov 2007) New Revision: 20472 Log: Push back changes to add cancellation handling. It still needs to reach an agreement on the final solution, anyway this code have been put int to be shared for the mips-sh4 merge Signed-off-by: Carmelo Amoroso Modified: branches/uClibc-nptl/libc/inet/Makefile.in branches/uClibc-nptl/libc/inet/socketcalls.c branches/uClibc-nptl/libc/sysdeps/linux/common/Makefile.in branches/uClibc-nptl/libc/sysdeps/linux/common/fsync.c branches/uClibc-nptl/libc/sysdeps/linux/common/ioctl.c branches/uClibc-nptl/libc/sysdeps/linux/common/msync.c branches/uClibc-nptl/libc/sysdeps/linux/common/nanosleep.c branches/uClibc-nptl/libc/sysdeps/linux/common/pause.c branches/uClibc-nptl/libc/sysdeps/linux/common/poll.c branches/uClibc-nptl/libc/sysdeps/linux/common/select.c Changeset: Modified: branches/uClibc-nptl/libc/inet/Makefile.in =================================================================== --- branches/uClibc-nptl/libc/inet/Makefile.in 2007-11-22 09:57:06 UTC (rev 20471) +++ branches/uClibc-nptl/libc/inet/Makefile.in 2007-11-22 16:09:55 UTC (rev 20472) @@ -30,11 +30,6 @@ listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c sendto.c \ setsockopt.c shutdown.c socket.c socketpair.c -ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -CSRC := $(filter-out accept.c connect.c recv.c recvfrom.c recvmsg.c send.c \ - sendmsg.c sendto.c, $(CSRC)) -endif - INET_DIR := $(top_srcdir)libc/inet INET_OUT := $(top_builddir)libc/inet Modified: branches/uClibc-nptl/libc/inet/socketcalls.c =================================================================== --- branches/uClibc-nptl/libc/inet/socketcalls.c 2007-11-22 09:57:06 UTC (rev 20471) +++ branches/uClibc-nptl/libc/inet/socketcalls.c 2007-11-22 16:09:55 UTC (rev 20472) @@ -33,6 +33,12 @@ #define SYS_RECVMSG 17 #endif +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include +#include +#else +#define SINGLE_THREAD_P 1 +#endif #ifdef L_accept extern __typeof(accept) __libc_accept; @@ -47,7 +53,17 @@ args[0] = s; args[1] = (unsigned long) addr; args[2] = (unsigned long) addrlen; - return __socketcall(SYS_ACCEPT, args); + + if (SINGLE_THREAD_P) + return __socketcall(SYS_ACCEPT, args); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __socketcall(SYS_ACCEPT, args); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif + } #endif libc_hidden_proto(accept) @@ -86,7 +102,16 @@ args[0] = sockfd; args[1] = (unsigned long) saddr; args[2] = addrlen; + +if (SINGLE_THREAD_P) return __socketcall(SYS_CONNECT, args); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __socketcall(SYS_CONNECT, args); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif } #endif libc_hidden_proto(connect) @@ -179,7 +204,16 @@ args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; - return (__socketcall(SYS_RECV, args)); + + if (SINGLE_THREAD_P) + return (__socketcall(SYS_RECV, args)); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __socketcall(SYS_RECV, args); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif } #elif defined(__NR_recvfrom) libc_hidden_proto(recvfrom) @@ -212,7 +246,16 @@ args[3] = flags; args[4] = (unsigned long) to; args[5] = (unsigned long) tolen; + +if (SINGLE_THREAD_P) return (__socketcall(SYS_RECVFROM, args)); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __socketcall(SYS_RECVFROM, args); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif } #endif libc_hidden_proto(recvfrom) @@ -233,7 +276,16 @@ args[0] = sockfd; args[1] = (unsigned long) msg; args[2] = flags; - return (__socketcall(SYS_RECVMSG, args)); + +if (SINGLE_THREAD_P) + return (__socketcall(SYS_RECVMSG, args)); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __socketcall(SYS_RECVMSG, args); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif } #endif libc_hidden_proto(recvmsg) @@ -256,7 +308,16 @@ args[1] = (unsigned long) buffer; args[2] = len; args[3] = flags; + +if (SINGLE_THREAD_P) return (__socketcall(SYS_SEND, args)); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __socketcall(SYS_SEND, args); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif } #elif defined(__NR_sendto) libc_hidden_proto(sendto) @@ -283,7 +344,16 @@ a