]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
John David Anglin's 2002-02-12 mainline changes
authorAlan Modra <amodra@gmail.com>
Sun, 17 Feb 2002 23:12:11 +0000 (23:12 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 17 Feb 2002 23:12:11 +0000 (23:12 +0000)
bfd/ChangeLog
bfd/elf-hppa.h
bfd/elf32-hppa.c
bfd/elf32-hppa.h
bfd/elf64-hppa.h
gas/ChangeLog
gas/config/tc-hppa.c
gas/testsuite/ChangeLog
gas/testsuite/gas/hppa/reloc/reloc.exp
ld/testsuite/ChangeLog
ld/testsuite/ld-selective/selective.exp

index 633303aceef7a34968fb54e47b56bdfa232cb9f9..6a84177b5ed36a6929a22a1e763ba02e297effda 100644 (file)
@@ -1,3 +1,12 @@
+2002-02-18  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * elf-hppa.h (elf_hppa_reloc_final_type): New function stripped
+       from _bfd_elf_hppa_gen_reloc_type.
+       (_bfd_elf_hppa_gen_reloc_type): Remove duplicate prototype.
+       * elf32-hppa.h (elf32_hppa_reloc_final_type): Add protptype.
+       * elf32-hppa.c: Include elf32-hppa.h before elf-hppa.h.
+       * elf64-hppa.h (elf64_hppa_reloc_final_type): Add protptype.
+
 2002-02-17  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * mmo.c: Correct and improve comments.
index cca760dad3499072391f0eaad87112a3a72d8059..a98c2b0a9737dbf9093004815737f1ea4f5b620d 100644 (file)
@@ -1,5 +1,5 @@
 /* Common code for PA ELF implementations.
-   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define ELF_R_TYPE(X)   ELF64_R_TYPE(X)
 #define ELF_R_SYM(X)   ELF64_R_SYM(X)
 #define elf_hppa_internal_shdr Elf64_Internal_Shdr
+#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
 #define elf_hppa_relocate_section elf64_hppa_relocate_section
 #define bfd_elf_bfd_final_link bfd_elf64_bfd_final_link
@@ -38,15 +39,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define ELF_R_TYPE(X)   ELF32_R_TYPE(X)
 #define ELF_R_SYM(X)   ELF32_R_SYM(X)
 #define elf_hppa_internal_shdr Elf32_Internal_Shdr
+#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
 #define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
 #define elf_hppa_relocate_section elf32_hppa_relocate_section
 #define bfd_elf_bfd_final_link bfd_elf32_bfd_final_link
 #define elf_hppa_final_link elf32_hppa_final_link
 #endif
 
-elf_hppa_reloc_type ** _bfd_elf_hppa_gen_reloc_type
-  PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *));
-
 static void elf_hppa_info_to_howto
   PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
 
@@ -605,40 +604,17 @@ static reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] =
 #define OFFSET_14R_FROM_21L 4
 #define OFFSET_14F_FROM_21L 5
 
-/* Return one (or more) BFD relocations which implement the base
-   relocation with modifications based on format and field.  */
+/* Return the final relocation type for the given base type, instruction
+   format, and field selector.  */
 
-elf_hppa_reloc_type **
-_bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
+elf_hppa_reloc_type
+elf_hppa_reloc_final_type (abfd, base_type, format, field)
      bfd *abfd;
      elf_hppa_reloc_type base_type;
      int format;
      unsigned int field;
-     int ignore ATTRIBUTE_UNUSED;
-     asymbol *sym ATTRIBUTE_UNUSED;
 {
-  elf_hppa_reloc_type *finaltype;
-  elf_hppa_reloc_type **final_types;
-  bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
-
-  /* Allocate slots for the BFD relocation.  */
-  final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt);
-  if (final_types == NULL)
-    return NULL;
-
-  /* Allocate space for the relocation itself.  */
-  amt = sizeof (elf_hppa_reloc_type);
-  finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt);
-  if (finaltype == NULL)
-    return NULL;
-
-  /* Some reasonable defaults.  */
-  final_types[0] = finaltype;
-  final_types[1] = NULL;
-
-#define final_type finaltype[0]
-
-  final_type = base_type;
+  elf_hppa_reloc_type final_type = base_type;
 
   /* Just a tangle of nested switch statements to deal with the braindamage
      that a different field selector means a completely different relocation
@@ -677,7 +653,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PLABEL14R;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -693,7 +669,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_DIR17R;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -717,7 +693,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PLABEL21L;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -736,7 +712,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PLABEL32;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -750,12 +726,12 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_FPTR64;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
        default:
-         return NULL;
+         return R_PARISC_NONE;
        }
       break;
 
@@ -776,7 +752,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = base_type + OFFSET_14F_FROM_21L;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -792,12 +768,12 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = base_type;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
        default:
-         return NULL;
+         return R_PARISC_NONE;
        }
       break;
 
@@ -811,7 +787,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PCREL12F;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -829,7 +805,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PCREL14F;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -845,7 +821,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PCREL17F;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -860,7 +836,7 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PCREL21L;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
@@ -871,12 +847,12 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
              final_type = R_PARISC_PCREL22F;
              break;
            default:
-             return NULL;
+             return R_PARISC_NONE;
            }
          break;
 
        default:
-         return NULL;
+         return R_PARISC_NONE;
        }
       break;
 
@@ -888,9 +864,45 @@ _bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
       break;
 
     default:
-      return NULL;
+      return R_PARISC_NONE;
     }
 
+  return final_type;
+}
+
+/* Return one (or more) BFD relocations which implement the base
+   relocation with modifications based on format and field.  */
+
+elf_hppa_reloc_type **
+_bfd_elf_hppa_gen_reloc_type (abfd, base_type, format, field, ignore, sym)
+     bfd *abfd;
+     elf_hppa_reloc_type base_type;
+     int format;
+     unsigned int field;
+     int ignore ATTRIBUTE_UNUSED;
+     asymbol *sym ATTRIBUTE_UNUSED;
+{
+  elf_hppa_reloc_type *finaltype;
+  elf_hppa_reloc_type **final_types;
+  bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
+
+  /* Allocate slots for the BFD relocation.  */
+  final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt);
+  if (final_types == NULL)
+    return NULL;
+
+  /* Allocate space for the relocation itself.  */
+  amt = sizeof (elf_hppa_reloc_type);
+  finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt);
+  if (finaltype == NULL)
+    return NULL;
+
+  /* Some reasonable defaults.  */
+  final_types[0] = finaltype;
+  final_types[1] = NULL;
+
+  *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);
+
   return final_types;
 }
 
