From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25917 invoked by alias); 24 Feb 2005 22:43:35 -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 25859 invoked from network); 24 Feb 2005 22:43:32 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 24 Feb 2005 22:43:32 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j1OMhVBK024976 for ; Thu, 24 Feb 2005 17:43:31 -0500 Received: from firetop.home (vpn50-46.rdu.redhat.com [172.16.50.46]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j1OMhVK07420; Thu, 24 Feb 2005 17:43:31 -0500 Received: from rsandifo by firetop.home with local (Exim 4.34) id 1D4Rhh-0002AP-MK; Thu, 24 Feb 2005 22:43:29 +0000 To: cgd@broadcom.com Cc: "Maciej W. Rozycki" , binutils@sources.redhat.com Subject: Re: [patch] MIPS: Fix synthesized doubleword transfers (ping) References: <87sm3lhdo1.fsf@firetop.home> <87oee9ha6p.fsf@firetop.home> From: Richard Sandiford Date: Fri, 25 Feb 2005 13:36:00 -0000 In-Reply-To: (cgd@broadcom.com's message of "24 Feb 2005 14:29:56 -0800") Message-ID: <87bra9h94e.fsf@firetop.home> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-02/txt/msg00629.txt.bz2 cgd@broadcom.com writes: > At Thu, 24 Feb 2005 22:20:30 +0000, Richard Sandiford wrote: >> cgd@broadcom.com writes: >> > At Thu, 24 Feb 2005 21:05:49 +0000 (UTC), "Richard Sandiford" wrote: >> >> I suppose bad things could happen if you composed an aligned >> >> address from an unaligned symbol and an unaligned offset, >> >> but is that allowed? >> > >> > yes, at least as far as the ISA is concerned. >> >> I don't follow. The ISA has no concept of symbols vs. offsets. > > right, but to some degree symbol + offset -> base reg + offset, since > the offsets in the base regs come directly from the relocs. Not really. ld is the equivalent of: lui tmp,%hi(foo) lw w1,%lo(foo)(tmp) lw w2,%lo(foo+4)(tmp) where the base register (tmp) is the high part of "sym + offset" (lowest 16 bits all 0). We don't load the symbol part into a temporary register and then add the offset. For example, the linker will generate the same output for: foo = sym + offset, sym = 0x10004, offset = 4 foo = sym + offset, sym = 0x10008, offset = 0 Richard