This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[js@convergence.de: binutils-2.11.92.0.12.3 gas MIPS bug: nested parens in %hi]
- From: "H . J . Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Tue, 8 Jan 2002 14:10:09 -0800
- Subject: [js@convergence.de: binutils-2.11.92.0.12.3 gas MIPS bug: nested parens in %hi]
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 -----