index 41ec0ce60bdab11fffa77b1cba60e5d0e5d8e5ef..ce3a9b85c8a190e18968444a77c8371d1f63db61 100644 (file)
@@ -32,8 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "libhppa.h"
 #include "elf32-hppa.h"
 #define ARCH_SIZE              32
-#include "elf-hppa.h"
 #include "elf32-hppa.h"
+#include "elf-hppa.h"
 
 /* In order to gain some understanding of code in this file without
    knowing all the intricate details of the linker, note the
index eda452b4b3f2d65e3b681b037b62c96450e3f2f3..ea680c305df73bdb26e298375e6773da1140c78d 100644 (file)
@@ -47,6 +47,9 @@ boolean elf32_hppa_set_gp
 boolean elf32_hppa_build_stubs
   PARAMS ((struct bfd_link_info *));
 
+elf_hppa_reloc_type elf32_hppa_reloc_final_type
+  PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int));
+
 extern elf_hppa_reloc_type ** _bfd_elf32_hppa_gen_reloc_type
   PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *));
 
index b5dc5d4b78338215e1934a9b8f9241df049e4fa7..7bb5a26dee5abe6c1e446a1ea402e422978d5948 100644 (file)
@@ -1,6 +1,6 @@
 /* ELF64/HPPA support
 
-   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "libhppa.h"
 #include "elf/hppa.h"
 
+elf_hppa_reloc_type elf64_hppa_reloc_final_type
+  PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int));
+
 extern elf_hppa_reloc_type ** _bfd_elf64_hppa_gen_reloc_type
   PARAMS ((bfd *, elf_hppa_reloc_type, int, unsigned int, int, asymbol *));
 
index 1481f43848823e9be55412ca48b15f28a0a57e88..b1ba5b64bf250d8abc9f1541e9d9c7750d055c7c 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-18  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * config/tc-hppa.c (hppa_fix_adjustable): Don't adjust final types
+       that implicitly use LR and RR selectors.
+
 2002-02-16  Nick Clifton  <nickc@cambridge.redhat.com>
 
        * doc/as.texinfo (Machine Dependencies): Fix typo: MMIX used
index 3ec1bf34b7ad6989ff42868348ad5dad53e3cca3..e9eb8e1b0f9572e5a766418d080975e224165c97 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-hppa.c -- Assemble for the PA
-   Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+   Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -57,8 +57,10 @@ typedef elf_symbol_type obj_symbol_type;
 #if TARGET_ARCH_SIZE == 64
 /* How to generate a relocation.  */
 #define hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
