This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[committed] Add support for PCREL32 and PCREL64 relocations on PA
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: binutils at sources dot redhat dot com
- Date: Fri, 19 Mar 2004 14:32:03 -0500 (EST)
- Subject: [committed] Add support for PCREL32 and PCREL64 relocations on PA
This change has been batting around for awhile. I rewrote the casesi
support in gcc a few months ago and using PCREL32 and PCREL64 relocations
was one of the options that I looked at for implementing the tables
needed for table jumps. This patch adds support for these relocations.
Tested on hppa-linux, hppa2.0w-hpux11.11 and hppa64-hp-hpux11.11.
Committed to main.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2004-03-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* elf-hppa.h (elf_hppa_reloc_final_type): Handle selectors for
R_PARISC_PCREL32 and R_PARISC_PCREL64 relocations.
* tc-hppa.c (cons_fix_new_hppa): Check for PC relative base type.
(pa_comm): Set BSF_OBJECT in symbol flags.
Index: bfd/elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.68
diff -u -3 -p -r1.68 elf-hppa.h
--- bfd/elf-hppa.h 15 Mar 2004 17:53:45 -0000 1.68
+++ bfd/elf-hppa.h 19 Mar 2004 18:55:52 -0000
@@ -812,6 +812,28 @@ elf_hppa_reloc_final_type (bfd *abfd,
}
break;
+ case 32:
+ switch (field)
+ {
+ case e_fsel:
+ final_type = R_PARISC_PCREL32;
+ break;
+ default:
+ return R_PARISC_NONE;
+ }
+ break;
+
+ case 64:
+ switch (field)
+ {
+ case e_fsel:
+ final_type = R_PARISC_PCREL64;
+ break;
+ default:
+ return R_PARISC_NONE;
+ }
+ break;
+
default:
return R_PARISC_NONE;
}
Index: gas/config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.109
diff -u -3 -p -r1.109 tc-hppa.c
--- gas/config/tc-hppa.c 22 Nov 2003 02:35:30 -0000 1.109
+++ gas/config/tc-hppa.c 19 Mar 2004 18:55:55 -0000
@@ -1399,6 +1399,8 @@ cons_fix_new_hppa (frag, where, size, ex
/* Get a base relocation type. */
if (is_DP_relative (*exp))
rel_type = R_HPPA_GOTOFF;
+ else if (is_PC_relative (*exp))
+ rel_type = R_HPPA_PCREL_CALL;
else if (is_complex (*exp))
rel_type = R_HPPA_COMPLEX;
else
@@ -6386,6 +6388,7 @@ pa_comm (unused)
if (symbol)
{
+ symbol_get_bfdsym (symbol)->flags |= BSF_OBJECT;
S_SET_VALUE (symbol, size);
S_SET_SEGMENT (symbol, bfd_und_section_ptr);
S_SET_EXTERNAL (symbol);