This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Are _etext, _edata, _end broken?


DJ Delorie <dj@redhat.com> writes:

>> o Why is _etext is not equal to the virtual address of the .data
>> section (in the elf binary) ?
>
> Why should it be?  It's the end of the .text section, not the
> beginning of the data section.

Usually the .rodata section immediately follows at the address of _etext,
but that doesn't mark the boundary between read-only and read-write
segments (there is no predefined symbol for this).

>> o And also _edata is not the virtual addess of the .bss section in the
>> elf binary?
>
> It is on my system.

There may be other sections before .bss that are part of the BSS segment,
eg. the .sbss section on ia64 and powerpc, or the .plt section on
powerpc64.

>> o To locate the span of virtual address of DATA segment and BSS
>> segment is a better Idea to read the virtual addess form the .data
>> and .bss sections of elf binary or depend on _etext , _edata (they
>> seem to be broken ?)
>
> For embedded ELF, it's better to write your own linker script that
> provides variables you can trust.

There is also the predefined symbol __bss_start.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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