James Carlson wrote:
girish writes:
'ptr' itself is allocated in the .data segment. However, the literal
string "adam" is stored in .rodata.
Thanks, I managed to spot the constant string "adam" in the .rodata section
using dump -s :)
I have just started reading the Linker and Libraries Guide form docs.sun.com,
but I have only a vague idea about how the compiler generates the binary, elf
format etc. so I have a lot to learn...
Any suggestion for a good book or online reference for learning more about this
topic?
It sounds like you're already reading a good one.
Part of this is knowing some history. Search around for odd terms
such as "block started by symbol." :-/
although, really, that's overkill for understanding this problem; the
simple and complete answer is the C language definition. Literal strings
are not guaranteed writable; trying to write them is generally considered a
bad idea. exactly *how* they're made non-writable involves the linker, but
you don't need to understand the linker to understand that aspect of C.
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code