Linux PARISC architecture development
 help / color / mirror / Atom feed
From: David Huggins-Daines <dhd@linuxcare.com>
To: law@cygnus.com
Cc: Alan Modra <amodra@linuxcare.com.au>, parisc-linux@thepuffingroup.com
Subject: GAS fix for reloc problems (was Re: [parisc-linux] Non-bootable kernel problems)
Date: 14 Jul 2000 18:14:15 -0400	[thread overview]
Message-ID: <87zonkxsug.fsf_-_@linuxcare.com> (raw)
In-Reply-To: David Huggins-Daines's message of "14 Jul 2000 16:40:36 -0400"

David Huggins-Daines <dhd@linuxcare.com> writes:

> David Huggins-Daines <dhd@linuxcare.com> writes:
> 
> > Jeffrey A Law <law@cygnus.com> writes:
> > 
> > > Either we need to avoid merging the section symbols to avoid twiddling
> > > the addend, or we need to avoid reducing relocs to section symbols to
> > > begin with.
> Okay, I'll investigate this approach.

Done.  PA-RISC porters, update your binutils-2.10 and GCC. (again :-)

Here's the patch, which I've committed to puffin CVS (I've
reverted the incorrect GCC changes):

2000-07-14  David Huggins-Daines  <dhd@linuxcare.com>

	* config/tc-hppa.c (hppa_fix_adjustable): Reject reductions of
	sym-sym2 expressions as well as LR% and RR% fields on ELF targets
	as well.

Index: tc-hppa.c
===================================================================
RCS file: /home/cvs/parisc/binutils-2.10/gas/config/tc-hppa.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- tc-hppa.c	2000/07/11 14:02:15	1.12
+++ tc-hppa.c	2000/07/14 21:48:42	1.13
@@ -8369,10 +8369,25 @@
   /* Reject reductions of symbols in 32bit relocs.  */
   if (fixp->fx_r_type == R_HPPA && hppa_fix->fx_r_format == 32)
     return 0;
+#endif
 
   /* Reject reductions of symbols in sym1-sym2 expressions when
      the fixup will occur in a CODE subspace.
 
+     NOTE: We want to reject these for ELF targets as well, because
+     otherwise we will lose in the case of 21L and 14R
+     relocations.  (FIXME: will this break ELF64 targets?)
+
+     This is because, since the symbols are reduced, the linker has no
+     choice but to manipulate the addends when coalescing input .data
+     sections.  Because the 32-bit ABI requires the compiler to
+     pre-round LR% field selectors, this means we end up with
+     different addends for the left and right relocations.  Because of
+     the way LR% and RR% field selectors work, it's possible that the
+     RR% field will turn negative without the LR% field being rounded
+     accordingly, and your Linux kernel crashes mysteriously.
+     - dhd@linuxcare.com, 2000-07-14
+
      XXX FIXME: Long term we probably want to reject all of these;
      for example reducing in the debug section would lose if we ever
      supported using the optimizing hp linker.  */
@@ -8386,12 +8401,14 @@
     }
 
   /* We can't adjust any relocs that use LR% and RR% field selectors.
-     That confuses the HP linker.  */
+     That confuses the HP linker.
+
+     FIXME: do we actually need to do this for ELF32/GNU ld as well?
+     What about ELF64? */
   if (hppa_fix->fx_r_field == e_lrsel
       || hppa_fix->fx_r_field == e_rrsel
       || hppa_fix->fx_r_field == e_nlrsel)
     return 0;
-#endif
 
   /* Reject reductions of symbols in DLT relative relocs,
      relocations with plabels.  */

-- 
dhd@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.

  reply	other threads:[~2000-07-14 22:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-12 23:35 [parisc-linux] Non-bootable kernel problems Richard Hirst
2000-07-13 17:14 ` Paul Bame
2000-07-13 18:46   ` David Huggins-Daines
2000-07-13 21:14     ` David Huggins-Daines
2000-07-13 19:20       ` Jeffrey A Law
2000-07-14 16:10         ` David Huggins-Daines
2000-07-14 16:39           ` Jeffrey A Law
2000-07-14 18:53             ` David Huggins-Daines
2000-07-14 20:40               ` David Huggins-Daines
2000-07-14 22:14                 ` David Huggins-Daines [this message]
2000-07-15  8:33                   ` GAS fix for reloc problems (was Re: [parisc-linux] Non-bootable kernel problems) Alan Modra
2000-07-15  1:31               ` [parisc-linux] Non-bootable kernel problems Alan Modra
2000-07-13 23:45       ` David Huggins-Daines
2000-07-14  0:44         ` Alan Modra
2000-07-14 16:02           ` Jeffrey A Law
2000-07-14 16:02             ` David Huggins-Daines
2000-07-14 16:37               ` Jeffrey A Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zonkxsug.fsf_-_@linuxcare.com \
    --to=dhd@linuxcare.com \
    --cc=amodra@linuxcare.com.au \
    --cc=law@cygnus.com \
    --cc=parisc-linux@thepuffingroup.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox