From: Mike Tripicco <miket@anubis.gsfc.nasa.gov>
To: axp-list@redhat.com
Subject: Re: malloc oddity?
Date: Mon, 29 Jun 1998 17:39:48 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.3.95.980629172833.13914A-100000@anubis.gsfc.nasa.gov> (raw)
In-Reply-To: <199806292010.QAA09705@linux01.hlo.dec.com>
On Mon, 29 Jun 1998, Jim Paradis wrote:
> I'm just curious; why is this a problem? Surely you're not assuming
> that malloc'ed memory is contiguous?! Malloc can return you a pointer
> anywhere it pleases 8-)
The problem relates to some legacy Fortran code I've inherited which
allows Fortran to do dynamic memory allocation. The trick involves Fortran
handling the offset between the location of a common block set by the
Fortran code and the location of the malloc'd memory. That offset is used
by Fortran and thus must fit in a 4-byte integer. In this case that's
impossible.
However, it looks to me like if the GNU linker had an option equivalent to
Digital's "-taso" I'd be able to avoid the problem:
-taso
This option tells the linker that the executable should be
loaded in the lower 31-bit addressable virtual address range.
The -T and -D options to the ld(1) command can also be
used to ensure that the text and data segments addresses,
respectively, are loaded into low memory. The -taso option,
however, in addition to setting default addresses for text and
data segments, also causes shared libraries linked outside
the 31-bit address space to be appropriately relocated by
the loader. If you specify -taso and also specify text and
data segment addresses with -T and -D, those addresses override
the -taso default addresses. The -taso option is useful for
porting 32-bit programs to the Digital UNIX operating system.
I'm not trying to argue whether it's legal for malloc to do this or not.
But I do think it's unfortunate (and odd) that it operates this way using
Alpha Linux and nowhere else, including x86 Linux or Alphas running
Digital Unix...
Thanks,
Mike
next prev parent reply other threads:[~1998-06-29 21:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-06-29 19:32 malloc oddity? Mike Tripicco
1998-06-29 20:10 ` Jim Paradis
1998-06-29 21:39 ` Mike Tripicco [this message]
1998-06-29 22:20 ` Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1998-06-30 21:23 Larry Zimmerman
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox