From owner-freebsd-alpha@FreeBSD.ORG Thu Jun 2 05:38:06 2005 Return-Path: X-Original-To: freebsd-alpha@freebsd.org Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACCCE16A41C for ; Thu, 2 Jun 2005 05:38:06 +0000 (GMT) (envelope-from marcel@xcllnt.net) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D59C43D1D for ; Thu, 2 Jun 2005 05:38:06 +0000 (GMT) (envelope-from marcel@xcllnt.net) Received: from [192.168.4.250] (dhcp50.pn.xcllnt.net [192.168.4.250]) by ns1.xcllnt.net (8.13.3/8.13.3) with ESMTP id j525c5u1002612; Wed, 1 Jun 2005 22:38:05 -0700 (PDT) (envelope-from marcel@xcllnt.net) In-Reply-To: <20050601172416.GA4197@twiddle.net> References: <20050601172416.GA4197@twiddle.net> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Marcel Moolenaar Date: Wed, 1 Jun 2005 22:38:04 -0700 To: Richard Henderson X-Mailer: Apple Mail (2.622) Cc: freebsd-alpha@freebsd.org Subject: Re: reloc_non_plt_obj buggy X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2005 05:38:06 -0000 On Jun 1, 2005, at 10:24 AM, Richard Henderson wrote: >> From src/libexec/rtld-elf/alpha/reloc.c: > > --------------------- > #define load64(p) ({ \ > Elf_Addr __res; \ > __asm__("ldq_u %0,%1" : "=r"(__res) : "m"(*(p))); \ > __res; }) > > #define store64(p, v) \ > __asm__("stq_u %1,%0" : "=m"(*(p)) : "r"(v)) > --------------------- > > Someone wasn't very clear on what ldq_u/stq_u actually does. > You're not actually modifying the unaligned address, you're > modifying (address & ~7), and corrupting the dwarf2 data in > the process. You're absolutely right. > You need to use > > struct ualong { > Elf_Addr x __attribute__((packed)); > }; > > #define load64(p) (((struct ualong *)(p))->x) > #define store64(p,v) (((struct ualong *)(p))->x = (v)) Committed as-is. Thanks, -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net