This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Need information about data and bss segment address access in cygwin

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

  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/


Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]