Without this change, any orphan, read-only sections (such as .eh_frame
from libgcc) will be placed by GNU ld between .rodata and
_end_kernel_text. The result is that _end_kernel_text gets pushed
into the middle of a page that now contains some read-only and some
read/write data. After paging_init() marks that page read-only, the
first write to it (in intr_init() in my case) causes Pintos to go
ka-boom!
With this change, orphan read-only sections just don't get marked
read-only in the page tables. Big deal.
/* Kernel starts with code, followed by read-only data and writable data. */
.text : { *(.start) *(.text) } = 0x90
- .rodata : { *(.rodata) *(.rodata.*) . = ALIGN(0x1000); }
- _end_kernel_text = .;
+ .rodata : { *(.rodata) *(.rodata.*)
+ . = ALIGN(0x1000);
+ _end_kernel_text = .; }
.data : { *(.data) }
/* BSS (zero-initialized data) is after everything else. */