From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3950 invoked by alias); 11 Dec 2004 03:41:32 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 3822 invoked from network); 11 Dec 2004 03:41:22 -0000 Received: from unknown (209.128.65.135) by sourceware.org with QMTP; 11 Dec 2004 03:41:22 -0000 Received: (qmail 4509 invoked by uid 10); 11 Dec 2004 03:41:21 -0000 Received: (qmail 7171 invoked by uid 500); 11 Dec 2004 03:41:11 -0000 Message-ID: <20041211034111.7170.qmail@gossamer.airs.com> Date: Sat, 11 Dec 2004 03:41:00 -0000 From: Ian Lance Taylor To: binutils@sourceware.org Subject: Give an error for an offset which is too large X-SW-Source: 2004-12/txt/msg00128.txt.bz2 I happened to run across a case which the assembler appeared to accept but did not actually assemble correctly: dla $4,bar+0x800000000($5) for an object file format with 32-bit addresses. The assembler would try to include the offset in the relocation, but since the offset was too large the full offset would not be in the object file. It would be possible to handle this correctly, by loading the constant into $at and adding it in, but I suspect that this code is incorrect for an object file format with 32-bit addresses. This patch gives an error for this case. I'm about to commit this patch. Ian 2004-12-10 Ian Lance Taylor * config/tc-mips.c (macro) [M_LA_AB]: Give an error for a offset which is too large in the case of NO_PIC without 64-bit addresses. Index: config/tc-mips.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-mips.c,v retrieving revision 1.277 diff -u -r1.277 tc-mips.c --- config/tc-mips.c 10 Dec 2004 19:48:18 -0000 1.277 +++ config/tc-mips.c 11 Dec 2004 03:37:08 -0000 @@ -4996,6 +4996,8 @@ tempreg, mips_gp_register, BFD_RELOC_GPREL16); relax_switch (); } + if (!IS_SEXT_32BIT_NUM (offset_expr.X_add_number)) + as_bad (_("offset too large")); macro_build_lui (&offset_expr, tempreg); macro_build (&offset_expr, ADDRESS_ADDI_INSN, "t,r,j", tempreg, tempreg, BFD_RELOC_LO16);