Joakim Tjernlund wrote:
Timo Teräs <timo.te...@gmail.com> wrote on 2010/04/16 11:39:00:
Joakim Tjernlund wrote:
Yes. Exactly that. It's __attribute__(( visibility("protected") )).
Or .protected for asm. I'm doing a patch on this right now.
http://www.ohse.de/uwe/articles/gcc-attributes.html#func-visibility
But this is PROTECTED and you might need to impl. STB_PROTECTED in ldso
That should be STV_PROTECTED

to support it. I once looked at that when I was hacking ldso in uClibc
some years ago but I don't remember the details any more.
Ah, you're right. It does need ld.so support. I'll try to figure out
if it's easy to implement, or if we get away with some linker flags.


This MIGHT do it(completely untested):

diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c
index a01c1d0..7f1b408 100644
--- a/ldso/ldso/i386/elfinterp.c
+++ b/ldso/ldso/i386/elfinterp.c
@@ -175,7 +175,9 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf 
*scope,
        symbol_addr = 0;
        symname = strtab + symtab[symtab_index].st_name;

-       if (symtab_index) {
+       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);



Does not seem to work as expected. When using this, and getting the
case when pthread_self is being forwarded via libc (so we end up using
relocation of protected __pthread_self in nptl).

where
#0  0x0000964d in ?? ()
#1  0xb785302f in pthread_self () at libpthread/nptl/forward.c:137
#2  0xb77b66be in plugin_main () from ./plugin.so
#3  0xb7876672 in main () from /home/ncopa/pthread/test

But the symbol should is actually located at:

(gdb) p __pthread_self
$3 = {pthread_t (void)} 0xb77c264d <__pthread_self>

Smells like we did not add the base address.

- Timo
_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to