This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
fix for FRV assembler regression
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 22 Sep 2003 18:30:22 -0300
- Subject: fix for FRV assembler regression
- Organization: GCC Team, Red Hat
A recent change in the FRV assembler introduced a regression in C++,
when a template function, emitted in a .gnu.linkonce section, called a
static function, emitted in .text. The relocation was adjusted, which
caused the linker to compute the wrong address when applying the
relocation. This patch fixes the regression, by reintroducing a
condition that was present before the patch, that wasn't implied by
the new condition. Ok to install? Tested on
athlon-linux-gnu-x-frv-elf.
Index: gas/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/tc-frv.c (md_pcrel_from_section): Don't adjust when
referencing symbol in a different section.
Index: gas/config/tc-frv.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-frv.c,v
retrieving revision 1.8
diff -u -p -r1.8 tc-frv.c
--- gas/config/tc-frv.c 5 Sep 2003 07:18:26 -0000 1.8
+++ gas/config/tc-frv.c 22 Sep 2003 21:17:50 -0000
@@ -1164,11 +1164,18 @@ md_convert_frag (abfd, sec, fragP)
long
md_pcrel_from_section (fixP, sec)
fixS * fixP;
- segT sec ATTRIBUTE_UNUSED;
+ segT sec;
{
- /* Make no adjustment for relocations that will be written out. */
- if (TC_FORCE_RELOCATION (fixP))
- return 0;
+ if (TC_FORCE_RELOCATION (fixP)
+ || (fixP->fx_addsy != (symbolS *) NULL
+ && S_GET_SEGMENT (fixP->fx_addsy) != sec))
+ {
+ /* If we can't adjust this relocation, or if it references a
+ local symbol in a different section (which
+ TC_FORCE_RELOCATION can't check), let the linker figure it
+ out. */
+ return 0;
+ }
return (fixP->fx_frag->fr_address + fixP->fx_where) & ~1;
}
Index: gas/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* gas/frv/reloc1.[sd]: Test references to external symbols and
inter-section references too.
Index: gas/testsuite/gas/frv/reloc1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/frv/reloc1.d,v
retrieving revision 1.1
diff -u -p -r1.1 reloc1.d
--- gas/testsuite/gas/frv/reloc1.d 5 Sep 2003 07:18:27 -0000 1.1
+++ gas/testsuite/gas/frv/reloc1.d 22 Sep 2003 21:17:55 -0000
@@ -1,8 +1,8 @@
-#objdump: -dr
+#objdump: -Dr
.* elf32-frv
-Disassembly.*:
+Disassembly.*\.text:
.* <begin>:
.*: 80 88 00 00 * nop
@@ -18,4 +18,23 @@ Disassembly.*:
.*: R_FRV_LABEL16 f1
.*: fe 3f ff fe * call .* <f2>
.*: c0 1a ff fd * bra .* <f2>
+.*: 80 3c 00 00 * call.*
+ .*: R_FRV_LABEL24 f3
+.*: c0 1a 00 00 * bra.*
+ .*: R_FRV_LABEL16 f3
\.\.\.
+Disassembly.*\.test:
+.* <beginx>:
+.*: 80 88 00 00 * nop
+.*: 80 3c 00 00 * call.*
+ .*: R_FRV_LABEL24 f1
+.*: c0 1a 00 00 * bra.*
+ .*: R_FRV_LABEL16 f1
+.*: 80 3c 00 05 * call .* <f2\+.*>
+ .*: R_FRV_LABEL24 \.text\+0x14
+.*: c0 1a 00 05 * bra .* <f2\+.*>
+ .*: R_FRV_LABEL16 \.text\+0x14
+.*: 80 3c 00 00 * call.*
+ .*: R_FRV_LABEL24 f3
+.*: c0 1a 00 00 * bra.*
+ .*: R_FRV_LABEL16 f3
Index: gas/testsuite/gas/frv/reloc1.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/frv/reloc1.s,v
retrieving revision 1.1
diff -u -p -r1.1 reloc1.s
--- gas/testsuite/gas/frv/reloc1.s 5 Sep 2003 07:18:27 -0000 1.1
+++ gas/testsuite/gas/frv/reloc1.s 22 Sep 2003 21:17:55 -0000
@@ -11,4 +11,17 @@ f2:
bra f1
call f2
bra f2
+
+ call f3
+ bra f3
.space 16
+
+ .section .gnu.linkonce.t.test
+beginx:
+ nop
+ call f1
+ bra f1
+ call f2
+ bra f2
+ call f3
+ bra f3
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer