X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=wS5yX+Vgvg1rYBjPoNWHkDa2lhIu6sd2F6vLUGwMCrE=; b=AUIGN2dGbrpFq7UmYwEeHIGQsRWuajknFXVt1apMguC5YtncaB2OPoTmpG7fLSmYkq YQXQnAo1RdX9HXS/KMRX1DgB6n+iS3OGeGoWH2e4fnIrf+CRyo9R5NzQv5RR7B6SWwHy Zg0MLmP05IHerfLoE4+sKyEw3jJs8oZV10f+M= MIME-Version: 1.0 In-Reply-To: <83zkjwcknb.fsf@gnu.org> References: <83zkjwcknb DOT fsf AT gnu DOT org> Date: Sat, 30 Jul 2011 10:17:43 +0300 Message-ID: Subject: Re: [PATCH] allow 64 bit host tools when cross compiling From: Ozkan Sezer To: djgpp-workers AT delorie DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p6U7grHL005164 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sat, Jul 30, 2011 at 10:06 AM, Eli Zaretskii wrote: >> Date: Fri, 29 Jul 2011 23:01:07 +0300 >> From: Ozkan Sezer >> >> On Fri, Jul 29, 2011 at 6:32 PM, Ozkan Sezer wrote: >> > Hi all: >> > >> > dxegen segfaults when built as a 64 bit host tool in >> > dxe3gen.c:553 (write_dxe) most probably due to "long" >> > data type usage at many places (such as coff.h) > > Can you provide more details about the context?  Are you trying to run > dxegen _natively_ (as opposed to as a cross-compilation tool) on a > x86_64 platform? Yes >  IOW, what is the purpose of this compilation? > To compile the djgpp runtime library >> OK, here is a patch that seems to work for me (see attached 64.patch) > > If this is just a replacement of integer types, then it's a largely > mechanical patch. > > It is mostly okay, but I don't understand why you went so far and > deep, and changed also the types that don't need to be changed at all. > For example, neither `short' nor `int' have different size on any > known machine that can be ever supported by DJGPP, so why change them > at all? For consistency, >  IOW, I would only change `long' to `int', and that's it.  No > need for stdint.h and intNN_t stuff.  Would that be enough? > >> -        fwrite(&relocs[i].r_vaddr, 1, sizeof(long), outf); >> +        fwrite(&relocs[i].r_vaddr, 1, sizeof(int32_t), outf); > > This (and other similar) issue are better solved by using the variable > in question, not its type.  Like this: > >    fwrite(&relocs[i].r_vaddr, 1, sizeof(relocs[i].r_vaddr), outf); That particular one (and its similars) I can do, if the changes are acceptable > Then the code will DTRT with no changes required even if the type of > the variable is changed. > -- O.S.