delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/20/07:32:00

X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: Need information about data and bss segment address access in cygwin
Date: Fri, 20 Jan 2006 12:31:47 -0000
MIME-Version: 1.0
In-Reply-To: <43D0D06C.3010906@hones.org.uk>
Message-ID: <SERRANOIv6EybqfAj810000023c@SERRANO.CAM.ARTIMI.COM>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Cliff Hones wrote:
> Sudhahar wrote:
>> Thanks Dave your reply answered the question where they declared. But
>> how does these variables get the segment address of data and bss for a
>> running process to make a copy to the child process? This is the
>> questions which is a puzzle to me.
> 
> The linker places these variables at the start and end of the data and
> bss segments.  The application can then find the addresses of the segments
> by taking the address of the variables (eg &__data_start__).  They aren't
> strictly variables in the C sense, inasmuch as trying to read or assign
> to them may corrupt your application or cause a segmentation error.

  Indeed; they aren't variables at all, they are merely symbols that point to
whatever item of code or data happens to be at the start or end of the section
concerned.

  And the final part of the answer is that the linker also emits relocs
against any references to their addresses, which are fixed up by the runtime
loader at image-mapping time, and that's how they get the actual final real
address at runtime.

> Look in winsup/cygwin/lib/_cygwin_crt0_common.cc

  Indeed.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019