+#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
 #else
 #define hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
+#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
 #endif
 
 /* ELF objects can have versions, but apparently do not have anywhere
@@ -8373,6 +8375,7 @@ int
 hppa_fix_adjustable (fixp)
      fixS *fixp;
 {
+  reloc_type code;
   struct hppa_fix_struct *hppa_fix;
 
   hppa_fix = (struct hppa_fix_struct *) fixp->tc_fix_data;
@@ -8384,9 +8387,57 @@ hppa_fix_adjustable (fixp)
 #endif
 
 #ifdef OBJ_ELF
-  if (fixp->fx_r_type == (int) R_PARISC_GNU_VTINHERIT
-      || fixp->fx_r_type ==  (int) R_PARISC_GNU_VTENTRY)
-    return 0;
+  /* LR/RR selectors are implicitly used for a number of different relocation
+     types.  We must ensure that none of these types are adjusted (see below)
+     even if they occur with a different selector.  */
+  code = elf_hppa_reloc_final_type (stdoutput, fixp->fx_r_type,
+                                   hppa_fix->fx_r_format,
+                                   hppa_fix->fx_r_field);
+
+  switch (code)
+    {
+    /* Relocation types which use e_lrsel.  */
+    case R_PARISC_DIR21L:
+    case R_PARISC_DLTIND21L:
+    case R_PARISC_DLTREL21L:
+    case R_PARISC_DPREL21L:
+    case R_PARISC_LTOFF_FPTR21L:
+    case R_PARISC_LTOFF_TP21L:
+    case R_PARISC_PCREL21L:
+    case R_PARISC_PLABEL21L:
+    case R_PARISC_PLTOFF21L:
+
+    /* Relocation types which use e_rrsel.  */
+    case R_PARISC_DIR14R:
+    case R_PARISC_DIR14DR:
+    case R_PARISC_DIR14WR:
+    case R_PARISC_DIR17R:
+    case R_PARISC_DLTIND14R:
+    case R_PARISC_DLTIND14DR:
+    case R_PARISC_DLTIND14WR:
+    case R_PARISC_DLTREL14R:
+    case R_PARISC_DLTREL14DR:
+    case R_PARISC_DLTREL14WR:
+    case R_PARISC_DPREL14R:
+    case R_PARISC_DPREL14DR:
+    case R_PARISC_DPREL14WR:
+    case R_PARISC_PCREL14R:
+    case R_PARISC_PCREL17R:
+    case R_PARISC_PLABEL14R:
+    case R_PARISC_LTOFF_FPTR14R:
+    case R_PARISC_LTOFF_FPTR14DR:
+    case R_PARISC_LTOFF_FPTR14WR:
+    case R_PARISC_LTOFF_TP14R:
+    case R_PARISC_LTOFF_TP14DR:
+    case R_PARISC_LTOFF_TP14WR:
+
+    /* Other types that we reject for reduction.  */
+    case R_PARISC_GNU_VTENTRY:
+    case R_PARISC_GNU_VTINHERIT:
+      return 0;
+    default:
+      break;
+    }
 #endif
 
   if (fixp->fx_addsy && (S_IS_EXTERNAL (fixp->fx_addsy)
index df5f10881cd9321361b70c6204eced31ebe75980..fbc78659194dc66c17a8127239ba0ab7a2677b51 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-18  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * gas/hppa/reloc/reloc.exp (labelopbug.s): Change test to suit
+       hppa_fix_adjustable change.
+
 2002-02-09  Richard Henderson  <rth@redhat.com>
 
        * gas/alpha/elf-reloc-5.s, gas/alpha/elf-reloc-5.d: New.
index 889e318c7d4bf73a156b527e35bd54155beb8a39..3ebfe4f9320d0825a5dfc1281965e077d6bc798e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
+# Copyright 1993, 1996, 1997, 2002 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -296,18 +296,37 @@ proc do_local_label_as_operand_test {} {
     if [gas_test_old "labelopbug.s" "" "Local label as operand (part 1)"] {
        objdump_start_no_subdir "a.out" "-r"
 
-       # Check to make sure we handle difference of local lables as an operand
-       # to a non-branching instruction correctly.
-       while 1 {
-           expect {
-               -re "^0+2c\[^\n\]*0x0+24\[^\n\]*\n" 
-                   { set x [expr $x+1] }
-               -re "^0+30\[^\n\]*0x0+24\[^\n\]*\n" 
-                   { set x [expr $x+1] }
-               -re "\[^\n\]*\n"                { }
-               timeout                         { perror "timeout\n"; break }
-               eof                             { break }
-            }
+       # Check to make sure we handle difference of local labels as an operand
+       # to a non-branching instruction correctly.  On hppa elf targets, the
+       # R_PARISC_DIR21 and R_PARISC_DIR14R relocations are done with LR and
+       # RR selectors, respectively.  As a result, we can't reduce these to
+       # section offsets without risking incorrect rounding.  So, we just
+       # check to see if the label hasn't been reduced.
+       if {[istarget hppa*64*-*-*]
+           || [istarget hppa*-*-*elf*] || [istarget hppa*-*-linux*]} then {
+           while 1 {
+               expect {
+                   -re "^0+2c\[^\n\]*L.0002\[^\n\]*\n" 
+                       { set x [expr $x+1] }
+                   -re "^0+30\[^\n\]*L.0002\[^\n\]*\n" 
+                       { set x [expr $x+1] }
+                   -re "\[^\n\]*\n"            { }
+                   timeout                     { perror "timeout\n"; break }
+                   eof                         { break }
+               }
+           }
+       } else {
+           while 1 {
+               expect {
+                   -re "^0+2c\[^\n\]*0x0+24\[^\n\]*\n" 
+                       { set x [expr $x+1] }
+                   -re "^0+30\[^\n\]*0x0+24\[^\n\]*\n" 
+                       { set x [expr $x+1] }
+                   -re "\[^\n\]*\n"            { }
+                   timeout                     { perror "timeout\n"; break }
+                   eof                         { break }
+               }
+           }
        }
 
        # This was intended to do any cleanup necessary.  It kinda looks like it
index b35e3d36a7f612265f4afce54b6400c1105e1a4f..8b1c596bc7caa6bb0ce6321862cf2a0868b738e7 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-18  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * ld-selective/selective.exp: Link against libgcc on
+       hppa*-*-linux* targets.
+
 2002-02-17  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * ld-mmix/b-nosym.d, ld-mmix/sec-6.d: Tweak for change in symbol
index bdea212c8be140d14023b8c9876d0f3738cb3d79..e9cf48f0533329db9f43219fcd2ea761b73fb2f0 100644 (file)
@@ -5,12 +5,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -107,12 +107,18 @@ foreach testitem $seltests {
     if [istarget v850*-*-elf] {
        set objfile "$objfile -L ../gcc -lgcc"
     }
-    
+
     # ARM targets need libgcc.a in THUMB mode so that __call_via_r3 is provided
     if {[istarget arm-*-*] || [istarget xscale-*-*]} {
        set objfile "$objfile -L ../gcc -lgcc"
     }
-    
+
+    # HPPA linux targets need libgcc.a for millicode routines ($$dyncall).
+    if [istarget hppa*-*-linux*] {
+       catch "exec $CC -print-libgcc-file-name" libgcc
+       set objfile "$objfile $libgcc"
+    }
+
     # m6811/m6812 code has references to soft registers.
     if {[istarget m6811-*-*] || [istarget m6812-*-*]} {
        set objfile "$objfile --defsym _.frame=0 --defsym _.d1=0"
@@ -136,7 +142,7 @@ foreach testitem $seltests {
        }
     }
 
-    # Check each mandated symbol and optionally mandated values. 
+    # Check each mandated symbol and optionally mandated values.
     foreach mustsym $mustsyms {
        if { [llength [concat $mustsym]] == 1 } {
            if { ![info exists nm_output($mustsym)] } {