summaryrefslogtreecommitdiff
path: root/rts/linker/Elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/linker/Elf.c')
-rw-r--r--rts/linker/Elf.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
index e81b97acfa..f2fd88f750 100644
--- a/rts/linker/Elf.c
+++ b/rts/linker/Elf.c
@@ -439,7 +439,7 @@ ocVerifyImage_ELF ( ObjectCode* oc )
if (!SECTION_INDEX_VALID(shdr[i].sh_link)) {
if (shdr[i].sh_link == SHN_UNDEF)
errorBelch("\n%s: relocation section #%d has no symbol table\n"
- "This object file has probably been fully striped. "
+ "This object file has probably been fully stripped. "
"Such files cannot be linked.\n",
oc->archiveMemberName ? oc->archiveMemberName : oc->fileName, i);
else
@@ -1097,6 +1097,7 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
switch (reloc_type) {
# ifdef i386_HOST_ARCH
+ case COMPAT_R_386_NONE: break;
case COMPAT_R_386_32: *pP = value; break;
case COMPAT_R_386_PC32: *pP = value - P; break;
# endif
@@ -1571,6 +1572,9 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
# endif
#if defined(x86_64_HOST_ARCH)
+ case COMPAT_R_X86_64_NONE:
+ break;
+
case COMPAT_R_X86_64_64:
*(Elf64_Xword *)P = value;
break;
@@ -1708,15 +1712,13 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
int
ocResolve_ELF ( ObjectCode* oc )
{
- int ok;
- Elf_Word i;
char* ehdrC = (char*)(oc->image);
Elf_Ehdr* ehdr = (Elf_Ehdr*) ehdrC;
Elf_Shdr* shdr = (Elf_Shdr*) (ehdrC + ehdr->e_shoff);
const Elf_Word shnum = elf_shnum(ehdr);
#if defined(SHN_XINDEX)
- Elf_Word* shndxTable = get_shndx_table(ehdr);
+ Elf_Word* shndxTable = get_shndx_table(ehdr);
#endif
/* resolve section symbols
@@ -1749,9 +1751,9 @@ ocResolve_ELF ( ObjectCode* oc )
Elf_Word secno = symbol->elf_sym->st_shndx;
#if defined(SHN_XINDEX)
if (secno == SHN_XINDEX) {
- ASSERT(shndxTable);
- secno = shndxTable[i];
- }
+ ASSERT(shndxTable);
+ secno = shndxTable[i];
+ }
#endif
ASSERT(symbol->elf_sym->st_name == 0);
ASSERT(symbol->elf_sym->st_value == 0);
@@ -1763,6 +1765,9 @@ ocResolve_ELF ( ObjectCode* oc )
#if defined(NEED_GOT)
if(fillGot( oc ))
return 0;
+ /* silence warnings */
+ (void) shnum;
+ (void) shdr;
#endif /* NEED_GOT */
#if defined(aarch64_HOST_ARCH)
@@ -1770,27 +1775,27 @@ ocResolve_ELF ( ObjectCode* oc )
if(relocateObjectCode( oc ))
return 0;
#else
- /* Process the relocation sections. */
- for (i = 0; i < shnum; i++) {
- if (shdr[i].sh_type == SHT_REL) {
- ok = do_Elf_Rel_relocations ( oc, ehdrC, shdr, i );
- if (!ok)
- return ok;
- }
- else
- if (shdr[i].sh_type == SHT_RELA) {
- ok = do_Elf_Rela_relocations ( oc, ehdrC, shdr, i );
- if (!ok)
- return ok;
- }
- }
+ /* Process the relocation sections. */
+ for (Elf_Word i = 0; i < shnum; i++) {
+ if (shdr[i].sh_type == SHT_REL) {
+ bool ok = do_Elf_Rel_relocations ( oc, ehdrC, shdr, i );
+ if (!ok)
+ return ok;
+ }
+ else
+ if (shdr[i].sh_type == SHT_RELA) {
+ bool ok = do_Elf_Rela_relocations ( oc, ehdrC, shdr, i );
+ if (!ok)
+ return ok;
+ }
+ }
#endif
#if defined(powerpc_HOST_ARCH)
- ocFlushInstructionCache( oc );
+ ocFlushInstructionCache( oc );
#endif
- return 1;
+ return 1;
}
int ocRunInit_ELF( ObjectCode *oc )