Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Feb 1999 10:34:42 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: ldconfig and libraries
Message-ID:  <XFMail.990208103442.jdp@polstra.com>
In-Reply-To: <199902060217.TAA26924@usr02.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Terry Lambert wrote:
>> > Sounds like it's in the wrong order in the file...
>> 
>> No it's not.  It's a read-only section (section, not segment), so at
>> load time it needs to end up in a read-only segment (segment, not
>> section).  On most OSs the only read-only segment is the text segment.
>> So it has to be in the same segment as text.  Given that, it doesn't
>> matter whether it comes before or after the actual program code,
>> because in either case it will precede the data segment.  Therefore,
>> changing its size will move the data segment.
> 
> I think we are talking at cross purposes here.
> 
> You are saying that the section is read-only to the program.

Yes.

> I am saying that it shouldn't be read-only to a tool to manipulate
> the section contents.

Of course it needn't be read-only to any tool.

> In that regard, the location of the section should be after the
> executable code.

It can be after the executable code, but it can't be after the
program's data.  FreeBSD's kernel currently supports only 3 segments
for programs: text, data, and bss.  They are laid out contiguously in
the address space, in that order.  The only one that's read-only is
text, the first segment.  So all read-only items have to be somewhere
in the text segment.  They can be before or after the program code,
but that doesn't help.  Because in either case, they'll still precede
the data segment.  Thus changing the size of anything that's read-only
will force the data segment to move.  That would require relocation,
which cannot be done for an executable.  The relocation information
isn't present in the file any more.

John
---
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Nobody ever went broke underestimating the taste of the American public."
                                                            -- H. L. Mencken

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.990208103442.jdp>