Talk:Bran's Kernel Development Tutorial Known Bugs

From OSDev Wiki
Jump to: navigation, search

I was going to change where the .rodata section is, but figured I'd ask for opinions first. Currently we're telling newbies to add the .rodata section to .text, but IMO that's a horrible place to put it. It should be put in the .data section (whether before or after .data doesn't matter), as static strings ARE data, and by placing them in .data they wouldn't be marked as executable and that's always a good thing. --quok 16:32, 27 August 2008 (UTC)

I agree and disagree: I agree it shouldn't go in .text, as I do not want to cause some bug in my code to start executing my static strings. .rodata is read-only, like .text, but it's not executable and should therefore be marked as such. Placing .rodata in .text predates the NX bit, since without it there's not much difference. But I disagree it should go in .data, since .data is writeable and .rodata should not be, by definition. Therefore I think .rodata should go in it's own section, *and* in its own segment so that the segment where the .text section is in can be marked read-only, execute, the segment of .rodata can be marked read-only, no execute, and the .data segment can be marked read-write, no execute. Jal 10:44, 24 November 2009 (UTC)

strange placements

I'm at lost why the linked script uses these strange AT placements, combined with a . = ALIGN(), instead of just an ALIGN() in place of the AT. So something like this (ignoring the .rodata problems above):


 .text phys : AT(phys)
   code = .;
 .data : ALIGN(4096)
   data = .;
 .bss : ALIGN(4096)
   bss = .;
 end = ALIGN(4096);


That makes it much more readable, imho. EDIT: does anyone now why it's formatted so weird?

Jal 10:49, 24 November 2009 (UTC)

Personal tools