* gas patch for ARM
@ 1998-01-27 2:20 Philip Blundell
1998-01-27 9:35 ` Ian Lance Taylor
0 siblings, 1 reply; 2+ messages in thread
From: Philip Blundell @ 1998-01-27 2:20 UTC (permalink / raw)
To: gas2
Hi.
The following patch makes ADR instructions work correctly when
cross-assembling for the ARM from a machine with a word size greater
than 32 bits.
p.
Tue Jan 27 10:06:45 1998 Philip Blundell <pb@nexus.co.uk>
* config/tc-arm.c (md_apply_fix3): Force sign extension to happen
before comparing 32-bit values with FAIL.
Index: tc-arm.c
===================================================================
RCS file: /usr/repository/gnu/binutils/gas/config/tc-arm.c,v
retrieving revision 1.3
diff -u -r1.3 tc-arm.c
--- tc-arm.c 1998/01/16 10:00:19 1.3
+++ tc-arm.c 1998/01/21 11:38:37
@@ -5096,8 +5096,8 @@
/* If the instruction will fail, see if we can fix things up by
changing the opcode. */
- if (newval == FAIL
- && (newval = negate_data_op (&temp, value)) == FAIL)
+ if ((int)newval == FAIL
+ && ((int)(newval = negate_data_op (&temp, value))) == FAIL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
"invalid constant after fixup\n");
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gas patch for ARM
1998-01-27 2:20 gas patch for ARM Philip Blundell
@ 1998-01-27 9:35 ` Ian Lance Taylor
0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 1998-01-27 9:35 UTC (permalink / raw)
To: pb; +Cc: gas2
Date: Tue, 27 Jan 1998 10:09:11 +0000
From: Philip Blundell <pb@nexus.co.uk>
The following patch makes ADR instructions work correctly when
cross-assembling for the ARM from a machine with a word size greater
than 32 bits.
The way in which functions in tc-arm.c return either FAIL or a
meaningful value makes me nervous. I think that decades of bugs in
handling the return type of getchar indicate the problems with this
sort of return value.
Also, using int to avoid a 32/64 bit problem looks wrong, since it
appears to assume that int is a 32 bit value. In this case it is
probably correct, but rather than check in the code that looks wrong
at first glance, I checked in the appended patch instead.
Ian
Index: config/tc-arm.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/tc-arm.c,v
retrieving revision 1.38
diff -u -r1.38 tc-arm.c
--- tc-arm.c 1997/12/16 09:23:39 1.38
+++ tc-arm.c 1998/01/27 17:32:02
@@ -5036,6 +5036,7 @@
{
offsetT value = *val;
offsetT newval;
+ unsigned int newimm;
unsigned long temp;
int sign;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
@@ -5072,21 +5073,21 @@
switch (fixP->fx_r_type)
{
case BFD_RELOC_ARM_IMMEDIATE:
- newval = validate_immediate (value);
+ newimm = validate_immediate (value);
temp = md_chars_to_number (buf, INSN_SIZE);
/* If the instruction will fail, see if we can fix things up by
changing the opcode. */
- if (newval == FAIL
- && (newval = negate_data_op (&temp, value)) == FAIL)
+ if (newimm == (unsigned int) FAIL
+ && (newimm = negate_data_op (&temp, value)) == (unsigned int) FAIL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
"invalid constant after fixup\n");
break;
}
- newval |= (temp & 0xfffff000);
- md_number_to_chars (buf, newval, INSN_SIZE);
+ newimm |= (temp & 0xfffff000);
+ md_number_to_chars (buf, (valueT) newimm, INSN_SIZE);
break;
case BFD_RELOC_ARM_OFFSET_IMM:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-01-27 9:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-27 2:20 gas patch for ARM Philip Blundell
1998-01-27 9:35 ` Ian Lance Taylor
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).