public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: pdp11 reloc processing
Date: Fri, 21 Feb 2020 00:16:00 -0000	[thread overview]
Message-ID: <20200221001545.GZ5570@bubble.grove.modra.org> (raw)

This allows pdp11 to handle 32-bit fixups that can be applied by gas,
and improves the error message emitted when the required reloc isn't
available.

	* config/tc-pdp11.c (md_apply_fix): Handle BFD_RELOC_32.
	(tc_gen_reloc): Only give a BAD_CASE assertion on pcrel relocs.

diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index 7b3f663d12..d38a3cd6d2 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -257,6 +257,10 @@ md_apply_fix (fixS *fixP,
       mask = 0xffff;
       shift = 0;
       break;
+    case BFD_RELOC_32:
+      mask = 0xffffffff;
+      shift = 0;
+      break;
     case BFD_RELOC_PDP11_DISP_8_PCREL:
       mask = 0x00ff;
       shift = 1;
@@ -1419,22 +1423,22 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
   /* This is taken account for in md_apply_fix().  */
   reloc->addend = -symbol_get_bfdsym (fixp->fx_addsy)->section->vma;
 
-  switch (fixp->fx_r_type)
+  code = fixp->fx_r_type;
+  if (fixp->fx_pcrel)
     {
-    case BFD_RELOC_16:
-      if (fixp->fx_pcrel)
-	code = BFD_RELOC_16_PCREL;
-      else
-	code = BFD_RELOC_16;
-      break;
+      switch (code)
+	{
+	case BFD_RELOC_16:
+	  code = BFD_RELOC_16_PCREL;
+	  break;
 
-    case BFD_RELOC_16_PCREL:
-      code = BFD_RELOC_16_PCREL;
-      break;
+	case BFD_RELOC_16_PCREL:
+	  break;
 
-    default:
-      BAD_CASE (fixp->fx_r_type);
-      return NULL;
+	default:
+	  BAD_CASE (code);
+	  return NULL;
+	}
     }
 
   reloc->howto = bfd_reloc_type_lookup (stdoutput, code);

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2020-02-21  0:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200221001545.GZ5570@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).