From: Alan Modra Date: Sun, 17 Feb 2002 23:12:11 +0000 (+0000) Subject: John David Anglin's 2002-02-12 mainline changes X-Git-Tag: binutils-2_12~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=411540e407695ef5b5401ab436eca37ec47e2861;p=thirdparty%2Fbinutils-gdb.git John David Anglin's 2002-02-12 mainline changes --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 633303aceef..6a84177b5ed 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2002-02-18 John David Anglin + + * 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 * mmo.c: Correct and improve comments. diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index cca760dad34..a98c2b0a973 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -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; } diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 41ec0ce60bd..ce3a9b85c8a 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -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 diff --git a/bfd/elf32-hppa.h b/bfd/elf32-hppa.h index eda452b4b3f..ea680c305df 100644 --- a/bfd/elf32-hppa.h +++ b/bfd/elf32-hppa.h @@ -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 *)); diff --git a/bfd/elf64-hppa.h b/bfd/elf64-hppa.h index b5dc5d4b783..7bb5a26dee5 100644 --- a/bfd/elf64-hppa.h +++ b/bfd/elf64-hppa.h @@ -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 *)); diff --git a/gas/ChangeLog b/gas/ChangeLog index 1481f438488..b1ba5b64bf2 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2002-02-18 John David Anglin + + * config/tc-hppa.c (hppa_fix_adjustable): Don't adjust final types + that implicitly use LR and RR selectors. + 2002-02-16 Nick Clifton * doc/as.texinfo (Machine Dependencies): Fix typo: MMIX used diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 3ec1bf34b7a..e9eb8e1b0f9 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -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) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index df5f10881cd..fbc78659194 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-02-18 John David Anglin + + * gas/hppa/reloc/reloc.exp (labelopbug.s): Change test to suit + hppa_fix_adjustable change. + 2002-02-09 Richard Henderson * gas/alpha/elf-reloc-5.s, gas/alpha/elf-reloc-5.d: New. diff --git a/gas/testsuite/gas/hppa/reloc/reloc.exp b/gas/testsuite/gas/hppa/reloc/reloc.exp index 889e318c7d4..3ebfe4f9320 100644 --- a/gas/testsuite/gas/hppa/reloc/reloc.exp +++ b/gas/testsuite/gas/hppa/reloc/reloc.exp @@ -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 diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index b35e3d36a7f..8b1c596bc7c 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-02-18 John David Anglin + + * ld-selective/selective.exp: Link against libgcc on + hppa*-*-linux* targets. + 2002-02-17 Hans-Peter Nilsson * ld-mmix/b-nosym.d, ld-mmix/sec-6.d: Tweak for change in symbol diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp index bdea212c8be..e9cf48f0533 100644 --- a/ld/testsuite/ld-selective/selective.exp +++ b/ld/testsuite/ld-selective/selective.exp @@ -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)] } {