From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13018 invoked by alias); 18 Aug 2009 18:18:05 -0000 Received: (qmail 13008 invoked by uid 22791); 18 Aug 2009 18:18:04 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Aug 2009 18:17:56 +0000 Received: from spaceape11.eur.corp.google.com (spaceape11.eur.corp.google.com [172.28.16.145]) by smtp-out.google.com with ESMTP id n7IIHrA7017279 for ; Tue, 18 Aug 2009 11:17:54 -0700 Received: from pxi9 (pxi9.prod.google.com [10.243.27.9]) by spaceape11.eur.corp.google.com with ESMTP id n7IIHov1026187 for ; Tue, 18 Aug 2009 11:17:51 -0700 Received: by pxi9 with SMTP id 9so87064pxi.0 for ; Tue, 18 Aug 2009 11:17:50 -0700 (PDT) Received: by 10.114.163.13 with SMTP id l13mr5687657wae.139.1250619470139; Tue, 18 Aug 2009 11:17:50 -0700 (PDT) Received: from localhost.localdomain.google.com (dhcp-172-22-126-192.mtv.corp.google.com [172.22.126.192]) by mx.google.com with ESMTPS id k14sm13073083waf.60.2009.08.18.11.17.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 18 Aug 2009 11:17:49 -0700 (PDT) To: =?utf-8?B?RG91ZyBLd2FuICjpl5zmjK/lvrcp?= Cc: binutils@sourceware.org Subject: Re: [PATCH][GOLD] Add make_elf_object target hooks. References: <498552560908171552w266b6278gfc92e6032b007f88@mail.gmail.com> <498552560908180843u3a9eeffcr174298efb97ae380@mail.gmail.com> From: Ian Lance Taylor Date: Tue, 18 Aug 2009 18:35:00 -0000 In-Reply-To: <498552560908180843u3a9eeffcr174298efb97ae380@mail.gmail.com> (Doug Kwan's message of "Tue\, 18 Aug 2009 08\:43\:52 -0700") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2009-08/txt/msg00334.txt.bz2 "Doug Kwan (=E9=97=9C=E6=8C=AF=E5=BE=B7)" writes: > 2009/8/18 Ian Lance Taylor : > >>> + =C2=A0 =C2=A0 =C2=A0obj->setup(ehdr); >> >> It no longer makes sense for Object::setup to take an ehdr parameter. >> It should take a target parameter, and avoid looking up the target >> again. > > Agree. I suppose all objects have targets and their targets do not > change. Should setup() be simply part of the constructor? I originally left it out because it can fail, and it's weird to have a constructor fail. I guess I'd prefer to keep it separate for now. >> Interesting problem. =C2=A0I wonder if there is anything we can do to ma= ke >> that easier to write. > > Unfortunately, virtual functions cannot be templated. That's why I > mentioned changing the paratmeter ehdr back to a raw unsigned char > pointer. If we do so, we only have one virtual function instead of > four. The downside of doing that is that callers must ensure that the > pointer points to something valid. Passing an > Elfcpp::Ehdr object enforces that automatically. Yeah, I guess the way you did it is fine. Ian