diff options
Diffstat (limited to 'arch/mn10300/kernel')
-rw-r--r-- | arch/mn10300/kernel/module.c | 39 | ||||
-rw-r--r-- | arch/mn10300/kernel/process.c | 3 | ||||
-rw-r--r-- | arch/mn10300/kernel/vmlinux.lds.S | 60 |
3 files changed, 52 insertions, 50 deletions
diff --git a/arch/mn10300/kernel/module.c b/arch/mn10300/kernel/module.c index 4fa0e3648d8..6aea7fd7699 100644 --- a/arch/mn10300/kernel/module.c +++ b/arch/mn10300/kernel/module.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* MN10300 Kernel module helper routines | 1 | /* MN10300 Kernel module helper routines |
2 | * | 2 | * |
3 | * Copyright (C) 2007, 2008 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2007, 2008, 2009 Red Hat, Inc. All Rights Reserved. |
4 | * Written by Mark Salter (msalter@redhat.com) | 4 | * Written by Mark Salter (msalter@redhat.com) |
5 | * - Derived from arch/i386/kernel/module.c | 5 | * - Derived from arch/i386/kernel/module.c |
6 | * | 6 | * |
@@ -103,10 +103,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, | |||
103 | unsigned int relsec, | 103 | unsigned int relsec, |
104 | struct module *me) | 104 | struct module *me) |
105 | { | 105 | { |
106 | unsigned int i; | 106 | unsigned int i, sym_diff_seen = 0; |
107 | Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; | 107 | Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; |
108 | Elf32_Sym *sym; | 108 | Elf32_Sym *sym; |
109 | Elf32_Addr relocation; | 109 | Elf32_Addr relocation, sym_diff_val = 0; |
110 | uint8_t *location; | 110 | uint8_t *location; |
111 | uint32_t value; | 111 | uint32_t value; |
112 | 112 | ||
@@ -126,6 +126,22 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, | |||
126 | /* this is the adjustment to be made */ | 126 | /* this is the adjustment to be made */ |
127 | relocation = sym->st_value + rel[i].r_addend; | 127 | relocation = sym->st_value + rel[i].r_addend; |
128 | 128 | ||
129 | if (sym_diff_seen) { | ||
130 | switch (ELF32_R_TYPE(rel[i].r_info)) { | ||
131 | case R_MN10300_32: | ||
132 | case R_MN10300_24: | ||
133 | case R_MN10300_16: | ||
134 | case R_MN10300_8: | ||
135 | relocation -= sym_diff_val; | ||
136 | sym_diff_seen = 0; | ||
137 | break; | ||
138 | default: | ||
139 | printk(KERN_ERR "module %s: Unexpected SYM_DIFF relocation: %u\n", | ||
140 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
141 | return -ENOEXEC; | ||
142 | } | ||
143 | } | ||
144 | |||
129 | switch (ELF32_R_TYPE(rel[i].r_info)) { | 145 | switch (ELF32_R_TYPE(rel[i].r_info)) { |
130 | /* for the first four relocation types, we simply | 146 | /* for the first four relocation types, we simply |
131 | * store the adjustment at the location given */ | 147 | * store the adjustment at the location given */ |
@@ -157,12 +173,29 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, | |||
157 | *location = relocation - (uint32_t) location; | 173 | *location = relocation - (uint32_t) location; |
158 | break; | 174 | break; |
159 | 175 | ||
176 | case R_MN10300_SYM_DIFF: | ||
177 | /* This is used to adjust the next reloc as required | ||
178 | * by relaxation. */ | ||
179 | sym_diff_seen = 1; | ||
180 | sym_diff_val = sym->st_value; | ||
181 | break; | ||
182 | |||
183 | case R_MN10300_ALIGN: | ||
184 | /* Just ignore the ALIGN relocs. | ||
185 | * Only interesting if kernel performed relaxation. */ | ||
186 | continue; | ||
187 | |||
160 | default: | 188 | default: |
161 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", | 189 | printk(KERN_ERR "module %s: Unknown relocation: %u\n", |
162 | me->name, ELF32_R_TYPE(rel[i].r_info)); | 190 | me->name, ELF32_R_TYPE(rel[i].r_info)); |
163 | return -ENOEXEC; | 191 | return -ENOEXEC; |
164 | } | 192 | } |
165 | } | 193 | } |
194 | if (sym_diff_seen) { | ||
195 | printk(KERN_ERR "module %s: Nothing follows SYM_DIFF relocation: %u\n", | ||
196 | me->name, ELF32_R_TYPE(rel[i].r_info)); | ||
197 | return -ENOEXEC; | ||
198 | } | ||
166 | return 0; | 199 | return 0; |
167 | } | 200 | } |
168 | 201 | ||
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index 234cf344cdc..892cce82867 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -281,9 +281,6 @@ asmlinkage long sys_execve(char __user *name, | |||
281 | error = PTR_ERR(filename); | 281 | error = PTR_ERR(filename); |
282 | if (!IS_ERR(filename)) { | 282 | if (!IS_ERR(filename)) { |
283 | error = do_execve(filename, argv, envp, __frame); | 283 | error = do_execve(filename, argv, envp, __frame); |
284 | if (error == 0) | ||
285 | current->ptrace &= ~PT_DTRACE; | ||
286 | |||
287 | putname(filename); | 284 | putname(filename); |
288 | } | 285 | } |
289 | 286 | ||
diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S index 24de6b90f40..bcebcefb4ad 100644 --- a/arch/mn10300/kernel/vmlinux.lds.S +++ b/arch/mn10300/kernel/vmlinux.lds.S | |||
@@ -38,14 +38,10 @@ SECTIONS | |||
38 | 38 | ||
39 | _etext = .; /* End of text section */ | 39 | _etext = .; /* End of text section */ |
40 | 40 | ||
41 | . = ALIGN(16); /* Exception table */ | 41 | EXCEPTION_TABLE(16) |
42 | __start___ex_table = .; | ||
43 | __ex_table : { *(__ex_table) } | ||
44 | __stop___ex_table = .; | ||
45 | |||
46 | BUG_TABLE | 42 | BUG_TABLE |
47 | 43 | ||
48 | RODATA | 44 | RO_DATA(PAGE_SIZE) |
49 | 45 | ||
50 | /* writeable */ | 46 | /* writeable */ |
51 | .data : { /* Data */ | 47 | .data : { /* Data */ |
@@ -53,27 +49,19 @@ SECTIONS | |||
53 | CONSTRUCTORS | 49 | CONSTRUCTORS |
54 | } | 50 | } |
55 | 51 | ||
56 | . = ALIGN(PAGE_SIZE); | 52 | .data_nosave : { NOSAVE_DATA; } |
57 | __nosave_begin = .; | ||
58 | .data_nosave : { *(.data.nosave) } | ||
59 | . = ALIGN(PAGE_SIZE); | ||
60 | __nosave_end = .; | ||
61 | |||
62 | . = ALIGN(PAGE_SIZE); | ||
63 | .data.page_aligned : { *(.data.idt) } | ||
64 | 53 | ||
65 | . = ALIGN(32); | 54 | .data.page_aligned : { PAGE_ALIGNED_DATA(PAGE_SIZE); } |
66 | .data.cacheline_aligned : { *(.data.cacheline_aligned) } | 55 | .data.cacheline_aligned : { CACHELINE_ALIGNED_DATA(32); } |
67 | 56 | ||
68 | /* rarely changed data like cpu maps */ | 57 | /* rarely changed data like cpu maps */ |
69 | . = ALIGN(32); | 58 | . = ALIGN(32); |
70 | .data.read_mostly : AT(ADDR(.data.read_mostly)) { | 59 | .data.read_mostly : AT(ADDR(.data.read_mostly)) { |
71 | *(.data.read_mostly) | 60 | READ_MOSTLY_DATA(32); |
72 | _edata = .; /* End of data section */ | 61 | _edata = .; /* End of data section */ |
73 | } | 62 | } |
74 | 63 | ||
75 | . = ALIGN(THREAD_SIZE); /* init_task */ | 64 | .data.init_task : { INIT_TASK(THREAD_SIZE); } |
76 | .data.init_task : { *(.data.init_task) } | ||
77 | 65 | ||
78 | /* might get freed after init */ | 66 | /* might get freed after init */ |
79 | . = ALIGN(PAGE_SIZE); | 67 | . = ALIGN(PAGE_SIZE); |
@@ -88,23 +76,18 @@ SECTIONS | |||
88 | __init_begin = .; | 76 | __init_begin = .; |
89 | .init.text : { | 77 | .init.text : { |
90 | _sinittext = .; | 78 | _sinittext = .; |
91 | *(.init.text) | 79 | INIT_TEXT; |
92 | _einittext = .; | 80 | _einittext = .; |
93 | } | 81 | } |
94 | .init.data : { *(.init.data) } | 82 | .init.data : { INIT_DATA; } |
95 | . = ALIGN(16); | 83 | .setup.init : { INIT_SETUP(16); } |
96 | __setup_start = .; | ||
97 | .setup.init : { KEEP(*(.init.setup)) } | ||
98 | __setup_end = .; | ||
99 | 84 | ||
100 | __initcall_start = .; | 85 | __initcall_start = .; |
101 | .initcall.init : { | 86 | .initcall.init : { |
102 | INITCALLS | 87 | INITCALLS |
103 | } | 88 | } |
104 | __initcall_end = .; | 89 | __initcall_end = .; |
105 | __con_initcall_start = .; | 90 | .con_initcall.init : { CON_INITCALL; } |
106 | .con_initcall.init : { *(.con_initcall.init) } | ||
107 | __con_initcall_end = .; | ||
108 | 91 | ||
109 | SECURITY_INIT | 92 | SECURITY_INIT |
110 | . = ALIGN(4); | 93 | . = ALIGN(4); |
@@ -114,28 +97,17 @@ SECTIONS | |||
114 | .altinstr_replacement : { *(.altinstr_replacement) } | 97 | .altinstr_replacement : { *(.altinstr_replacement) } |
115 | /* .exit.text is discard at runtime, not link time, to deal with references | 98 | /* .exit.text is discard at runtime, not link time, to deal with references |
116 | from .altinstructions and .eh_frame */ | 99 | from .altinstructions and .eh_frame */ |
117 | .exit.text : { *(.exit.text) } | 100 | .exit.text : { EXIT_TEXT; } |
118 | .exit.data : { *(.exit.data) } | 101 | .exit.data : { EXIT_DATA; } |
119 | 102 | ||
120 | #ifdef CONFIG_BLK_DEV_INITRD | 103 | .init.ramfs : { INIT_RAM_FS; } |
121 | . = ALIGN(PAGE_SIZE); | ||
122 | __initramfs_start = .; | ||
123 | .init.ramfs : { *(.init.ramfs) } | ||
124 | __initramfs_end = .; | ||
125 | #endif | ||
126 | 104 | ||
127 | PERCPU(32) | 105 | PERCPU(32) |
128 | . = ALIGN(PAGE_SIZE); | 106 | . = ALIGN(PAGE_SIZE); |
129 | __init_end = .; | 107 | __init_end = .; |
130 | /* freed after init ends here */ | 108 | /* freed after init ends here */ |
131 | 109 | ||
132 | __bss_start = .; /* BSS */ | 110 | BSS(4) |
133 | .bss : { | ||
134 | *(.bss.page_aligned) | ||
135 | *(.bss) | ||
136 | } | ||
137 | . = ALIGN(4); | ||
138 | __bss_stop = .; | ||
139 | 111 | ||
140 | _end = . ; | 112 | _end = . ; |
141 | 113 | ||
@@ -145,7 +117,7 @@ SECTIONS | |||
145 | 117 | ||
146 | /* Sections to be discarded */ | 118 | /* Sections to be discarded */ |
147 | /DISCARD/ : { | 119 | /DISCARD/ : { |
148 | *(.exitcall.exit) | 120 | EXIT_CALL |
149 | } | 121 | } |
150 | 122 | ||
151 | STABS_DEBUG | 123 | STABS_DEBUG |