This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
NEWABI bogon in 2001-10-04 change to macro_build_lui
- From: cgd at broadcom dot com
- To: seufer at csv dot ica dot uni-stuttgart dot de
- Cc: echristo at redhat dot com,binutils at sources dot redhat dot com
- Date: 21 Oct 2002 17:56:13 -0700
- Subject: NEWABI bogon in 2001-10-04 change to macro_build_lui
Hi Thiemo,
In looking at an assembly problem here, I think i found a problem with
your change:
2001-10-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config/tc-mips.c (prev_insn_reloc_type): Make it an array to hold a
relocation triple.
(prev_insn_fixp): Likewise.
(append_insn): Changed prototype to accept a relocation pointer.
(imm_reloc): Make it an array.
(offset_reloc): Likewise.
(md_assemble): Handle triple relocations.
(append_insn): Likewise. Add handling for some NewABI relocations.
(mips_no_prev_insn): Handle triple relocations.
(macro_build): Likewise. Add handling for some NewABI relocations.
Move handling for the 'u' case to append_insn().
(mips16_macro_build): Handle triple relocations.
(macro_build_lui): Likewise. Don't handle _gp_disp as special symbol
for NewABI.
(mips_ip): Handle triple relocations.
(mips16_ip): Likewise.
(mips_force_relocation): Force handling of triple relocations
without symbols for NewABI.
(md_apply_fix): Add handling for some NewABI relocations.
specifically the change to macro_build_lui.
"as -non_shared -mabi=n32 -G0" on code like:
.data
.text
.globl _start
.ent _start
_start:
.set noreorder
la $2,.data
la $2, sym
.end _start
now (because of that change) produces:
00000000 <_start>:
0: 3c020000 lui v0,0x0
4: 24420000 addiu v0,v0,0
4: R_MIPS_LO16 .data
8: 3c020000 lui v0,0x0
c: 24420000 addiu v0,v0,0
c: R_MIPS_LO16 sym
rather than:
00000000 <_start>:
0: 3c020000 lui v0,0x0
0: R_MIPS_HI16 .data
4: 24420000 addiu v0,v0,0
4: R_MIPS_LO16 .data
8: 3c020000 lui v0,0x0
8: R_MIPS_HI16 sym
c: 24420000 addiu v0,v0,0
c: R_MIPS_LO16 sym
(I verified that the latter was what was expected, using the SGI
assembler.)
I believe a change like the one below is in order, but cannot test it
thoroughly...
Thoughts? It doesn't look like there are currently _any_ test cases
for -mabi=32 or -mabi=64, but a non-PIC test should probably be among
them when there are...
(FYI, compiling the same test w/o -G0 produced ... fairly interesting
results for the la of 'sym':
8: 3c020000 lui v0,0x0
8: R_MIPS_GPREL16 sym
c: 24420000 addiu v0,v0,0
I think this is due to bad use of frag_var() in load_address, but i
really don't know. 8-)
chris
===================================================================
Index: tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.175
diff -u -p -r1.175 tc-mips.c
--- tc-mips.c 21 Oct 2002 14:59:30 -0000 1.175
+++ tc-mips.c 22 Oct 2002 00:43:47 -0000
@@ -3268,12 +3268,13 @@ macro_build_lui (place, counter, ep, reg
>> 16) & 0xffff;
*r = BFD_RELOC_UNUSED;
}
- else if (! HAVE_NEWABI)
+ else
{
assert (ep->X_op == O_symbol);
- /* _gp_disp is a special case, used from s_cpload. */
+ /* _gp_disp is a special case if ! HAVE_NEWABI (used from s_cpload). */
assert (mips_pic == NO_PIC
- || strcmp (S_GET_NAME (ep->X_add_symbol), "_gp_disp") == 0);
+ || (! HAVE_NEWABI
+ && strcmp (S_GET_NAME (ep->X_add_symbol), "_gp_disp") == 0));
*r = BFD_RELOC_HI16_S;
}