aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
authorChaskiel Grundman <cg2v@andrew.cmu.edu>2005-09-09 16:01:54 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:30 -0400
commit69ac59647e66c1b53fb98fe8b6d0f2099cffad60 (patch)
tree6f748623905ac08850c6318583a3e17feabad377 /arch/alpha
parent092c948811359d8715790af0eedefc7dff1cd619 (diff)
[PATCH] alpha: process_reloc_for_got confuses r_offset and r_addend
arch/alpha/kernel/module.c:process_reloc_for_got(), which figures out how big the .got section for a module should be, appears to be confusing r_offset (the file offset that the relocation needs to be applied to) with r_addend (the offset of the relocation's actual target address from the address of the relocation's symbol). Because of this, one .got entry is allocated for each relocation instead of one each unique symbol/addend. In the module I am working with, this causes the .got section to be almost 10 times larger than it needs to be (75544 bytes instead of 7608 bytes). As the .got is accessed with global-pointer-relative instructions, it needs to be within the 64k gp "zone", and a 75544 byte .got clearly does not fit. The result of this is that relocation overflows are detected during module load and the load is aborted. Change struct got_entry/process_reloc_for_got to fix this. Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/kernel/module.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
index fc271e316a38..aac6d4b22f7a 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
@@ -47,7 +47,7 @@ module_free(struct module *mod, void *module_region)
47 47
48struct got_entry { 48struct got_entry {
49 struct got_entry *next; 49 struct got_entry *next;
50 Elf64_Addr r_offset; 50 Elf64_Sxword r_addend;
51 int got_offset; 51 int got_offset;
52}; 52};
53 53
@@ -57,14 +57,14 @@ process_reloc_for_got(Elf64_Rela *rela,
57{ 57{
58 unsigned long r_sym = ELF64_R_SYM (rela->r_info); 58 unsigned long r_sym = ELF64_R_SYM (rela->r_info);
59 unsigned long r_type = ELF64_R_TYPE (rela->r_info); 59 unsigned long r_type = ELF64_R_TYPE (rela->r_info);
60 Elf64_Addr r_offset = rela->r_offset; 60 Elf64_Sxword r_addend = rela->r_addend;
61 struct got_entry *g; 61 struct got_entry *g;
62 62
63 if (r_type != R_ALPHA_LITERAL) 63 if (r_type != R_ALPHA_LITERAL)
64 return; 64 return;
65 65
66 for (g = chains + r_sym; g ; g = g->next) 66 for (g = chains + r_sym; g ; g = g->next)
67 if (g->r_offset == r_offset) { 67 if (g->r_addend == r_addend) {
68 if (g->got_offset == 0) { 68 if (g->got_offset == 0) {
69 g->got_offset = *poffset; 69 g->got_offset = *poffset;
70 *poffset += 8; 70 *poffset += 8;
@@ -74,7 +74,7 @@ process_reloc_for_got(Elf64_Rela *rela,
74 74
75 g = kmalloc (sizeof (*g), GFP_KERNEL); 75 g = kmalloc (sizeof (*g), GFP_KERNEL);
76 g->next = chains[r_sym].next; 76 g->next = chains[r_sym].next;
77 g->r_offset = r_offset; 77 g->r_addend = r_addend;
78 g->got_offset = *poffset; 78 g->got_offset = *poffset;
79 *poffset += 8; 79 *poffset += 8;
80 chains[r_sym].next = g; 80 chains[r_sym].next = g;