bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Overloaded shared-library functions on hppa-linux


From: Alan Modra
Subject: Re: Overloaded shared-library functions on hppa-linux
Date: Sat, 20 Apr 2002 10:49:22 +0930
User-agent: Mutt/1.3.25i

On Fri, Apr 19, 2002 at 05:44:13PM -0400, John David Anglin wrote:
> It appears that that the assumption that calls within a shared
> library are not overloaded is present in a number of places in
> elf32-hppa.c.

Looks like I set up the .plt entries properly.  Uh oh, hppa_type_of_stub
looks decidedly dodgy.  plt entries, but no stubs to use them.  :-(

I think the following is correct, but haven't tested it.  Would one
(or both) of you mind doing the testing?  My parisc box is slow, and I
haven't kept binutils+gcc+glibc up to date on it.

bfd/ChangeLog
        * elf32-hppa.c (hppa_type_of_stub): Correct and simplify condition
        under which a plt call stub is used.
        (allocate_plt_static): Clear h-plabel except when plt entry is
        exclusively used for a plabel.
        (allocate_dynrelocs): Use the above to simplify plt sizing.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.77
diff -u -p -r1.77 elf32-hppa.c
--- bfd/elf32-hppa.c    8 Apr 2002 11:01:42 -0000       1.77
+++ bfd/elf32-hppa.c    20 Apr 2002 01:14:26 -0000
@@ -683,21 +683,12 @@ hppa_type_of_stub (input_sec, rel, hash,
   unsigned int r_type;
 
   if (hash != NULL
-      && (((hash->elf.root.type == bfd_link_hash_defined
-           || hash->elf.root.type == bfd_link_hash_defweak)
-          && hash->elf.root.u.def.section->output_section == NULL)
-         || (hash->elf.root.type == bfd_link_hash_defweak
-             && hash->elf.dynindx != -1
-             && hash->elf.plt.offset != (bfd_vma) -1)
-         || hash->elf.root.type == bfd_link_hash_undefweak
-         || hash->elf.root.type == bfd_link_hash_undefined
-         || (hash->maybe_pic_call && !(input_sec->flags & SEC_HAS_GOT_REF))))
-    {
-      /* If output_section is NULL, then it's a symbol defined in a
-        shared library.  We will need an import stub.  Decide between
-        hppa_stub_import and hppa_stub_import_shared later.  For
-        shared links we need stubs for undefined or weak syms too;
-        They will presumably be resolved by the dynamic linker.  */
+      && hash->elf.dynindx != -1
+      && hash->elf.plt.offset != (bfd_vma) -1
+      && !hash->plabel)
+    {
+      /* We need an import stub.  Decide between hppa_stub_import
+        and hppa_stub_import_shared later.  */
       return hppa_stub_import;
     }
 
@@ -2039,6 +2030,7 @@ allocate_plt_static (h, inf)
     {
       /* Make an entry in the .plt section for non-pic code that is
         calling pic code.  */
+      ((struct elf32_hppa_link_hash_entry *) h)->plabel = 0;
       s = htab->splt;
       h->plt.offset = s->_raw_size;
       s->_raw_size += PLT_ENTRY_SIZE;
@@ -2058,7 +2050,11 @@ allocate_plt_static (h, inf)
 
       if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
        {
-         /* Allocate these later.  */
+         /* Allocate these later.  From this point on, h->plabel
+            means that the plt entry is only used by a plabel.
+            We'll be using a normal plt entry for this symbol, so
+            clear the plabel indicator.  */
+         ((struct elf32_hppa_link_hash_entry *) h)->plabel = 0;
        }
       else if (((struct elf32_hppa_link_hash_entry *) h)->plabel)
        {
@@ -2109,7 +2105,7 @@ allocate_dynrelocs (h, inf)
   if (htab->elf.dynamic_sections_created
       && h->plt.offset != (bfd_vma) -1
       && !((struct elf32_hppa_link_hash_entry *) h)->pic_call
-      && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+      && !((struct elf32_hppa_link_hash_entry *) h)->plabel)
     {
       /* Make an entry in the .plt section.  */
       s = htab->splt;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]