From: Ben Pfaff Date: Mon, 25 Sep 2006 21:43:09 +0000 (+0000) Subject: Move assignment to _end_kernel_text inside .rodata. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79a8269502b77763edefdf692d386615a8696661;p=pintos-anon Move assignment to _end_kernel_text inside .rodata. 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. --- diff --git a/src/threads/kernel.lds.S b/src/threads/kernel.lds.S index 437ced3..6154d08 100644 --- a/src/threads/kernel.lds.S +++ b/src/threads/kernel.lds.S @@ -12,8 +12,9 @@ SECTIONS /* 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. */