This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Re: dubious use of O_subtract in gas/config/tc-ia64.c


>>> James E Wilson <wilson@specifixinc.com> 11.02.05 04:49:53 >>>
>On Tue, 2005-02-01 at 06:46, Jan Beulich wrote:
>I see in your example that you are subtracting two symbols in
different
>sections, which isn't something that we can easily compute.

Not really: These (on other targets) translate to pc-relative
relocations, and so would I have expected them on IA64. Still, some
checking on the operands of the O_subtract perhaps wouldn't hurt. And
some changes would perhaps still be needed if one wanted to support the
SUB relocation type...

Note, however, that this patch makes more sense under the assumption
that the
previously submitted, but not yet approved patch to deal with
relocation type
support is present, since only that makes the call to
ia64_gen_real_reloc_type
issue diagnostics for bad relocation requests.

Built and tested on ia64-unknown-linux-gnu.

Jan

gas/
2005-02-14  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (md_apply_fix3): Call
ia64_gen_real_reloc_type
	instead of explicitly dealing with the translation; exclude
	relocations that are already pcrel, however.

gas/testsuite/
2005-02-14  Jan Beulich  <jbeulich@novell.com>

	* gas/ia64/pcrel.[ds]: New.
	* gas/ia64/ia64.exp: Run new test.

