public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson.chu@sifive.com>
To: Jim Wilson <jimw@sifive.com>
Cc: Kuan-Lin Chen <kuanlinchentw@gmail.com>,
	Palmer Dabbelt <palmerdabbelt@google.com>,
		"binutils@sourceware.org Development" <binutils@sourceware.org>
Subject: Re: [PATCH] [RISCV] Support subtraction of .uleb128.
Date: Wed, 18 Dec 2019 01:50:00 -0000	[thread overview]
Message-ID: <CAJYME4HkAD92NwayWGRzO9XOgmkO=9Yep+LuhnYoA-=9RODDFA@mail.gmail.com> (raw)
In-Reply-To: <CAFyWVaZMWXtGB9vx-OM6f-P5hy_OpKTTHJ+b4V6iUu8p5MOD-w@mail.gmail.com>

There is one minor thing.  Maciej has pointed out before that it's
better done with one the percent-codes to `_bfd_error_handler' rather
than aborting the link right away, so that any further link errors are
also reported and you don't have to shake them out one by one.  So
report the relocation error via linker's callback function seems to be
better.  I think maybe we can report a dangerous relocation for the
mismatched R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128.  What I meant
is that,

+ case R_RISCV_SET_ULEB128:
...
+  else
+    {
+      if (uleb128_rel->r_offset != rel->r_offset)
+ {
-  (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "),
- input_bfd, howto->name);
-  bfd_set_error (bfd_error_bad_value);
+ msg = ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched. ");
+ r = bfd_reloc_dangerous;
+ break;
+ }
+      relocation = relocation - uleb128_vma;
+      uleb128_rel = NULL;
+      break;
+    }
+
+ case R_RISCV_SUB_ULEB128:
+  if (uleb128_rel)
+    {
+      if (uleb128_rel->r_offset != rel->r_offset)
+ {
-  (*_bfd_error_handler) (_("%pB: relocation %s mismatched. "),
- input_bfd, howto->name);
-  bfd_set_error (bfd_error_bad_value);
+ msg = ("R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128 are mismatched. ");
+ r = bfd_reloc_dangerous;
+ break;
+ }
+      relocation = uleb128_vma - relocation;
+      uleb128_rel = NULL;
+      break;
+    }

Thanks and regards
Nelson

  reply	other threads:[~2019-12-18  1:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27  8:12 Kuan-Lin Chen
2019-11-27 10:36 ` Andreas Schwab
2019-12-02  1:18   ` Kuan-Lin Chen
2019-12-02 22:27 ` Jim Wilson
2019-12-06 23:48 ` Palmer Dabbelt via binutils
2019-12-10  5:43   ` Kuan-Lin Chen
2019-12-17 23:59     ` Jim Wilson
2019-12-18  1:50       ` Nelson Chu [this message]
2020-01-06  8:18         ` Kuan-Lin Chen
2020-01-06  8:37           ` Kito Cheng
2020-01-06  8:44           ` Kuan-Lin Chen
2020-01-09 23:20   ` Palmer Dabbelt via binutils
2020-01-22  7:26     ` Kuan-Lin Chen
2020-09-25  7:14       ` Kito Cheng
2020-09-25 15:55         ` Jozef Lawrynowicz
2020-09-01 12:56 Jozef Lawrynowicz
2020-09-02  1:29 ` Kuan-Lin Chen

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='CAJYME4HkAD92NwayWGRzO9XOgmkO=9Yep+LuhnYoA-=9RODDFA@mail.gmail.com' \
    --to=nelson.chu@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=jimw@sifive.com \
    --cc=kuanlinchentw@gmail.com \
    --cc=palmerdabbelt@google.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).