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]

SH gas: support `.long foo@PLT' again


A patch I installed last week broke `.long symbol@PLT', for assuming
that a PLT fix would always contain a non-NULL subsy, as is the case
for all GCC-generated PLT references.  However, hand-written assembly
code in glibc didn't follow this pattern, and exposed the bug I
introduced.  Here's a fix.  Ok to install?

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-sh.c (md_apply_fix3) <BFD_RELOC_32_PLT_PCREL>: Don't
	assume fixP->fx_subsy is non-NULL.

Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.54
diff -u -p -r1.54 tc-sh.c
--- gas/config/tc-sh.c 2002/02/04 12:29:15 1.54
+++ gas/config/tc-sh.c 2002/02/06 04:12:57
@@ -2975,7 +2975,9 @@ md_apply_fix3 (fixP, valP, seg)
       /* Make the jump instruction point to the address of the operand.  At
 	 runtime we merely add the offset to the actual PLT entry.  */
       * valP = 0xfffffffc;
-      val = fixP->fx_addnumber - S_GET_VALUE (fixP->fx_subsy);
+      val = fixP->fx_addnumber;
+      if (fixP->fx_subsy)
+	val -= S_GET_VALUE (fixP->fx_subsy);
       md_number_to_chars (buf, val, 4);
       break;
 

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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