---
/home/jbeulich/src/binutils/mainline/2005-02-14/gas/config/tc-ia64.c	2005-02-14
08:56:13.000000000 +0100
@@ -11029,27 +11033,24 @@ md_apply_fix3 (fix, valP, seg)
 
   if (fix->fx_pcrel)
     {
-      switch (fix->fx_r_type)
-	{
-	case BFD_RELOC_IA64_DIR32MSB:
-	  fix->fx_r_type = BFD_RELOC_IA64_PCREL32MSB;
-	  break;
-
-	case BFD_RELOC_IA64_DIR32LSB:
-	  fix->fx_r_type = BFD_RELOC_IA64_PCREL32LSB;
-	  break;
-
-	case BFD_RELOC_IA64_DIR64MSB:
-	  fix->fx_r_type = BFD_RELOC_IA64_PCREL64MSB;
-	  break;
-
-	case BFD_RELOC_IA64_DIR64LSB:
-	  fix->fx_r_type = BFD_RELOC_IA64_PCREL64LSB;
-	  break;
-
-	default:
-	  break;
-	}
+    switch (fix->fx_r_type)
+      {
+      case BFD_RELOC_IA64_PCREL21B: break;
+      case BFD_RELOC_IA64_PCREL21BI: break;
+      case BFD_RELOC_IA64_PCREL21F: break;
+      case BFD_RELOC_IA64_PCREL21M: break;
+      case BFD_RELOC_IA64_PCREL60B: break;
+      case BFD_RELOC_IA64_PCREL22: break;
+      case BFD_RELOC_IA64_PCREL64I: break;
+      case BFD_RELOC_IA64_PCREL32MSB: break;
+      case BFD_RELOC_IA64_PCREL32LSB: break;
+      case BFD_RELOC_IA64_PCREL64MSB: break;
+      case BFD_RELOC_IA64_PCREL64LSB: break;
+      default:
+	fix->fx_r_type = ia64_gen_real_reloc_type
(pseudo_func[FUNC_PC_RELATIVE].u.sym,
+					       fix->fx_r_type);
+	break;
+      }
     }
   if (fix->fx_addsy)
     {
---
/home/jbeulich/src/binutils/mainline/2005-02-14/gas/testsuite/gas/ia64/ia64.exp	2005-02-14
08:43:38.000000000 +0100
+++ 2005-02-14/gas/testsuite/gas/ia64/ia64.exp	2005-02-14
15:40:52.465091810 +0100
@@ -49,6 +49,8 @@ if [istarget "ia64-*"] then {
 
     run_dump_test "dependency-1"
 
+    run_dump_test "pcrel"
+
     run_dump_test "real"
     run_dump_test "align"
     run_dump_test "order"
---
/home/jbeulich/src/binutils/mainline/2005-02-14/gas/testsuite/gas/ia64/operand-or.d	2005-02-13
20:25:26.000000000 +0100
+++ 2005-02-14/gas/testsuite/gas/ia64/operand-or.d	2005-02-14
10:11:32.000000000 +0100
@@ -1,3 +1,4 @@
+# as: -xnone
 # objdump: -d --disassemble-zeroes
 # name: ia64 operand-or
 
---
/home/jbeulich/src/binutils/mainline/2005-02-14/gas/testsuite/gas/ia64/pcrel.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-14/gas/testsuite/gas/ia64/pcrel.d	2005-02-14
15:19:39.000000000 +0100
@@ -0,0 +1,62 @@
+#objdump: -rs
+#name: ia64 pcrel
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[\.mov\]:
+OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]*
+0+10[[:space:]]+PCREL22[[:space:]]+esym
+0+20[[:space:]]+PCREL22[[:space:]]+esym\+0x0+20
+0+30[[:space:]]+PCREL22[[:space:]]+esym
+0+40[[:space:]]+PCREL22[[:space:]]+esym\+0xf+e0
+
+RELOCATION RECORDS FOR \[\.movl\]:
+OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]*
+0+12[[:space:]]+PCREL64I[[:space:]]+esym
+0+22[[:space:]]+PCREL64I[[:space:]]+esym\+0x0+20
+0+32[[:space:]]+PCREL64I[[:space:]]+esym
+0+42[[:space:]]+PCREL64I[[:space:]]+esym\+0xf+e0
+
+RELOCATION RECORDS FOR \[\.data8\]:
+OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]*
+0+10[[:space:]]+PCREL64[LM]SB[[:space:]]+esym
+0+20[[:space:]]+PCREL64[LM]SB[[:space:]]+esym\+0x0+20
+0+30[[:space:]]+PCREL64[LM]SB[[:space:]]+esym
+0+40[[:space:]]+PCREL64[LM]SB[[:space:]]+esym\+0xf+e0
+
+RELOCATION RECORDS FOR \[\.data4\]:
+OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]*
+0+10[[:space:]]+PCREL32[LM]SB[[:space:]]+esym
+0+20[[:space:]]+PCREL32[LM]SB[[:space:]]+esym\+0x0+20
+0+30[[:space:]]+PCREL32[LM]SB[[:space:]]+esym
+0+40[[:space:]]+PCREL32[LM]SB[[:space:]]+esym\+0xf+e0
+
+
+Contents of section \.mov:
+ 0+00 1d108001 00240000 00020000 00000020  .*
+ 0+10 1d100000 00240000 00020000 00000020  .*
+ 0+20 1d100000 00240000 00020000 00000020  .*
+ 0+30 1d100000 00240000 00020000 00000020  .*
+ 0+40 1d100000 00240000 00020000 00000020  .*
+ 0+50 1d100000 00240000 00020000 00000020  .*
+Contents of section \.movl:
+ 0+00 05000000 01000000 00000040 00060060  .*
+ 0+10 05000000 01000000 00000040 00000060  .*
+ 0+20 05000000 01000000 00000040 00000060  .*
+ 0+30 05000000 01000000 00000040 00000060  .*
+ 0+40 05000000 01000000 00000040 00000060  .*
+ 0+50 05000000 01000000 00000040 00000060  .*
+Contents of section \.data8:
+ 0+00 60000000 00000000 00000000 00000000  .*
+ 0+10 00000000 00000000 00000000 00000000  .*
+ 0+20 00000000 00000000 00000000 00000000  .*
+ 0+30 00000000 00000000 00000000 00000000  .*
+ 0+40 00000000 00000000 00000000 00000000  .*
+ 0+50 00000000 00000000 00000000 00000000  .*
+Contents of section \.data4:
+ 0+00 60000000 00000000 00000000 00000000  .*
+ 0+10 00000000 00000000 00000000 00000000  .*
+ 0+20 00000000 00000000 00000000 00000000  .*
+ 0+30 00000000 00000000 00000000 00000000  .*
+ 0+40 00000000 00000000 00000000 00000000  .*
+ 0+50 00000000 00000000 00000000 00000000  .*
---
/home/jbeulich/src/binutils/mainline/2005-02-14/gas/testsuite/gas/ia64/pcrel.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-14/gas/testsuite/gas/ia64/pcrel.s	2005-02-14
15:09:17.000000000 +0100
@@ -0,0 +1,87 @@
+.explicit
+.global esym
+
+.altmacro
+
+.macro begin n, attr
+ .section .&n, attr, @progbits
+ .align 16
+_&n:
+.endm
+.macro end n
+ .align 16
+_e&n:
+.endm
+
+.macro m1 op, opnd1
+ .align 16
+	op		opnd1 _e&op - _&op
+.endm
+.macro m2 op, opnd1
+ .align 16
+	op		opnd1 @pcrel(esym)
+.endm
+.macro m3 op, opnd1
+ .align 16
+	op		opnd1 esym - _&op
+.endm
+.macro m4 op, opnd1
+ .align 16
+	op		opnd1 esym - .
+.endm
+.macro m5 op, opnd1
+ .align 16
+	op		opnd1 esym - _e&op
+.endm
+.macro m6 op, opnd1
+ .align 16
+	op		opnd1 0
+.endm
+
+begin	mov, "ax"
+	m1	mov, r2 =
+	;;
+	m2	mov, r2 =
+	;;
+	m3	mov, r2 =
+	;;
+	m4	mov, r2 =
+	;;
+	m5	mov, r2 =
+	;;
+	m6	mov, r2 =
+	;;
+end mov
+
+begin	movl, "ax"
+	m1	movl, r2 =
+	;;
+	m2	movl, r2 =
+	;;
+	m3	movl, r2 =
+	;;
+	m4	movl, r2 =
+	;;
+	m5	movl, r2 =
+	;;
+	m6	movl, r2 =
+	;;
+end movl
+
+begin data8, "a"
+	m1	data8
+	m2	data8
+	m3	data8
+	m4	data8
+	m5	data8
+	m6	data8
+end data8
+
+begin data4, "a"
+	m1	data4
+	m2	data4
+	m3	data4
+	m4	data4
+	m5	data4
+	m6	data4
+end data4

Attachment: binutils-mainline-ia64-pcrel.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]