From owner-freebsd-hackers Mon Feb 8 10:35:14 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA09355 for freebsd-hackers-outgoing; Mon, 8 Feb 1999 10:35:14 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA09350 for ; Mon, 8 Feb 1999 10:35:04 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.1/8.9.1) with ESMTP id KAA18262; Mon, 8 Feb 1999 10:34:45 -0800 (PST) (envelope-from jdp@polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.9.1/8.9.1) id KAA43746; Mon, 8 Feb 1999 10:34:42 -0800 (PST) (envelope-from jdp@polstra.com) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199902060217.TAA26924@usr02.primenet.com> Date: Mon, 08 Feb 1999 10:34:42 -0800 (PST) Organization: Polstra & Co., Inc. From: John Polstra To: Terry Lambert Subject: Re: ldconfig and libraries Cc: hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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