unsigned long offset, struct symbol *sym,
                                    s64 addend, unsigned int type)
 {
-       struct reloc *reloc;
+       struct reloc *reloc, empty = { 0 };
 
        if (reloc_idx >= rsec->sh.sh_size / elf_rela_size(elf)) {
                WARN("%s: bad reloc_idx %u for %s with size 0x%lx",
                return NULL;
        }
 
-       reloc = malloc(sizeof(*reloc));
-       if (!reloc) {
-               perror("malloc");
+       reloc = &rsec->reloc_data[reloc_idx];
+
+       if (memcmp(reloc, &empty, sizeof(empty))) {
+               WARN("%s: %s: reloc %d already initialized!",
+                    __func__, rsec->name, reloc_idx);
                return NULL;
        }
-       memset(reloc, 0, sizeof(*reloc));
 
        reloc->idx = reloc_idx;
        reloc->sec = rsec;
        rsec->sh.sh_info = sec->idx;
        rsec->sh.sh_flags = SHF_INFO_LINK;
 
+       rsec->reloc_data = calloc(rsec->sh.sh_size / rsec->sh.sh_entsize,
+                                 sizeof(struct reloc));
+       if (!rsec->reloc_data) {
+               perror("calloc");
+               return NULL;
+       }
+
        sec->rsec = rsec;
        rsec->base = sec;