From owner-freebsd-amd64@FreeBSD.ORG Thu Jan 27 19:27:05 2005 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D561716A4CE for ; Thu, 27 Jan 2005 19:27:05 +0000 (GMT) Received: from mail.jrv.org (rrcs-24-73-246-106.sw.biz.rr.com [24.73.246.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 63F8D43D48 for ; Thu, 27 Jan 2005 19:27:05 +0000 (GMT) (envelope-from james@jrv.org) Received: from [192.168.3.156] (zippy.housenet.jrv [192.168.3.156]) by mail.jrv.org (8.13.1/8.13.1) with ESMTP id j0RJR4As011367; Thu, 27 Jan 2005 13:27:04 -0600 (CST) (envelope-from james@jrv.org) Message-ID: <41F94088.4050800@jrv.org> Date: Thu, 27 Jan 2005 13:27:04 -0600 From: "James R. Van Artsdalen" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Kargl References: <20050127175934.GA44783@troutmask.apl.washington.edu> In-Reply-To: <20050127175934.GA44783@troutmask.apl.washington.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-amd64@freebsd.org Subject: Re: What is R_X86_64_PC32? X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2005 19:27:06 -0000 Steve Kargl wrote: >This simple fortran program: > > program kk > implicit none > integer N > parameter (N=32768) > real input(N,N) > input(1,1) = 1.e0 > end program kk > > >when compiled by either the system's f77 command or gfortran, >generates the following error: > >troutmask:kargl[217] f77 -o df df.f >/usr/lib/crt1.o(.text+0x15): In function `_start': >: relocation truncated to fit: R_X86_64_PC32 environ >Is this an indication that the stack isn't large enough? > > > I don't think this is anything you're doing. The error is actually a relocation being applied to the startup code in crt1.c: /* The entry function. */ void _start(char **ap, void (*cleanup)(void)) { int argc; char **argv; char **env; const char *s; argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; I think the linker is getting the error trying to fixup the write to env here: 0000000000000000 <_start>: 0: 41 54 push %r12 2: 55 push %rbp 3: 53 push %rbx 4: 8b 2f mov (%rdi),%ebp 6: 4c 8d 67 08 lea 0x8(%rdi),%r12 a: 48 63 dd movslq %ebp,%rbx d: 48 8d 5c df 10 lea 0x10(%rdi,%rbx,8),%rbx 12: 48 89 1d 00 00 00 00 mov %rbx,0(%rip) # 19 <_start+0x19> I *think* that last line is the write to env? In that case there's only room for a 32-bit offset between the address of this code and that of env. Peter, Dave: do we require that statically allocated data be within 2 GB of any code that might reference it by name? Even if that's true it's not obvious to me why your test program isn't meeting such a requirement?