Re: [PATCH 4/5] Add protected symbols support for all architectures
On Wed, Jan 12, 2011 at 4:48 PM, Carmelo AMOROSO wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 1/12/2011 4:31 PM, Natanael Copa wrote: >> >> this didnt apply against current git master? ... > Hi you need to apply also the patch 1,2 and 3 that revert the arch > specific implementation (sh, asrm i386). I did. -nc ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH 1/3] nptl: Fix __USER_LABEL_PREFIX__ concatenation
Hi What about using stringify around the label instead of defining the two macros? Could you give a try, thanks. Cheers Carmelo Inviato da iPod Il giorno 12/gen/2011, alle ore 13:05, Will Newton ha scritto: > The current C macro magic does not correctly concatenate the > __USER_LABEL_PREFIX__ string on architectures where it has a value. We > need to jump through a level of indirection to get the desired > behaviour. > > Signed-off-by: Matt Fleming > --- > libpthread/nptl/pthreadP.h | 14 -- > 1 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h > index c45bd11..67f253a 100644 > --- a/libpthread/nptl/pthreadP.h > +++ b/libpthread/nptl/pthreadP.h > @@ -274,6 +274,8 @@ __do_cancel (void) > #define CANCEL_RESET(oldtype) \ > __pthread_disable_asynccancel (oldtype) > > +#define LABEL_PREFIX(x, y, z) LABEL_PREFIX1(x, y, z) > +#define LABEL_PREFIX1(x, y, z) x #y z > #if !defined NOT_IN_libc > /* Same as CANCEL_ASYNC, but for use in libc.so. */ > # define LIBC_CANCEL_ASYNC() \ > @@ -282,22 +284,22 @@ __do_cancel (void) > # define LIBC_CANCEL_RESET(oldtype) \ > __libc_disable_asynccancel (oldtype) > # define LIBC_CANCEL_HANDLED() \ > - __asm__ (".globl " __USER_LABEL_PREFIX__ "__libc_enable_asynccancel"); \ > - __asm__ (".globl " __USER_LABEL_PREFIX__ "__libc_disable_asynccancel") > + __asm__ (LABEL_PREFIX(".globl ", __USER_LABEL_PREFIX__, > "__libc_enable_asynccancel")); \ > + __asm__ (LABEL_PREFIX(".globl ", __USER_LABEL_PREFIX__, > "__libc_disable_asynccancel")) > #elif defined NOT_IN_libc && defined IS_IN_libpthread > # define LIBC_CANCEL_ASYNC() CANCEL_ASYNC () > # define LIBC_CANCEL_RESET(val) CANCEL_RESET (val) > # define LIBC_CANCEL_HANDLED() \ > - __asm__ (".globl " __USER_LABEL_PREFIX__ "__pthread_enable_asynccancel"); \ > - __asm__ (".globl " __USER_LABEL_PREFIX__ "__pthread_disable_asynccancel") > + __asm__ (LABEL_PREFIX(".globl ", __USER_LABEL_PREFIX__, > "__pthread_enable_asynccancel")); \ > + __asm__ (LABEL_PREFIX(".globl ", __USER_LABEL_PREFIX__, > "__pthread_disable_asynccancel")) > #elif defined NOT_IN_libc && defined IS_IN_librt > # define LIBC_CANCEL_ASYNC() \ > __librt_enable_asynccancel () > # define LIBC_CANCEL_RESET(val) \ > __librt_disable_asynccancel (val) > # define LIBC_CANCEL_HANDLED() \ > - __asm__ (".globl " __USER_LABEL_PREFIX__ "__librt_enable_asynccancel"); \ > - __asm__ (".globl " __USER_LABEL_PREFIX__ "__librt_disable_asynccancel") > + __asm__ (LABEL_PREFIX(".globl ", __USER_LABEL_PREFIX__, > "__librt_enable_asynccancel")); \ > + __asm__ (LABEL_PREFIX(".globl ", __USER_LABEL_PREFIX__, > "__librt_disable_asynccancel")) > #else > # define LIBC_CANCEL_ASYNC()0 /* Just a dummy value. */ > # define LIBC_CANCEL_RESET(val)((void)(val)) /* Nothing, but evaluate it. > */ > -- > 1.7.2.2 > ___ > uClibc mailing list > uClibc@uclibc.org > http://lists.busybox.net/mailman/listinfo/uclibc ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH 4/5] Add protected symbols support for all architectures
Hi It's strange i'll check again and repost Apologies Inviato da iPod Il giorno 13/gen/2011, alle ore 08:07, Khem Raj ha scritto: > On 1/12/2011 7:48 AM, Carmelo AMOROSO wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 1/12/2011 4:31 PM, Natanael Copa wrote: >>> On Wed, Jan 12, 2011 at 12:22 PM, Carmelo AMOROSO >>> wrote: >>> > From: Salvatore Cro >>> > >>> > Protected symbols are global symbols for which interposition is not >>> allowed. >>> > We manage them in generic _dl_lookup_hash function. To handle protected >>> symbols >>> > we need to get a reference to the module that defines the symbol itself. >>> > So we pass a new parameter 'struct symbol_ref' to the __dl_lookup_hash >>> > that is defined as below: >>> > >>> > struct symbol_ref { >>> > const ElfW(Sym) *sym; >>> > struct elf_resolve *tpnt; >>> > }; >>> > >>> > The tpnt field is used as an ouput parameter and refers to the module >>> which >>> defines >>> > the protected symbol. >>> > Further it can be used as output parameter for TLS relocations and >>> FDPIC case. >>> > The sym field is instead used as an input parameter to detect the >>> visibility >>> of the >>> > symbol we are looking-up. >>> > In this way we get rid of different signatures for _dl_lookup_hash, >>> allowing >>> to remove >>> > the _dl_find_hash wrapper. >>> > This new structure is also suitable for prelink integration. >>> > >>> > Signed-off-by: Salvatore Cro >>> > Signed-off-by: Carmelo Amoroso >>> > --- >>> > ldso/include/dl-hash.h| 16 >>> > ldso/ldso/arm/elfinterp.c |6 +- >>> > ldso/ldso/avr32/elfinterp.c | 13 +++-- >>> > ldso/ldso/bfin/elfinterp.c| 18 -- >>> > ldso/ldso/cris/elfinterp.c|5 - >>> > ldso/ldso/dl-hash.c | 20 >>> > ldso/ldso/i386/elfinterp.c|6 +- >>> > ldso/ldso/m68k/elfinterp.c| 15 --- >>> > ldso/ldso/mips/elfinterp.c|6 +- >>> > ldso/ldso/powerpc/elfinterp.c | 20 +++- >>> > ldso/ldso/sh/elfinterp.c | 10 +++--- >>> > ldso/ldso/sh64/elfinterp.c|7 +-- >>> > ldso/ldso/sparc/elfinterp.c | 24 +--- >>> > ldso/ldso/x86_64/elfinterp.c | 20 +++- >>> > ldso/ldso/xtensa/elfinterp.c | 11 ++- >>> > ldso/libdl/libdl.c|7 --- >>> > 16 files changed, 123 insertions(+), 81 deletions(-) >>> >>> this didnt apply against current git master? >>> >>> maybe needs a rebase? >>> >>> -nc >>> >> Hi you need to apply also the patch 1,2 and 3 that revert the arch >> specific implementation (sh, asrm i386). The patch set was created >> against an updated master branch. >> > > Hi Carmelo > > As few other noted. I am having same problem applying 4/5 patch > first three apply cleanly. Please consider rebasing on git master > and git-format/git send-email once again please. > > -Khem > >> Cheers, >> carmelo >> >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v1.4.10 (MingW32) >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ >> >> iEYEARECAAYFAk0tzToACgkQoRq/3BrK1s+LYgCdESi0xoazi+ss5ZqVgmmmjUjq >> deEAn3XCc3WZghlrzXFZAqydvPnTA89K >> =OHWD >> -END PGP SIGNATURE- >> ___ >> uClibc mailing list >> uClibc@uclibc.org >> http://lists.busybox.net/mailman/listinfo/uclibc > > ___ > uClibc mailing list > uClibc@uclibc.org > http://lists.busybox.net/mailman/listinfo/uclibc ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH 4/5] Add protected symbols support for all architectures
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/13/2011 9:09 AM, Carmelo Amoroso wrote: > Hi > It's strange i'll check again and repost > > Apologies > > Inviato da iPod > > Il giorno 13/gen/2011, alle ore 08:07, Khem Raj ha > scritto: > > > On 1/12/2011 7:48 AM, Carmelo AMOROSO wrote: > On 1/12/2011 4:31 PM, Natanael Copa wrote: >> >>> On Wed, Jan 12, 2011 at 12:22 PM, Carmelo AMOROSO >> >>> wrote: >> >>> > From: Salvatore Cro >> >>> > >> >>> > Protected symbols are global symbols for which interposition is not >> allowed. >> >>> > We manage them in generic _dl_lookup_hash function. To handle >> protected >> symbols >> >>> > we need to get a reference to the module that defines the symbol >> itself. >> >>> > So we pass a new parameter 'struct symbol_ref' to the __dl_lookup_hash >> >>> > that is defined as below: >> >>> > >> >>> > struct symbol_ref { >> >>> > const ElfW(Sym) *sym; >> >>> > struct elf_resolve *tpnt; >> >>> > }; >> >>> > >> >>> > The tpnt field is used as an ouput parameter and refers to the module >> which >> >>> defines >> >>> > the protected symbol. >> >>> > Further it can be used as output parameter for TLS relocations and >> FDPIC >> case. >> >>> > The sym field is instead used as an input parameter to detect the >> visibility >> >>> of the >> >>> > symbol we are looking-up. >> >>> > In this way we get rid of different signatures for _dl_lookup_hash, >> allowing >> >>> to remove >> >>> > the _dl_find_hash wrapper. >> >>> > This new structure is also suitable for prelink integration. >> >>> > >> >>> > Signed-off-by: Salvatore Cro >> >>> > Signed-off-by: Carmelo Amoroso >> >>> > --- >> >>> > ldso/include/dl-hash.h | 16 >> >>> > ldso/ldso/arm/elfinterp.c | 6 +- >> >>> > ldso/ldso/avr32/elfinterp.c | 13 +++-- >> >>> > ldso/ldso/bfin/elfinterp.c | 18 -- >> >>> > ldso/ldso/cris/elfinterp.c | 5 - >> >>> > ldso/ldso/dl-hash.c | 20 >> >>> > ldso/ldso/i386/elfinterp.c | 6 +- >> >>> > ldso/ldso/m68k/elfinterp.c | 15 --- >> >>> > ldso/ldso/mips/elfinterp.c | 6 +- >> >>> > ldso/ldso/powerpc/elfinterp.c | 20 +++- >> >>> > ldso/ldso/sh/elfinterp.c | 10 +++--- >> >>> > ldso/ldso/sh64/elfinterp.c | 7 +-- >> >>> > ldso/ldso/sparc/elfinterp.c | 24 +--- >> >>> > ldso/ldso/x86_64/elfinterp.c | 20 +++- >> >>> > ldso/ldso/xtensa/elfinterp.c | 11 ++- >> >>> > ldso/libdl/libdl.c | 7 --- >> >>> > 16 files changed, 123 insertions(+), 81 deletions(-) >> >>> >> >>> this didnt apply against current git master? >> >>> >> >>> maybe needs a rebase? >> >>> >> >>> -nc >> >>> > Hi you need to apply also the patch 1,2 and 3 that revert the arch > specific implementation (sh, asrm i386). The patch set was created > against an updated master branch. > >> > >> > Hi Carmelo >> > >> > As few other noted. I am having same problem applying 4/5 patch >> > first three apply cleanly. Please consider rebasing on git master >> > and git-format/git send-email once again please. >> > >> > -Khem >> > > Cheers, > carmelo > I've understood... I'm now using the damned M$ Exchange server instead of the older ST imap so the patch are arriving malformed due to MS. Please find attach a tar.gz with all the patch set. I'm really sorry. Carmelo ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc > > > > ___ > > uClibc mailing list > > uClibc@uclibc.org > > http://lists.busybox.net/mailman/listinfo/uclibc > ___ > uClibc mailing list > uClibc@uclibc.org > http://lists.busybox.net/mailman/listinfo/uclibc -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk0vF5YACgkQoRq/3BrK1s/4IACg5dvM0XSgHe4KQMXFx3SCrke5 EKQAoLGLpHRG9wjZXhtklyGyiMh6vJl7 =nLx+ -END PGP SIGNATURE- protected_symbols_patches.tar.gz Description: protected_symbols_patches.tar.gz ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH v2] nptl: Fix __USER_LABEL_PREFIX__ concatenation
The current C macro magic does not correctly concatenate the __USER_LABEL_PREFIX__ string on architectures where it has a non-empty value. We need to use __stringify to get the desired behaviour. Signed-off-by: Will Newton --- libpthread/nptl/pthreadP.h | 14 -- 1 files changed, 8 insertions(+), 6 deletions(-) v2: - Use __stringify instead of hand rolled macro. diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h index c45bd11..fbac7d0 100644 --- a/libpthread/nptl/pthreadP.h +++ b/libpthread/nptl/pthreadP.h @@ -274,6 +274,8 @@ __do_cancel (void) #define CANCEL_RESET(oldtype) \ __pthread_disable_asynccancel (oldtype) +#define __LABEL_PREFIX__ __stringify(__USER_LABEL_PREFIX__) + #if !defined NOT_IN_libc /* Same as CANCEL_ASYNC, but for use in libc.so. */ # define LIBC_CANCEL_ASYNC() \ @@ -282,22 +284,22 @@ __do_cancel (void) # define LIBC_CANCEL_RESET(oldtype) \ __libc_disable_asynccancel (oldtype) # define LIBC_CANCEL_HANDLED() \ - __asm__ (".globl " __USER_LABEL_PREFIX__ "__libc_enable_asynccancel"); \ - __asm__ (".globl " __USER_LABEL_PREFIX__ "__libc_disable_asynccancel") + __asm__ (".globl " __LABEL_PREFIX__ "__libc_enable_asynccancel"); \ + __asm__ (".globl " __LABEL_PREFIX__ "__libc_disable_asynccancel") #elif defined NOT_IN_libc && defined IS_IN_libpthread # define LIBC_CANCEL_ASYNC() CANCEL_ASYNC () # define LIBC_CANCEL_RESET(val) CANCEL_RESET (val) # define LIBC_CANCEL_HANDLED() \ - __asm__ (".globl " __USER_LABEL_PREFIX__ "__pthread_enable_asynccancel"); \ - __asm__ (".globl " __USER_LABEL_PREFIX__ "__pthread_disable_asynccancel") + __asm__ (".globl " __LABEL_PREFIX__ "__pthread_enable_asynccancel"); \ + __asm__ (".globl " __LABEL_PREFIX__ "__pthread_disable_asynccancel") #elif defined NOT_IN_libc && defined IS_IN_librt # define LIBC_CANCEL_ASYNC() \ __librt_enable_asynccancel () # define LIBC_CANCEL_RESET(val) \ __librt_disable_asynccancel (val) # define LIBC_CANCEL_HANDLED() \ - __asm__ (".globl " __USER_LABEL_PREFIX__ "__librt_enable_asynccancel"); \ - __asm__ (".globl " __USER_LABEL_PREFIX__ "__librt_disable_asynccancel") + __asm__ (".globl " __LABEL_PREFIX__ "__librt_enable_asynccancel"); \ + __asm__ (".globl " __LABEL_PREFIX__ "__librt_disable_asynccancel") #else # define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */ # define LIBC_CANCEL_RESET(val)((void)(val)) /* Nothing, but evaluate it. */ -- 1.7.2.2 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH 4/5] Add protected symbols support for all architectures
On Wed, Jan 12, 2011 at 3:22 AM, Carmelo AMOROSO wrote: > diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c > index a56ee81..1c1489d 100644 > --- a/ldso/ldso/mips/elfinterp.c > +++ b/ldso/ldso/mips/elfinterp.c > @@ -213,10 +213,14 @@ int _dl_parse_relocation_information(struct dyn_elf > *xpnt, > # endif > { > struct elf_resolve *tpnt_tls = NULL; > + struct symbol_ref sym_ref; > + sym_ref.sym = &symtab[symtab_index]; > + sym_ref.tpnt = NULL; > > if > (ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_LOCAL) { > symbol_addr = (unsigned long) > _dl_find_hash(symname, tpnt->symbol_scope, > - tpnt, > elf_machine_type_class(reloc_type), &tpnt_tls); > + tpnt, > elf_machine_type_class(reloc_type), &sym_ref); > + tls_tpnt = sym_ref.tpnt; ^^^ in mips its called tpnt_tls :). I am ok if you rename it to tls_tpnt in the complete function thats fine and will be like other arches but as it is in the patch it wont work. > } > /* In case of a TLS reloc, tpnt_tls NULL means we > have an 'anonymous' > symbol. This is the case for a static tls > variable, so the lookup > ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH 0/5] Generic implementation for protected symbols
On 1/12/2011 5:46 AM, Carmelo AMOROSO wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 1/12/2011 12:34 PM, Carmelo AMOROSO wrote: Folks, even if a bit late here the patch set for handling protected symbols for all architecture in the common code _dl_find_hash. The implementation is based on a Jocke's proposal modified according to a my suggestion that will allow to cope with proetcted symbols, TLS, FDPIC and prelinking as well. Work build/runtime tested on SH4. The only architecture that has not been changed is FRV that seems to be completely broken (it is using a _dl_find_hash_mod function that it is not longer available). I see rooms for further tidy-up of the ldso code after this change, but I-d prefer to apply them later. I'd kindly ask arch maintainers and uClibc fans to review and possibily test their own preferred archs. We should be able to include this code for the 0.9.32 asap. Thanks and enjoy uClibc, Carmelo Carmelo Amoroso (4): Revert "ldso/i386: support protected symbols" Revert "ldso_sh: add support for protected symbols to SH" Revert "ldso/arm: Correct protected symbol resolution" ldso: get rid of _dl_lookup_hash Salvatore Cro (1): Add protected symbols support for all architectures ldso/include/dl-hash.h| 20 ++ ldso/ldso/arm/elfinterp.c | 17 ++- ldso/ldso/avr32/elfinterp.c | 13 ++- ldso/ldso/bfin/elfinterp.c| 18 +++- ldso/ldso/cris/elfinterp.c|5 +++- ldso/ldso/dl-hash.c | 22 ldso/ldso/i386/elfinterp.c| 16 ++ ldso/ldso/m68k/elfinterp.c| 15 +++-- ldso/ldso/mips/elfinterp.c|6 - ldso/ldso/powerpc/elfinterp.c | 20 ++ ldso/ldso/sh/elfinterp.c | 44 +++- ldso/ldso/sh64/elfinterp.c|7 - ldso/ldso/sparc/elfinterp.c | 24 -- ldso/ldso/x86_64/elfinterp.c | 20 ++ ldso/ldso/xtensa/elfinterp.c | 11 + ldso/libdl/libdl.c|7 +++-- 16 files changed, 141 insertions(+), 124 deletions(-) Once this will be reviewed and approved, I'll manage to merge&test it on prelink branch. This will allow us to easily merge prelink back to master after 0.9.32 release at least. I have seen no issues on x86, arm and mips( with patch 4/5 fixed myself for mips) systems booted fine and tests showed no regressions on ppc it built fine but I do not have runtime results due to other reasons. Acked-by: Khem Raj Cheers, Carmelo -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk0tsK0ACgkQoRq/3BrK1s/uXwCfb24klSPfTagqlBpY4k2fUpNd pLIAn1A59ZRdGJKuyZbAoXrIXYFu6Y8r =WB/D -END PGP SIGNATURE- ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc