aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2009-03-12 06:58:33 -0400
committerSam Ravnborg <sam@ravnborg.org>2009-06-09 16:37:43 -0400
commitfd6c3a8dc44329d3aff9a578b5120982f63711ee (patch)
treeba7b7a183d0db95a4ddb33e83a075f963a2028e3
parent6d9923219c6cd1df360f8823253717623f3ad348 (diff)
initconst adjustments
- add .init.rodata to INIT_DATA, and group all initconst flavors together - move strings generated from __setup_param() into .init.rodata - add .*init.rodata to modpost's sets of init sections - make modpost warn about references between meminit and cpuinit as well as memexit and cpuexit sections (as CPU and memory hotplug are independently selectable features) Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r--include/asm-generic/vmlinux.lds.h5
-rw-r--r--include/linux/init.h3
-rw-r--r--scripts/mod/modpost.c48
3 files changed, 43 insertions, 13 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 89853bcd27a6..3edb11499743 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -336,10 +336,11 @@
336#define INIT_DATA \ 336#define INIT_DATA \
337 *(.init.data) \ 337 *(.init.data) \
338 DEV_DISCARD(init.data) \ 338 DEV_DISCARD(init.data) \
339 DEV_DISCARD(init.rodata) \
340 CPU_DISCARD(init.data) \ 339 CPU_DISCARD(init.data) \
341 CPU_DISCARD(init.rodata) \
342 MEM_DISCARD(init.data) \ 340 MEM_DISCARD(init.data) \
341 *(.init.rodata) \
342 DEV_DISCARD(init.rodata) \
343 CPU_DISCARD(init.rodata) \
343 MEM_DISCARD(init.rodata) 344 MEM_DISCARD(init.rodata)
344 345
345#define INIT_TEXT \ 346#define INIT_TEXT \
diff --git a/include/linux/init.h b/include/linux/init.h
index 0e06c176f185..9f70c9f25d4b 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -225,7 +225,8 @@ struct obs_kernel_param {
225 * obs_kernel_param "array" too far apart in .init.setup. 225 * obs_kernel_param "array" too far apart in .init.setup.
226 */ 226 */
227#define __setup_param(str, unique_id, fn, early) \ 227#define __setup_param(str, unique_id, fn, early) \
228 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 228 static const char __setup_str_##unique_id[] __initconst \
229 __aligned(1) = str; \
229 static struct obs_kernel_param __setup_##unique_id \ 230 static struct obs_kernel_param __setup_##unique_id \
230 __used __section(.init.setup) \ 231 __used __section(.init.setup) \
231 __attribute__((aligned((sizeof(long))))) \ 232 __attribute__((aligned((sizeof(long))))) \
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 161b7846733e..94e71efb2c14 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -763,6 +763,8 @@ static void check_section(const char *modname, struct elf_info *elf,
763 763
764 764
765#define ALL_INIT_DATA_SECTIONS \ 765#define ALL_INIT_DATA_SECTIONS \
766 ".init.setup$", ".init.rodata$", \
767 ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \
766 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" 768 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
767#define ALL_EXIT_DATA_SECTIONS \ 769#define ALL_EXIT_DATA_SECTIONS \
768 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" 770 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"
@@ -772,21 +774,23 @@ static void check_section(const char *modname, struct elf_info *elf,
772#define ALL_EXIT_TEXT_SECTIONS \ 774#define ALL_EXIT_TEXT_SECTIONS \
773 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" 775 ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$"
774 776
775#define ALL_INIT_SECTIONS ALL_INIT_DATA_SECTIONS, ALL_INIT_TEXT_SECTIONS 777#define ALL_INIT_SECTIONS INIT_SECTIONS, DEV_INIT_SECTIONS, \
776#define ALL_EXIT_SECTIONS ALL_EXIT_DATA_SECTIONS, ALL_EXIT_TEXT_SECTIONS 778 CPU_INIT_SECTIONS, MEM_INIT_SECTIONS
779#define ALL_EXIT_SECTIONS EXIT_SECTIONS, DEV_EXIT_SECTIONS, \
780 CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS
777 781
778#define DATA_SECTIONS ".data$", ".data.rel$" 782#define DATA_SECTIONS ".data$", ".data.rel$"
779#define TEXT_SECTIONS ".text$" 783#define TEXT_SECTIONS ".text$"
780 784
781#define INIT_SECTIONS ".init.data$", ".init.text$" 785#define INIT_SECTIONS ".init.*"
782#define DEV_INIT_SECTIONS ".devinit.data$", ".devinit.text$" 786#define DEV_INIT_SECTIONS ".devinit.*"
783#define CPU_INIT_SECTIONS ".cpuinit.data$", ".cpuinit.text$" 787#define CPU_INIT_SECTIONS ".cpuinit.*"
784#define MEM_INIT_SECTIONS ".meminit.data$", ".meminit.text$" 788#define MEM_INIT_SECTIONS ".meminit.*"
785 789
786#define EXIT_SECTIONS ".exit.data$", ".exit.text$" 790#define EXIT_SECTIONS ".exit.*"
787#define DEV_EXIT_SECTIONS ".devexit.data$", ".devexit.text$" 791#define DEV_EXIT_SECTIONS ".devexit.*"
788#define CPU_EXIT_SECTIONS ".cpuexit.data$", ".cpuexit.text$" 792#define CPU_EXIT_SECTIONS ".cpuexit.*"
789#define MEM_EXIT_SECTIONS ".memexit.data$", ".memexit.text$" 793#define MEM_EXIT_SECTIONS ".memexit.*"
790 794
791/* init data sections */ 795/* init data sections */
792static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL }; 796static const char *init_data_sections[] = { ALL_INIT_DATA_SECTIONS, NULL };
@@ -869,12 +873,36 @@ const struct sectioncheck sectioncheck[] = {
869 .tosec = { INIT_SECTIONS, NULL }, 873 .tosec = { INIT_SECTIONS, NULL },
870 .mismatch = XXXINIT_TO_INIT, 874 .mismatch = XXXINIT_TO_INIT,
871}, 875},
876/* Do not reference cpuinit code/data from meminit code/data */
877{
878 .fromsec = { MEM_INIT_SECTIONS, NULL },
879 .tosec = { CPU_INIT_SECTIONS, NULL },
880 .mismatch = XXXINIT_TO_INIT,
881},
882/* Do not reference meminit code/data from cpuinit code/data */
883{
884 .fromsec = { CPU_INIT_SECTIONS, NULL },
885 .tosec = { MEM_INIT_SECTIONS, NULL },
886 .mismatch = XXXINIT_TO_INIT,
887},
872/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */ 888/* Do not reference exit code/data from devexit/cpuexit/memexit code/data */
873{ 889{
874 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL }, 890 .fromsec = { DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, MEM_EXIT_SECTIONS, NULL },
875 .tosec = { EXIT_SECTIONS, NULL }, 891 .tosec = { EXIT_SECTIONS, NULL },
876 .mismatch = XXXEXIT_TO_EXIT, 892 .mismatch = XXXEXIT_TO_EXIT,
877}, 893},
894/* Do not reference cpuexit code/data from memexit code/data */
895{
896 .fromsec = { MEM_EXIT_SECTIONS, NULL },
897 .tosec = { CPU_EXIT_SECTIONS, NULL },
898 .mismatch = XXXEXIT_TO_EXIT,
899},
900/* Do not reference memexit code/data from cpuexit code/data */
901{
902 .fromsec = { CPU_EXIT_SECTIONS, NULL },
903 .tosec = { MEM_EXIT_SECTIONS, NULL },
904 .mismatch = XXXEXIT_TO_EXIT,
905},
878/* Do not use exit code/data from init code */ 906/* Do not use exit code/data from init code */
879{ 907{
880 .fromsec = { ALL_INIT_SECTIONS, NULL }, 908 .fromsec = { ALL_INIT_SECTIONS, NULL },