aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/module.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-11-25 18:14:08 -0500
committerJiri Kosina <jkosina@suse.cz>2015-12-04 16:46:25 -0500
commit7523e4dc5057e157212b4741abd6256e03404cf1 (patch)
tree034014d98dea3f675e8e138bc34bd4e0a860b12b /arch/s390/kernel/module.c
parentc65abf358f211c3f88c8ed714dff25775ab49fc1 (diff)
module: use a structure to encapsulate layout.
Makes it easier to handle init vs core cleanly, though the change is fairly invasive across random architectures. It simplifies the rbtree code immediately, however, while keeping the core data together in the same cachline (now iff the rbtree code is enabled). Acked-by: Peter Zijlstra <peterz@infradead.org> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'arch/s390/kernel/module.c')
-rw-r--r--arch/s390/kernel/module.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index 0c1a679314dd..7873e171457c 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -159,11 +159,11 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
159 159
160 /* Increase core size by size of got & plt and set start 160 /* Increase core size by size of got & plt and set start
161 offsets for got and plt. */ 161 offsets for got and plt. */
162 me->core_size = ALIGN(me->core_size, 4); 162 me->core_layout.size = ALIGN(me->core_layout.size, 4);
163 me->arch.got_offset = me->core_size; 163 me->arch.got_offset = me->core_layout.size;
164 me->core_size += me->arch.got_size; 164 me->core_layout.size += me->arch.got_size;
165 me->arch.plt_offset = me->core_size; 165 me->arch.plt_offset = me->core_layout.size;
166 me->core_size += me->arch.plt_size; 166 me->core_layout.size += me->arch.plt_size;
167 return 0; 167 return 0;
168} 168}
169 169
@@ -279,7 +279,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
279 if (info->got_initialized == 0) { 279 if (info->got_initialized == 0) {
280 Elf_Addr *gotent; 280 Elf_Addr *gotent;
281 281
282 gotent = me->module_core + me->arch.got_offset + 282 gotent = me->core_layout.base + me->arch.got_offset +
283 info->got_offset; 283 info->got_offset;
284 *gotent = val; 284 *gotent = val;
285 info->got_initialized = 1; 285 info->got_initialized = 1;
@@ -302,7 +302,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
302 rc = apply_rela_bits(loc, val, 0, 64, 0); 302 rc = apply_rela_bits(loc, val, 0, 64, 0);
303 else if (r_type == R_390_GOTENT || 303 else if (r_type == R_390_GOTENT ||
304 r_type == R_390_GOTPLTENT) { 304 r_type == R_390_GOTPLTENT) {
305 val += (Elf_Addr) me->module_core - loc; 305 val += (Elf_Addr) me->core_layout.base - loc;
306 rc = apply_rela_bits(loc, val, 1, 32, 1); 306 rc = apply_rela_bits(loc, val, 1, 32, 1);
307 } 307 }
308 break; 308 break;
@@ -315,7 +315,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
315 case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ 315 case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */
316 if (info->plt_initialized == 0) { 316 if (info->plt_initialized == 0) {
317 unsigned int *ip; 317 unsigned int *ip;
318 ip = me->module_core + me->arch.plt_offset + 318 ip = me->core_layout.base + me->arch.plt_offset +
319 info->plt_offset; 319 info->plt_offset;
320 ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */ 320 ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */
321 ip[1] = 0x100a0004; 321 ip[1] = 0x100a0004;
@@ -334,7 +334,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
334 val - loc + 0xffffUL < 0x1ffffeUL) || 334 val - loc + 0xffffUL < 0x1ffffeUL) ||
335 (r_type == R_390_PLT32DBL && 335 (r_type == R_390_PLT32DBL &&
336 val - loc + 0xffffffffULL < 0x1fffffffeULL))) 336 val - loc + 0xffffffffULL < 0x1fffffffeULL)))
337 val = (Elf_Addr) me->module_core + 337 val = (Elf_Addr) me->core_layout.base +
338 me->arch.plt_offset + 338 me->arch.plt_offset +
339 info->plt_offset; 339 info->plt_offset;
340 val += rela->r_addend - loc; 340 val += rela->r_addend - loc;
@@ -356,7 +356,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
356 case R_390_GOTOFF32: /* 32 bit offset to GOT. */ 356 case R_390_GOTOFF32: /* 32 bit offset to GOT. */
357 case R_390_GOTOFF64: /* 64 bit offset to GOT. */ 357 case R_390_GOTOFF64: /* 64 bit offset to GOT. */
358 val = val + rela->r_addend - 358 val = val + rela->r_addend -
359 ((Elf_Addr) me->module_core + me->arch.got_offset); 359 ((Elf_Addr) me->core_layout.base + me->arch.got_offset);
360 if (r_type == R_390_GOTOFF16) 360 if (r_type == R_390_GOTOFF16)
361 rc = apply_rela_bits(loc, val, 0, 16, 0); 361 rc = apply_rela_bits(loc, val, 0, 16, 0);
362 else if (r_type == R_390_GOTOFF32) 362 else if (r_type == R_390_GOTOFF32)
@@ -366,7 +366,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
366 break; 366 break;
367 case R_390_GOTPC: /* 32 bit PC relative offset to GOT. */ 367 case R_390_GOTPC: /* 32 bit PC relative offset to GOT. */
368 case R_390_GOTPCDBL: /* 32 bit PC rel. off. to GOT shifted by 1. */ 368 case R_390_GOTPCDBL: /* 32 bit PC rel. off. to GOT shifted by 1. */
369 val = (Elf_Addr) me->module_core + me->arch.got_offset + 369 val = (Elf_Addr) me->core_layout.base + me->arch.got_offset +
370 rela->r_addend - loc; 370 rela->r_addend - loc;
371 if (r_type == R_390_GOTPC) 371 if (r_type == R_390_GOTPC)
372 rc = apply_rela_bits(loc, val, 1, 32, 0); 372 rc = apply_rela_bits(loc, val, 1, 32, 0);