Talk:Bran's Kernel Development Tutorial Known Bugs: Difference between revisions

From OSDev.wiki
Latest comment: 14 years ago by Jal
Jump to navigation Jump to search
Content added Content deleted
(New page: 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 p...)
 
No edit summary
Line 1: Line 1:
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. --[[User:Quok|quok]] 16:32, 27 August 2008 (UTC)
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. --[[User:Quok|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. [[User:Jal|Jal]] 10:44, 24 November 2009 (UTC)

Revision as of 10:44, 24 November 2009

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)Reply[reply]

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)Reply[reply]