C90 compliance, except variadic macros and TODOs
[centaur.git] / src / modelops / relocate.c
index 90a319bd2a04ce80d5fffa2a7950fc3fea430445..eefed026c8ad16d3594b9f9bf4693001a6ee3941 100644 (file)
@@ -13,9 +13,9 @@ void elfu_mRelocate(ElfuElf *metarget, ElfuScn *mstarget, ElfuScn *msrt)
   assert(mstarget);
   assert(msrt);
 
-  ELFU_DEBUG("Relocating in section of type %d size %jx\n",
+  ELFU_DEBUG("Relocating in section of type %u size %x\n",
              mstarget->shdr.sh_type,
-             mstarget->shdr.sh_size);
+             (unsigned)mstarget->shdr.sh_size);
 
   CIRCLEQ_FOREACH(rel, &msrt->reltab.rels, elem) {
     Elf32_Word *dest32 = (Elf32_Word*)(((char*)(mstarget->data.d_buf)) + rel->offset);
@@ -41,12 +41,13 @@ void elfu_mRelocate(ElfuElf *metarget, ElfuScn *mstarget, ElfuScn *msrt)
           ELFU_DEBUG("Skipping relocation: Unknown type %d\n", rel->type);
       }
     } else if (metarget->elfclass == ELFCLASS64) {
-      /* x86-64 only uses RELA with explicit addend. */
-      assert(rel->addendUsed);
       Elf64_Word a64 = rel->addend;
       Elf64_Addr p64 = mstarget->shdr.sh_addr + rel->offset;
       Elf64_Addr s64 = elfu_mSymtabLookupVal(metarget, msrt->linkptr, rel->sym);
 
+      /* x86-64 only uses RELA with explicit addend. */
+      assert(rel->addendUsed);
+
       switch(rel->type) {
         case R_X86_64_NONE:
           ELFU_DEBUG("Skipping relocation: R_386_NONE\n");