Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/toolchain/gas/config Gegneralize the PLT/GOT proces...



details:   https://anonhg.NetBSD.org/src/rev/a7b84e620c0d
branches:  trunk
changeset: 522551:a7b84e620c0d
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Feb 21 06:59:16 2002 +0000

description:
Gegneralize the PLT/GOT processing to properly emit relocs even for symbols
in the segment/file so that they linker can resolve them for shared libraries.

diffstat:

 gnu/dist/toolchain/gas/config/tc-vax.c |  12 +++++++-----
 gnu/dist/toolchain/gas/config/tc-vax.h |   7 +++++++
 2 files changed, 14 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 35cb4f5e91fb -r a7b84e620c0d gnu/dist/toolchain/gas/config/tc-vax.c
--- a/gnu/dist/toolchain/gas/config/tc-vax.c    Thu Feb 21 06:36:11 2002 +0000
+++ b/gnu/dist/toolchain/gas/config/tc-vax.c    Thu Feb 21 06:59:16 2002 +0000
@@ -3539,7 +3539,7 @@
   reloc = (arelent *) xmalloc (sizeof (arelent));
   reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
 #ifdef OBJ_ELF
-  if (code == BFD_RELOC_32_GOT_PCREL)
+  if (code == BFD_RELOC_32_GOT_PCREL || code == BFD_RELOC_32_PLT_PCREL)
     *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_frag->fr_symbol);
   else
 #endif
@@ -3551,10 +3551,12 @@
   else
     reloc->addend = 0;
 #elif defined(OBJ_ELF)
-  if (code != BFD_RELOC_32_GOT_PCREL)
-    reloc->addend = fixp->fx_offset;
-  else
-    reloc->addend = fixp->fx_addnumber;
+  reloc->addend = fixp->fx_offset;
+  if (code == BFD_RELOC_32_GOT_PCREL || code == BFD_RELOC_32_PLT_PCREL)
+    {
+      if (S_IS_DEFINED(fixp->fx_frag->fr_symbol))
+       reloc->addend -= S_GET_VALUE(fixp->fx_frag->fr_symbol);
+    }
 #else
   if (!fixp->fx_pcrel)
     {
diff -r 35cb4f5e91fb -r a7b84e620c0d gnu/dist/toolchain/gas/config/tc-vax.h
--- a/gnu/dist/toolchain/gas/config/tc-vax.h    Thu Feb 21 06:36:11 2002 +0000
+++ b/gnu/dist/toolchain/gas/config/tc-vax.h    Thu Feb 21 06:59:16 2002 +0000
@@ -77,6 +77,13 @@
             && ! S_IS_WEAK ((FIX)->fx_addsy)           \
             && S_IS_DEFINED ((FIX)->fx_addsy)          \
             && ! S_IS_COMMON ((FIX)->fx_addsy)))
+#define        TC_FORCE_RELOCATION(FIX)                        \
+       ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL ||  \
+        (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL)
+
+#define        TC_FORCE_RELOCATION_SECTION(FIX, SEC)           \
+       ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL ||  \
+        (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL)
 #endif
 
 /*



Home | Main Index | Thread Index | Old Index