This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix R_SPARC_DISP* against hidden symbols in shared libs
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Cc: drow at mvista dot com
- Date: Wed, 3 Apr 2002 19:48:46 +0200
- Subject: [PATCH] Fix R_SPARC_DISP* against hidden symbols in shared libs
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
I've just commited the following patch.
gcc relies on all R_SPARC_DISP* relocs against local and hidden symbols to
be resolved at link time, but we were emitting R_SPARC_DISP* relocs against
hidden symbols.
One day SPARC bfd backends should be converted to keep track
of all dynamic relocs, so that no R_SPARC_NONE relocs are created, ATM this
is IMHO sufficient.
Daniel, ok to commit to 2.12 branch too?
2002-04-03 Jakub Jelinek <jakub@redhat.com>
* elf32-sparc.c (elf32_sparc_relocate_section): Don't emit dynamic
PC relative relocs against hidden symbols.
* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
--- bfd/elf32-sparc.c.jj Wed Apr 3 12:22:46 2002
+++ bfd/elf32-sparc.c Wed Apr 3 12:46:34 2002
@@ -1467,6 +1467,17 @@ elf32_sparc_relocate_section (output_bfd
if (!(outrel.r_offset & 3))
r_type = R_SPARC_32;
break;
+ case R_SPARC_DISP8:
+ case R_SPARC_DISP16:
+ case R_SPARC_DISP32:
+ /* If the symbol is not dynamic, we should not keep
+ a dynamic relocation. But an .rela.* slot has been
+ allocated for it, output R_SPARC_NONE.
+ FIXME: Add code tracking needed dynamic relocs as
+ e.g. i386 has. */
+ if (h->dynindx == -1)
+ skip = true, relocate = true;
+ break;
}
if (skip)
--- bfd/elf64-sparc.c.jj Wed Apr 3 12:22:46 2002
+++ bfd/elf64-sparc.c Wed Apr 3 12:54:21 2002
@@ -2053,11 +2053,11 @@ sparc64_elf_relocate_section (output_bfd
case R_SPARC_DISP8:
case R_SPARC_DISP16:
case R_SPARC_DISP32:
+ case R_SPARC_DISP64:
case R_SPARC_WDISP30:
case R_SPARC_WDISP22:
case R_SPARC_WDISP19:
case R_SPARC_WDISP16:
- case R_SPARC_DISP64:
if (h == NULL)
break;
/* Fall through. */
@@ -2146,6 +2146,18 @@ sparc64_elf_relocate_section (output_bfd
case R_SPARC_UA64:
if (!(outrel.r_offset & 7)) r_type = R_SPARC_64;
break;
+ case R_SPARC_DISP8:
+ case R_SPARC_DISP16:
+ case R_SPARC_DISP32:
+ case R_SPARC_DISP64:
+ /* If the symbol is not dynamic, we should not keep
+ a dynamic relocation. But an .rela.* slot has been
+ allocated for it, output R_SPARC_NONE.
+ FIXME: Add code tracking needed dynamic relocs as
+ e.g. i386 has. */
+ if (h->dynindx == -1)
+ skip = true, relocate = true;
+ break;
}
if (skip)
Jakub