From: Zack Weinberg <zack@codesourcery.com>
To: Nick Clifton <nickc@redhat.com>, binutils@sourceware.org
Subject: Fix some of the ARM GAS failures
Date: Tue, 24 May 2005 21:24:00 -0000 [thread overview]
Message-ID: <1116965825.7031.16.camel@localhost.localdomain> (raw)
This patch should improve the ARM-GAS situation somewhat. md_apply_fix3
needs to truncate the relocation to 32 signed bits manually; if the host
is 64-bit, fx_addnumber and fx_offset are 64-bit, and may generate
spurious overflows. Also, we need a double cast on both sides of the
hack to pass an integer around in tc_fix_data.
zw
* config/tc-arm.c (fix_new_arm): Cast thumb_mode to size_t
before casting it to PTR.
(md_apply_fix3): Truncate value, *valP, fixP->fx_addnumber,
and fixP->fx_offset to 32 signed bits.
===================================================================
Index: config/tc-arm.c
--- config/tc-arm.c 18 May 2005 05:40:07 -0000 1.204
+++ config/tc-arm.c 24 May 2005 20:08:45 -0000
@@ -7296,8 +7296,9 @@ fix_new_arm (fragS * frag,
}
/* Mark whether the fix is to a THUMB instruction, or an ARM
- instruction. */
- new_fix->tc_fix_data = (PTR) thumb_mode;
+ instruction. The double cast prevents warnings about
+ creating a pointer from an integer of different size. */
+ new_fix->tc_fix_data = (PTR) (size_t) thumb_mode;
}
static void
@@ -10098,9 +10099,21 @@ md_apply_fix3 (fixS * fixP,
value += md_pcrel_from (fixP);
}
- /* Remember value for emit_reloc. */
+ /* On a 64-bit host, silently truncate 'value' to 32 bits for
+ consistency with the behavior on 32-bit hosts. Remember value
+ for emit_reloc. */
+ value &= 0xffffffff;
+ value ^= 0x80000000;
+ value -= 0x80000000;
+
+ *valP = value;
fixP->fx_addnumber = value;
+ /* Same treatment for fixP->fx_offset. */
+ fixP->fx_offset &= 0xffffffff;
+ fixP->fx_offset ^= 0x80000000;
+ fixP->fx_offset -= 0x80000000;
+
switch (fixP->fx_r_type)
{
case BFD_RELOC_NONE:
next reply other threads:[~2005-05-24 20:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-24 21:24 Zack Weinberg [this message]
2005-05-25 13:42 ` Richard Earnshaw
2005-05-27 11:42 ` Zack Weinberg
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=1116965825.7031.16.camel@localhost.localdomain \
--to=zack@codesourcery.com \
--cc=binutils@sourceware.org \
--cc=nickc@redhat.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).