public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [js@convergence.de: binutils-2.11.92.0.12.3 gas MIPS bug: nested parens in %hi]
@ 2002-01-08 15:09 H . J . Lu
  2002-01-08 16:42 ` H . J . Lu
  2002-01-08 18:05 ` Richard Henderson
  0 siblings, 2 replies; 10+ messages in thread
From: H . J . Lu @ 2002-01-08 15:09 UTC (permalink / raw)
  To: binutils

Any ideas?


H.J.
---
----- Forwarded message from Johannes Stezenbach <js@convergence.de> -----

Delivered-To: hjl@lucon.org
Date: Tue, 8 Jan 2002 22:18:23 +0100
From: Johannes Stezenbach <js@convergence.de>
To: "H . J . Lu" <hjl@lucon.org>
Cc: Jun Sun <jsun@mvista.com>
Subject: binutils-2.11.92.0.12.3 gas MIPS bug: nested parens in %hi
User-Agent: Mutt/1.3.25i

Hello H. J.,

the assembler of binutils-2.11.92.0.12.3 for MIPS has a bug which
shows up when parsing percent-ops like %hi and %lo with
nested parentheses, e.g.

   lui t0, %hi((0xa0000000 + 0x10001000))

produces parsing errors because of unmatched parens
(sorry, I don't have the exact error message right now).

Code like that is output from the preprocessor for
linux/arch/mips/vr4181/common/int_handler.S in
http://linux-mips.sourceforge.net/, which has

   lui     t3,%hi(VR4181_SYSINT1REG)

where linux/include/asm-mips/vr4181/vr4181.h has

  #ifndef _LANGUAGE_ASSEMBLY
  #define __preg16        (volatile unsigned short*)
  #else
  #define __preg16
  #endif
  #define VR4181_SYSINT1REG       __preg16(KSEG1 + 0x0A000080)    /* Level 1 System interrupt register 1 (R) */


AFAIK this used to work with binutils-2.10.91.0.2.

I attempted to fix this problem (patch attached), but unfortunately
my understanding of gas' expression parser is very limited.
My patch is thus more a workaround-hack than a fix.

I tried hard to figure out how my_getSmallExpression() in
gas/config/tc-mips.c works for nested precent-ops, but
either I failed or the thing is totally broken.

I dont't know all the details of the MIPS assembler syntax,
but wouldn't it be the right way to use expr() (in gas/expr.c) for
parsing, and provide support for percent-ops via the
md_operand() hook?  This should work since is_name_beginner('%')
returns FALSE and LITERAL_PREFIXPERCENT_BIN is #undef'd.


Regards,
Johannes

----- End forwarded message -----

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-01-14 17:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-08 15:09 [js@convergence.de: binutils-2.11.92.0.12.3 gas MIPS bug: nested parens in %hi] H . J . Lu
2002-01-08 16:42 ` H . J . Lu
2002-01-08 22:33   ` Eric Christopher
2002-01-08 23:04     ` H . J . Lu
2002-01-09  2:48       ` Eric Christopher
2002-01-09  3:34         ` H . J . Lu
2002-01-12 17:00   ` Thiemo Seufer
2002-01-14  9:25     ` Johannes Stezenbach
2002-01-08 18:05 ` Richard Henderson
2002-01-10  2:11   ` H . J . Lu

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).