> > > > Austin Foxley wrote: > > > On 04/16/2010 07:37 AM, Timo Teräs wrote: > > >> Ok, second try on getting the libc - libpthread interactions right. > > >> > > >> > > >> This includes the Joakim's patch for protected symbols, with a > > >> little fix from me. > > > > > > I thought the hidden symbol thing would work, because I thought when > > > you turned on stdio-futexes, everywhere used futexes. I didn't > > > realize other places were using __pthread* symbols directly... > > > > Yeah, that was my impression too. But it turns out to work > > differently :/ > > > > > We'll need to patch all the other arch's ldso as well to handle > > > protected symbols, but I'll apply this for now. If I'm not mistaken, > > > other archs will be no worse off than they are now in this situation. > > > Right? > > > > Right. It makes things slightly better for other archs too, but > > in practice it won't work until they support protected symbols too. > > Finally looked at the ldso patch and I am not entirely happy with it. > I think the general structure should be different to make it easier > to follow the code and port it to other archs. I can probably > take a stab at it during the weekend but I have no env. to test in > so I will have to do it blindly. > > Jocke
So this is what I came up with. I do wonder if not linux_resolver need PROTECTED support too? Have you tested with LAZY relocation too? Jocke >From 315d855288d05d6503ec66320a66f9d29c52246d Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund <[email protected]> Date: Sat, 17 Apr 2010 11:39:24 +0200 Subject: [PATCH 1/2] ldso,i386: Cleanup PROTECTED support. Signed-off-by: Joakim Tjernlund <[email protected]> --- ldso/ldso/i386/elfinterp.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c index 1e3a2b2..7e05c14 100644 --- a/ldso/ldso/i386/elfinterp.c +++ b/ldso/ldso/i386/elfinterp.c @@ -175,11 +175,16 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, symbol_addr = 0; symname = strtab + symtab[symtab_index].st_name; - if (symtab_index && - (ELF32_ST_VISIBILITY(symtab[symtab_index].st_other) - != STV_PROTECTED)) { - symbol_addr = (unsigned long)_dl_find_hash(symname, scope, tpnt, - elf_machine_type_class(reloc_type), &tls_tpnt); + if (symtab_index) { + if (ELF32_ST_VISIBILITY(symtab[symtab_index].st_other) + != STV_PROTECTED) + symbol_addr = (unsigned long)_dl_find_hash(symname, scope, + tpnt, + elf_machine_type_class(reloc_type), + &tls_tpnt); + else + symbol_addr = DL_FIND_HASH_VALUE(tpnt, elf_machine_type_class(reloc_type), + &symtab[symtab_index]); /* * We want to allow undefined references to weak symbols - this @@ -190,11 +195,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK)) return 1; } else { - if (symtab_index) - symbol_addr = DL_FIND_HASH_VALUE(tpnt, elf_machine_type_class(reloc_type), - &symtab[symtab_index]); - else - symbol_addr = symtab[symtab_index].st_value; + symbol_addr = symtab[symtab_index].st_value; tls_tpnt = tpnt; } -- 1.6.4.4 >From d4607f34aa60c201c731eac4b7297291d72cdf27 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund <[email protected]> Date: Sat, 17 Apr 2010 11:47:20 +0200 Subject: [PATCH 2/2] ldso,i386: Remove suspect code. Make it work as glibc. Possibly one need to add test for NULL tls_tpnt inside switch{} stmt too(glibc does) Signed-off-by: Joakim Tjernlund <[email protected]> --- ldso/ldso/i386/elfinterp.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c index 7e05c14..b04febc 100644 --- a/ldso/ldso/i386/elfinterp.c +++ b/ldso/ldso/i386/elfinterp.c @@ -194,11 +194,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, if (unlikely(!symbol_addr && (ELF_ST_TYPE(symtab[symtab_index].st_info) != STT_TLS) && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK)) return 1; - } else { - symbol_addr = symtab[symtab_index].st_value; - tls_tpnt = tpnt; } - #if defined (__SUPPORT_LD_DEBUG__) old_val = *reloc_addr; -- 1.6.4.4 _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
