Re: c program binary/image in memory



jacob navia <jacob@xxxxxxxxxxxxxxxx> writes:
> Flash Gordon a écrit :
>> jacob navia wrote:
>>>>> C is a low level systems language, and as such, it is important to
>>>>> be clear of the usage and the works of this mysterious tool called
>>>>> THE LINKER.
>> If it is important to know, then how come I have *never* needed to
>> know when writing applications in C for Linux? To be honest, I don't
>> even know what the sections are named on Linux, SCO, AIX or Windows
>> yet I quite happily write C code that runs on all of them.
>
> Sure, why not?
>
> But when ASKED (as the original poster asked) why not learn?

Because it has nothing to do with the C programming language. Take
another look at the name of this newsgroup.

If you want to talk about linkers and bss and data segments, nobody
will stop you. If you wan't to talk about bicycles and hang gliders,
nobody will stop you. Just find an appropriate place to do it.

> I think knowing the concepts behind those section is important
> specially if you not only want to use the compiler as a black
> box, but also UNDERSTAND what is going on. But as I said before
> this is a matter of personal opinion.

Nobody is necessarily saying that it's not important to know this
stuff (though you can do a lot of C programming without knowing any of
it). The issue is topicality, not importance.

[...]

>> It doesn't always work like that. I've worked on systems where you
>> have one section which contains variable of both static and
>> automatic duration (the stack is places in the same
>> section). Compiler and linker between them generate a linked list of
>> initialisations that need to be done, and the application started
>> code runs along the linked list reading address, size and initial
>> value information and initialising things appropriately. That
>> doesn't sound anything like the data/bss section system you
>> described.
>
> No, it is just that instead of the operating system+linker doing that,
> the program itself does it, before starting main().
>
> You will agree with me howevere, that after that phase of the program is
> done, the data section is there and there is a sequential series
> of memory locations containing the representation of 488776 ok?

No, I do not agree that there necessarily has to be something called a
"data section", or even something comparable with a different name.
There will likely be an object in memory somewhere. Its location
relative to any other object in memory is system-specific.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: Requesting advice how to clean up C code for validating string represents integer
    ... technical definition of a programming language) which in ordinary ... usage has a "wide variety of exact meanings in many walks of life", ... whether some random set of memory cells in a C core image, ... north-west relative to the rest of the Bay Area. ...
    (comp.lang.c)
  • Re: Why do so many people love Teas Instruments?
    ... that almost every modern programming language ... What you described is some "improvements" to the algebra, ... different calculators will produce different results depending on how ... She lived with Linux for a few weeks, ...
    (comp.sys.hp48)
  • Re: Upgrade all Linux Certification exams to test knowledge of PROGRAMMING!!
    ... pdf file for the previous Linux+ networking ... networking interface for Linux certified people ... Three computer programming classes plus ... programming requirement to get a LINUX+ certification a new ...
    (comp.os.linux.networking)
  • Re: Annoucning DragonFly BSD!
    ... :> http://www.dragonflybsd.org/ may be a just a troll erection, ... If Linus felt that way he would never have started Linux. ... the actual programming. ... generations of operating environments I don't believe in the immortality ...
    (freebsd-current)
  • Re: MAKEINTRESOURCE in win32asm
    ... > practical use, as there is no reason, in Asm Programming ... (which would also require a second read from memory to complete), ... haven't noticed it...you must have had some address pointer, ... ooh, "messages"...the value zero can mean "window created", the value ...
    (alt.lang.asm)