[PATCH 4/5] Add protected symbols support for all architectures

Jian Peng jipeng at broadcom.com
Wed Jan 12 18:50:07 UTC 2011


Hi, Carmelo,

I tried to apply the patch after "git pull" to update from master, but it failed

$ patch -p1 < ../uClibc-0.9.32-protected-symbol-1.patch 
patching file ldso/ldso/i386/elfinterp.c
Hunk #1 FAILED at 175.
Hunk #2 FAILED at 188.
2 out of 2 hunks FAILED -- saving rejects to file ldso/ldso/i386/elfinterp.c.rej

The line 175 mismatched as shown in ldso/ldso/i386/elfinterp.c.rej

*************** _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
*** 175,183 ****
          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);
  
--- 175,181 ----
          symbol_addr = 0;
          symname = strtab + symtab[symtab_index].st_name;
  
+        if (symtab_index) {
                  symbol_addr = (unsigned long)_dl_find_hash(symname, scope, tpnt,
                                                             elf_machine_type_class(reloc_type), &tls_tpnt);
  
*************** _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
*** 190,200 ****
                                          && 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;
                  tls_tpnt = tpnt;
          }
  
--- 188,194 ----
                                          && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK))
                          return 1;
          } else {
+                symbol_addr = symtab[symtab_index].st_value;
                  tls_tpnt = tpnt;
          }

Any suggestion?

Thanks,
Jian

________________________________________
From: uclibc-bounces at uclibc.org [uclibc-bounces at uclibc.org] On Behalf Of Carmelo AMOROSO [carmelo.amoroso at st.com]
Sent: Wednesday, January 12, 2011 7:48 AM
To: Natanael Copa
Cc: uclibc at uclibc.org
Subject: Re: [PATCH 4/5] Add protected symbols support for all architectures

-----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
> <carmelo.amoroso at st.com> wrote:
>  > From: Salvatore Cro <salvatore.cro at st.com>
>  >
>  > 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 <salvatore.cro at st.com>
>  > Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
>  > ---
>  >  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.

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 at uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc




More information about the uClibc mailing list