"symbol '': can't resolve symbol"
Joakim Tjernlund
joakim.tjernlund at transmode.se
Mon Jul 28 15:22:18 UTC 2008
On Mon, 2008-07-28 at 00:47 +0200, Stéphan Kochen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Joakim Tjernlund schreef:
> > If you use -pie, you should also use -fPIC (gcc option). But why
> > use -pie? Just drop it if you don't have special reasons.
>
> Excellent! Turns out bluez-utils, bluez-libs and dbus all have some
> magic in their autoconf setup for additional PIE support. Getting rid of
> it fixed the issues, and they now execute!
>
> Many thanks for the help!
> - -- Stéphan
Good, however you should have made it to the REL24 reloc before
crashing. Would you mind trying the below patch with the old
dbus-daemon(built with -pie) to see if takes you to the
REL24 reloc?
Jocke
>From 249f6028ea36580388deb1f963d71e77665e29a8 Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
Date: Mon, 28 Jul 2008 17:11:17 +0200
Subject: [PATCH] Add check for STB_LOCAL.
Needed for "strange" relocs like R_PPC_ADDR16_HA,
R_PPC_ADDR16_HI and R_PPC_ADDR16_LO.
---
ldso/ldso/powerpc/elfinterp.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c
index eeb3250..66decca 100644
--- a/ldso/ldso/powerpc/elfinterp.c
+++ b/ldso/ldso/powerpc/elfinterp.c
@@ -195,24 +195,28 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
char *symname;
Elf32_Addr *reloc_addr;
Elf32_Addr finaladdr;
-
+ const Elf32_Sym *sym;
unsigned long symbol_addr;
#if defined (__SUPPORT_LD_DEBUG__)
unsigned long old_val;
#endif
reloc_addr = (Elf32_Addr *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
- symbol_addr = tpnt->loadaddr; /* For R_PPC_RELATIVE */
+ symbol_addr = tpnt->loadaddr; /* For R_PPC_RELATIVE and STB_LOCAL */
symtab_index = ELF32_R_SYM(rpnt->r_info);
- symname = strtab + symtab[symtab_index].st_name;
- if (symtab_index) {
+ sym = &symtab[symtab_index];
+ symname = strtab + sym->st_name;
+ /* binutils on ppc32 includes st_value in r_addend for relocations
+ against local symbols. */
+ if (symtab_index && !(ELF32_ST_BIND (sym->st_info) == STB_LOCAL
+ && sym->st_shndx != SHN_UNDEF)) {
symbol_addr = (unsigned long) _dl_find_hash(symname, scope, tpnt,
elf_machine_type_class(reloc_type));
/* We want to allow undefined references to weak symbols - this might
* have been intentional. We should not be linking local symbols
* here, so all bases should be covered.
*/
- if (unlikely(!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK))
+ if (unlikely(!symbol_addr && ELF32_ST_BIND(sym->st_info) != STB_WEAK))
return 1;
}
#if defined (__SUPPORT_LD_DEBUG__)
@@ -272,7 +276,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
case R_PPC_ADDR16_HI:
finaladdr >>= 16; /* fall through. */
case R_PPC_ADDR16_LO:
- *(short *)reloc_addr = finaladdr;
+ *(Elf32_Half *)reloc_addr = finaladdr;
break;
case R_PPC_REL24:
#if 0
--
1.5.6.3
More information about the uClibc
mailing list