summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-11-18 14:59:49 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-11-18 14:59:49 +0000
commitccfbfdaf316506c9b378427d2bc5b19b67a1c0b4 (patch)
tree302c3693be39b1fb30803a2cb4401e146f8e49b0
parent4104a615e8d8ce3443cd4fce0a85f63c3e7d9d0d (diff)
downloadhaskell-ccfbfdaf316506c9b378427d2bc5b19b67a1c0b4.tar.gz
fix new warnings with gcc 4.6
-rw-r--r--rts/Linker.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index f5b90d41b9..43190416f1 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -4206,18 +4206,24 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
{
int j;
char *symbol = NULL;
- Elf_Addr targ;
Elf_Rela* rtab = (Elf_Rela*) (ehdrC + shdr[shnum].sh_offset);
Elf_Sym* stab;
char* strtab;
int nent = shdr[shnum].sh_size / sizeof(Elf_Rela);
- int target_shndx = shdr[shnum].sh_info;
int symtab_shndx = shdr[shnum].sh_link;
int strtab_shndx = shdr[symtab_shndx].sh_link;
+#if defined(DEBUG) || defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+ /* This #ifdef only serves to avoid unused-var warnings. */
+ Elf_Addr targ;
+ int target_shndx = shdr[shnum].sh_info;
+#endif
stab = (Elf_Sym*) (ehdrC + shdr[ symtab_shndx ].sh_offset);
strtab= (char*) (ehdrC + shdr[ strtab_shndx ].sh_offset);
+#if defined(DEBUG) || defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+ /* This #ifdef only serves to avoid set-but-not-used warnings */
targ = (Elf_Addr) (ehdrC + shdr[ target_shndx ].sh_offset);
+#endif
IF_DEBUG(linker,debugBelch( "relocations for section %d using symtab %d\n",
target_shndx, symtab_shndx ));
@@ -4226,12 +4232,14 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
/* This #ifdef only serves to avoid unused-var warnings. */
Elf_Addr offset = rtab[j].r_offset;
Elf_Addr P = targ + offset;
+ Elf_Addr A = rtab[j].r_addend;
+#endif
+#if defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
+ Elf_Addr value;
#endif
Elf_Addr info = rtab[j].r_info;
- Elf_Addr A = rtab[j].r_addend;
Elf_Addr S;
void* S_tmp;
- Elf_Addr value;
# if defined(sparc_HOST_ARCH)
Elf_Word* pP = (Elf_Word*)P;
Elf_Word w1, w2;
@@ -4286,7 +4294,9 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
(void*)P, (void*)S, (void*)A ));
/* checkProddableBlock ( oc, (void*)P ); */
+#if defined(sparc_HOST_ARCH) || defined(ia64_HOST_ARCH) || defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH)
value = S + A;
+#endif
switch (ELF_R_TYPE(info)) {
# if defined(sparc_HOST_ARCH)