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/RFA] sh-elf: Unnecessary relocations


Hi,

Current gas for sh-elf generates some unnecessary PC relative
relocations when the symbol is global. For example, I've got
two relocations:

RELOCATION RECORDS FOR [.text]:
OFFSET   TYPE              VALUE 
00000000 R_SH_DIR8WPL      foo
00000006 R_SH_IND12W       foo

for the following small source

	.text
	mova	foo,r0
	rts
	nop
        .global foo
foo:
	bra	foo
	nop

and slightly old gas doesn't make such relocations for the same
source. With the following patch, gas shows the same behavior
as the old one. Regression tested on sh-unknown-linux-gnu.

	kaz
--
2002-09-26  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* config/tc-sh.c (sh_force_relocation): Return 0 for
	the PC relative relocations when not relaxing.

--- ORIG/src/gas/config/tc-sh.c	Sun Sep 15 07:09:09 2002
+++ TMP/src/gas/config/tc-sh.c	Thu Sep 26 20:44:09 2002
@@ -3219,6 +3219,9 @@ int
 sh_force_relocation (fix)
      fixS *fix;
 {
+  if (! sh_relax && fix->fx_pcrel)
+    return 0;
+
   if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
       || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY
       || fix->fx_r_type == BFD_RELOC_SH_LOOP_START


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