Commit a581c2a4697ee264699b364399b73477af408e00
Committed by
Linus Torvalds
1 parent
e2c2770096
Exists in
master
and in
4 other branches
[PATCH] add __[start|end]_rodata sections to asm-generic/sections.h
Add __start_rodata and __end_rodata to sections.h to avoid extern declarations. Needed by s390 code (see following patch). [akpm@osdl.org: update architectures] Cc: Arjan van de Ven <arjan@infradead.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Andi Kleen <ak@muc.de> Acked-by: Kyle McMartin <kyle@mcmartin.ca> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 4 changed files with 10 additions and 11 deletions Side-by-side Diff
arch/i386/mm/init.c
| ... | ... | @@ -725,16 +725,15 @@ |
| 725 | 725 | |
| 726 | 726 | #ifdef CONFIG_DEBUG_RODATA |
| 727 | 727 | |
| 728 | -extern char __start_rodata, __end_rodata; | |
| 729 | 728 | void mark_rodata_ro(void) |
| 730 | 729 | { |
| 731 | - unsigned long addr = (unsigned long)&__start_rodata; | |
| 730 | + unsigned long addr = (unsigned long)__start_rodata; | |
| 732 | 731 | |
| 733 | - for (; addr < (unsigned long)&__end_rodata; addr += PAGE_SIZE) | |
| 732 | + for (; addr < (unsigned long)__end_rodata; addr += PAGE_SIZE) | |
| 734 | 733 | change_page_attr(virt_to_page(addr), 1, PAGE_KERNEL_RO); |
| 735 | 734 | |
| 736 | - printk ("Write protecting the kernel read-only data: %luk\n", | |
| 737 | - (unsigned long)(&__end_rodata - &__start_rodata) >> 10); | |
| 735 | + printk("Write protecting the kernel read-only data: %uk\n", | |
| 736 | + (__end_rodata - __start_rodata) >> 10); | |
| 738 | 737 | |
| 739 | 738 | /* |
| 740 | 739 | * change_page_attr() requires a global_flush_tlb() call after it. |
arch/parisc/mm/init.c
| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | #include <asm/tlb.h> |
| 28 | 28 | #include <asm/pdc_chassis.h> |
| 29 | 29 | #include <asm/mmzone.h> |
| 30 | +#include <asm/sections.h> | |
| 30 | 31 | |
| 31 | 32 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
| 32 | 33 | |
| 33 | 34 | |
| ... | ... | @@ -417,11 +418,10 @@ |
| 417 | 418 | #ifdef CONFIG_DEBUG_RODATA |
| 418 | 419 | void mark_rodata_ro(void) |
| 419 | 420 | { |
| 420 | - extern char __start_rodata, __end_rodata; | |
| 421 | 421 | /* rodata memory was already mapped with KERNEL_RO access rights by |
| 422 | 422 | pagetable_init() and map_pages(). No need to do additional stuff here */ |
| 423 | 423 | printk (KERN_INFO "Write protecting the kernel read-only data: %luk\n", |
| 424 | - (unsigned long)(&__end_rodata - &__start_rodata) >> 10); | |
| 424 | + (unsigned long)(__end_rodata - __start_rodata) >> 10); | |
| 425 | 425 | } |
| 426 | 426 | #endif |
| 427 | 427 |
arch/x86_64/mm/init.c
| ... | ... | @@ -678,16 +678,15 @@ |
| 678 | 678 | |
| 679 | 679 | #ifdef CONFIG_DEBUG_RODATA |
| 680 | 680 | |
| 681 | -extern char __start_rodata, __end_rodata; | |
| 682 | 681 | void mark_rodata_ro(void) |
| 683 | 682 | { |
| 684 | - unsigned long addr = (unsigned long)&__start_rodata; | |
| 683 | + unsigned long addr = (unsigned long)__start_rodata; | |
| 685 | 684 | |
| 686 | - for (; addr < (unsigned long)&__end_rodata; addr += PAGE_SIZE) | |
| 685 | + for (; addr < (unsigned long)__end_rodata; addr += PAGE_SIZE) | |
| 687 | 686 | change_page_attr_addr(addr, 1, PAGE_KERNEL_RO); |
| 688 | 687 | |
| 689 | 688 | printk ("Write protecting the kernel read-only data: %luk\n", |
| 690 | - (&__end_rodata - &__start_rodata) >> 10); | |
| 689 | + (__end_rodata - __start_rodata) >> 10); | |
| 691 | 690 | |
| 692 | 691 | /* |
| 693 | 692 | * change_page_attr_addr() requires a global_flush_tlb() call after it. |
include/asm-generic/sections.h