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]

Committed, gas/tc-cris.h and testsuite: fix PR gas/1049. Whither MD_APPLY_SYM_VALUE?


This fixes PR gas/1049, which is a bug emitting out-of-range
errors for -fpic (< 8k symbols in a DSO) PIC relocs.  See usage
in write.c and comment in the patch: most targets have the same
seemingly-incorrect comment above the same definition.  Given
the amount of targets that override the default, I think the
default should be reversed and all definitions and seemingly
misleading comments removed.  Hacking this by setting
fixP->fx_no_overflow or fx_plt would IMHO be a kludge.

The gas testsuite had one test that needed tweaking for no
longer emitting the (redundant) value; one that a reloc for a
global symbol will overwrite (section-relative relocs are still
emitted in-text too).

gas/testsuite:
	PR gas/1049
	* gas/cris/rd-pic-2.d, gas/cris/rd-pic-2.s: New test.
	* gas/cris/rd-abs32-1.d: Tweak for not emitting reloc-related
	garbage for global symbols.

gas:
	PR gas/1049
	* config/tc-cris.h (MD_APPLY_SYM_VALUE): Define.

--- /dev/null	Tue Oct 29 15:57:07 2002
+++ rd-pic-2.d	Wed Jul  6 06:07:35 2005
@@ -0,0 +1,19 @@
+#objdump: -dr
+#as: --em=criself --pic
+
+# Check that 16-bit PIC relocs aren't overflowing.
+# PR gas/1049.
+
+.*:     file format .*-cris
+
+Disassembly of section \.text:
+0+ <a>:
+       0:	7f9c 0000           	movs\.w 0,r9
+			2: R_CRIS_16_GOT	y
+       4:	7f9c 0000           	movs\.w 0,r9
+			6: R_CRIS_16_GOTPLT	z
+	\.\.\.
+0+10008 <y>:
+   10008:	0f05                	nop 
+0+1000a <z>:
+	\.\.\.
--- /dev/null	Tue Oct 29 15:57:07 2002
+++ rd-pic-2.s	Tue Jul  5 21:02:43 2005
@@ -0,0 +1,11 @@
+; GAS mustn't error on the larger-than-16-bit offsets here.
+
+	.global y
+	.global z
+a:
+	movs.w y:GOT16,$r9
+	movs.w z:GOTPLT16,$r9
+	.space 65536,0
+y:
+	nop
+z:
Index: rd-abs32-1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cris/rd-abs32-1.d,v
retrieving revision 1.1
diff -u -p -r1.1 rd-abs32-1.d
--- rd-abs32-1.d	4 Nov 2004 15:03:06 -0000	1.1
+++ rd-abs32-1.d	8 Jul 2005 03:34:05 -0000
@@ -16,9 +16,9 @@ Disassembly of section \.text:
    2:	0f05                	nop 
    4:	3f0d 0200 0000      	jump 2 <locsym2>
 			6: R_CRIS_32	\.text\+0x2
-   a:	3f0d 0200 0000      	jump 2 <locsym2>
+   a:	3f0d 0000 0000      	jump 0 <locsym2-0x2>
 			c: R_CRIS_32	locsym2
-  10:	3f0d 7400 0000      	jump 74 <locsym3>
+  10:	3f0d 0000 0000      	jump 0 <locsym2-0x2>
 			12: R_CRIS_32	locsym3
   16:	3f0d 7400 0000      	jump 74 <locsym3>
 			18: R_CRIS_32	\.text\+0x74
@@ -26,9 +26,9 @@ Disassembly of section \.text:
 			1e: R_CRIS_32	extsym
   22:	3fbd 0200 0000      	jsr 2 <locsym2>
 			24: R_CRIS_32	\.text\+0x2
-  28:	3fbd 0200 0000      	jsr 2 <locsym2>
+  28:	3fbd 0000 0000      	jsr 0 <locsym2-0x2>
 			2a: R_CRIS_32	locsym2
-  2e:	3fbd 7400 0000      	jsr 74 <locsym3>
+  2e:	3fbd 0000 0000      	jsr 0 <locsym2-0x2>
 			30: R_CRIS_32	locsym3
   34:	3fbd 7400 0000      	jsr 74 <locsym3>
 			36: R_CRIS_32	\.text\+0x74
@@ -38,11 +38,11 @@ Disassembly of section \.text:
 			42: R_CRIS_32	\.text\+0x2
   46:	0000                	bcc \.\+2
   48:	0000                	bcc \.\+2
-  4a:	3f3d 0200 0000      	jsrc 2 <locsym2>
+  4a:	3f3d 0000 0000      	jsrc 0 <locsym2-0x2>
 			4c: R_CRIS_32	locsym2
   50:	0000                	bcc \.\+2
   52:	0000                	bcc \.\+2
-  54:	3f3d 7400 0000      	jsrc 74 <locsym3>
+  54:	3f3d 0000 0000      	jsrc 0 <locsym2-0x2>
 			56: R_CRIS_32	locsym3
   5a:	0000                	bcc \.\+2
   5c:	0000                	bcc \.\+2
Index: tc-cris.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-cris.h,v
retrieving revision 1.14
diff -u -p -r1.14 tc-cris.h
--- tc-cris.h	5 May 2005 09:12:54 -0000	1.14
+++ tc-cris.h	8 Jul 2005 03:28:45 -0000
@@ -114,6 +114,13 @@ extern int md_cris_force_relocation (str
   && (! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type)		\
       || (FIX)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL))
 
+/* FIXME: This *should* be a redundant definition, as the
+   TC_FORCE_RELOCATION* definitions already told about the cases where
+   we *don't* want the symbol value calculated.  Here we seem to answer
+   the "are you sure" question.  It certainly has very little to do with
+   whether the symbol value is passed to md_apply_fix.  */
+#define MD_APPLY_SYM_VALUE(FIX) 0
+
 /* When we have fixups against constant expressions, we get a GAS-specific
    section symbol at no extra charge for obscure reasons in
    adjust_reloc_syms.  Since ELF outputs section symbols, it gladly

brgds, H-P


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