From: Stafford Horne <shorne@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v2 0/5] OpenRISC binutils updates and new relocs
Date: Thu, 4 Oct 2018 11:58:46 +0900 [thread overview]
Message-ID: <20181004025846.GD32353@lianli.shorne-pla.net> (raw)
In-Reply-To: <70baf6b8-d26c-f518-78e5-48a6ad47ce54@redhat.com>
On Tue, Oct 02, 2018 at 04:38:39PM +0100, Nick Clifton wrote:
> Hi Stafford,
>
> I just applied your v2 patch series and found one new regression:
>
> Checking Binutils in: or1k-elf ... LD: 1 done
> LD REGRESSION: ld-scripts/pr22267
>
> Would you mind taking a quick look please ?
Hello,
This is just a note for Richard. Please let me know if my fix has any problems.
This issue was with the new overflow added which was thinking that OpenRISC was
a 64-bit system. I replaced it with the generic stuff which uses the bit width
of the target system not host system (i.e. bfd_vma) for overflow calculations.
Change below...
-Stafford
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 3e5759d63f..a2b0ff147f 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -1067,7 +1067,6 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
{
bfd_reloc_status_type status = bfd_reloc_ok;
int size = bfd_get_reloc_size (howto);
- unsigned bitsize, bits;
bfd_vma x, place;
/* Sanity check the address. */
@@ -1118,38 +1117,11 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
break;
}
- bitsize = howto->bitsize;
- bits = bitsize + howto->rightshift;
- switch (howto->complain_on_overflow)
- {
- case complain_overflow_dont:
- break;
- case complain_overflow_signed:
- if (bits < sizeof (bfd_vma) * 8)
- {
- bfd_signed_vma lim = (bfd_vma)1 << bits;
- bfd_signed_vma svalue = value;
-
- if (svalue < -lim || svalue >= lim)
- status = bfd_reloc_overflow;
- }
- break;
- case complain_overflow_unsigned:
- if (bits < sizeof (bfd_vma) * 8)
- {
- bfd_vma lim = (bfd_vma)1 << bits;
- if (value >= lim)
- status = bfd_reloc_overflow;
- }
- break;
- case complain_overflow_bitfield:
- default:
- _bfd_error_handler
- (_("%pB: Unimplemented complain on overflow in howto structure: %d"),
- input_bfd, (int) howto->complain_on_overflow);
- abort ();
- }
-
+ status = bfd_check_overflow (howto->complain_on_overflow,
+ howto->bitsize,
+ howto->rightshift,
+ bfd_arch_bits_per_address (input_bfd),
+ value);
value >>= howto->rightshift;
/* If we're overwriting the entire destination,
@@ -1206,7 +1178,6 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
input_bfd, size);
abort ();
}
-
return status;
}
--
2.17.1
next prev parent reply other threads:[~2018-10-04 2:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 7:09 [OpenRISC] [PATCH v2 0/5] OpenRISC binutils updates and new relocs Stafford Horne
2018-10-01 7:09 ` [OpenRISC] [PATCH v2 1/5] or1k: Add relocations for high-signed and low-stores Stafford Horne
2018-10-01 7:09 ` [OpenRISC] [PATCH v2 2/5] or1k: Fix messages for relocations in shared libraries Stafford Horne
2018-10-01 7:09 ` [OpenRISC] [PATCH v2 3/5] or1k: Add the l.adrp insn and supporting relocations Stafford Horne
2018-10-01 7:10 ` [OpenRISC] [PATCH v2 4/5] or1k: Add the l.muld, l.muldu, l.macu, l.msbu insns Stafford Horne
2018-10-01 7:10 ` [OpenRISC] [PATCH v2 5/5] or1k: Add OpenRISC gas documentation Stafford Horne
2018-10-02 15:38 ` [OpenRISC] [PATCH v2 0/5] OpenRISC binutils updates and new relocs Nick Clifton
2018-10-02 23:09 ` Stafford Horne
2018-10-04 2:58 ` Stafford Horne [this message]
2018-10-04 12:55 ` Richard Henderson
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=20181004025846.GD32353@lianli.shorne-pla.net \
--to=shorne@gmail.com \
--cc=openrisc@lists.librecores.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