This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
alpha reloc tweaks
- From: Richard Henderson <rth at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 19 Sep 2002 09:15:47 -0700
- Subject: alpha reloc tweaks
I noticed that branches to external symbols weren't being
minded properly. The whole test passes with Alan's patch
from earlier today.
r~
* config/tc-alpha.c (md_pcrel_from): Only adjust special for
branch type relocs.
(alpha_force_relocation): Don't special-case branch type relocs.
* gas/alpha/elf-reloc-7.s: New.
* gas/alpha/elf-reloc-7.d: New.
* gas/alpha/alpha.exp: Run it.
Index: config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.47
diff -c -p -d -u -r1.47 tc-alpha.c
--- config/tc-alpha.c 5 Sep 2002 00:01:16 -0000 1.47
+++ config/tc-alpha.c 19 Sep 2002 16:10:12 -0000
@@ -1139,12 +1139,12 @@ md_pcrel_from (fixP)
valueT addr = fixP->fx_where + fixP->fx_frag->fr_address;
switch (fixP->fx_r_type)
{
- case BFD_RELOC_ALPHA_GPDISP:
- case BFD_RELOC_ALPHA_GPDISP_HI16:
- case BFD_RELOC_ALPHA_GPDISP_LO16:
- return addr;
+ case BFD_RELOC_23_PCREL_S2:
+ case BFD_RELOC_ALPHA_HINT:
+ case BFD_RELOC_ALPHA_BRSGP:
+ return addr + 4;
default:
- return fixP->fx_size + addr;
+ return addr;
}
}
@@ -1500,10 +1500,6 @@ alpha_force_relocation (f)
case BFD_RELOC_ALPHA_TPREL_LO16:
case BFD_RELOC_ALPHA_TPREL16:
return 1;
-
- case BFD_RELOC_23_PCREL_S2:
- case BFD_RELOC_ALPHA_HINT:
- return 0;
default:
break;
Index: testsuite/gas/alpha/alpha.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/alpha/alpha.exp,v
retrieving revision 1.4
diff -c -p -d -u -r1.4 alpha.exp
--- testsuite/gas/alpha/alpha.exp 30 May 2002 22:01:37 -0000 1.4
+++ testsuite/gas/alpha/alpha.exp 19 Sep 2002 16:10:12 -0000
@@ -29,6 +29,7 @@ if { [istarget alpha*-*-*] } then {
run_dump_test "elf-reloc-4"
run_dump_test "elf-reloc-5"
run_list_test "elf-reloc-6" ""
+ run_dump_test "elf-reloc-7"
run_dump_test "elf-tls-1"
run_list_test "elf-tls-2" ""
run_list_test "elf-tls-3" ""
Index: testsuite/gas/alpha/elf-reloc-7.d
===================================================================
RCS file: testsuite/gas/alpha/elf-reloc-7.d
diff -N testsuite/gas/alpha/elf-reloc-7.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/alpha/elf-reloc-7.d 19 Sep 2002 16:10:12 -0000
@@ -0,0 +1,22 @@
+#objdump: -r
+#name: alpha elf-reloc-7
+
+.*: file format elf64-alpha
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0*0000008 BRADDR bar
+
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET TYPE VALUE
+0*0000004 SREL32 \.data2\+0x0*0000004
+0*0000008 SREL32 BAR
+
+
+RELOCATION RECORDS FOR \[\.text2\]:
+OFFSET TYPE VALUE
+0*0000004 BRADDR \.text\+0x0*0000010
+0*0000008 BRADDR bar
+
+
Index: testsuite/gas/alpha/elf-reloc-7.s
===================================================================
RCS file: testsuite/gas/alpha/elf-reloc-7.s
diff -N testsuite/gas/alpha/elf-reloc-7.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/alpha/elf-reloc-7.s 19 Sep 2002 16:10:12 -0000
@@ -0,0 +1,26 @@
+ .section .data2,"wa"
+ .globl BAR
+ .long 0
+FOO: .long 0
+BAR: .long 0
+ .long FOO - .
+ .long BAR - .
+
+ .data
+ .long 0
+ .long FOO - .
+ .long BAR - .
+
+ .text
+ .globl bar
+ nop
+ br foo
+ br bar
+ nop
+foo: nop
+bar: nop
+
+ .section .text2,"ax"
+ nop
+ br foo
+ br bar