This is the mail archive of the 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]

Re: Various SH fixes; make R_SH_REL32 partial_inplace etc.


I've tried to bootstrap current GCC (3.1 CVS) using binutils in
CVS and your patch in
and found a new problem of SH assembler for a merge section.
A testcase is the following foo.s:

.section .rodata.str.1, "aMS", @progbits, 1
        .string "string0"
        .align 2
.section .rodata.str.1, "aMS", @progbits, 1
        .string "string1"
        .align 2
        .align 2
        .long   LC0
        .long   LC1

The binary got by as -o foo.o foo.s and ld -o foo foo.o has a wrong
reference which should be LC1.  objdump -s shows

Contents of section .text:
 400074 0040007c 0040008c

but nm reports

0040007c r LC0
00400084 r LC1

and it seems the problem is inplace value of the reloc for L1 in
foo.o generated by as.
The appended patch adjusts inplace relocation against a symbol in
a merge section, like as for weak symbols. With this patch, gcc-3.1
can bootstrap for sh-unknown-linux-gnu.

BTW, make check for g++ (3.1 CVS) reports 15 failures and 2 XPASSs.
All failures except for g++.jason/thunk3.C and g++.other/enum5.C
are for g++.dg/opt/vtgc1.C. XPASS cases are and


2001-09-23  kaz Kojima  <>

	* config/tc-sh.c (md_apply_fix): Adjust back VAL for a symbol in
	a merge section.

Index: tc-sh.c
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.41
diff -u -r1.41 tc-sh.c
--- tc-sh.c	2001/09/15 14:49:54	1.41
+++ tc-sh.c	2001/09/23 00:08:57
@@ -2826,6 +2826,14 @@
       && fixP->fx_addsy != NULL
       && S_IS_WEAK (fixP->fx_addsy))
     val -= S_GET_VALUE  (fixP->fx_addsy);
+  /* Similar adjustment as above is needed for a reloc against a symbol
+     in a merge section. */
+  else if (fixP->fx_addsy != NULL)
+    {
+      asection *symsec = S_GET_SEGMENT (fixP->fx_addsy);
+      if (symsec != NULL && (symsec->flags & SEC_MERGE))
+	val -= S_GET_VALUE  (fixP->fx_addsy);
+    }

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