Lines Matching refs:reloc
84 struct RelocEntry *reloc;
85 size_t relocSize; // number of reloc entries
333 static void relocDiag(const struct NanoAppInfo *app, const struct RelocEntry *reloc, const char *msg)
335 size_t symIdx = reloc->info >> 8;
336 uint8_t symType = reloc->info;
338 ERR("Reloc %zu %s", reloc - app->reloc, msg);
340 ERR(" Where: 0x%08" PRIX32, reloc->where);
351 static uint8_t fixupReloc(struct NanoAppInfo *app, struct RelocEntry *reloc,
356 uint32_t relocOffset = reloc->where;
362 } else if (IS_IN_RAM(reloc->where)) {
363 relocOffset = reloc->where - RAM_BASE;
366 relocDiag(app, reloc, "is neither in RAM nor in FLASH");
373 relocDiag(app, reloc, "points outside valid data area");
377 switch (reloc->info & 0xFF) {
385 relocDiag(app, reloc, "has section relocation with non-zero symbol address");
391 relocDiag(app, reloc, "has unknown type");
443 app.reloc = (struct RelocEntry*)(buf + sect->rel_start - FLASH_BASE);
475 ERR("Failed to allocate a nano-reloc table\n");
480 struct RelocEntry *reloc = &app.reloc[i];
482 uint32_t relocType = reloc->info & 0xff;
483 uint32_t whichSym = reloc->info >> 8;
487 relocDiag(&app, reloc, "references a nonexistent symbol");
494 if (IS_IN_RANGE_E(reloc->where, sect->bss_start, sect->bss_end))
496 else if (IS_IN_RANGE_E(reloc->where, sect->data_start, sect->data_end))
498 else if (IS_IN_RANGE_E(reloc->where, sect->got_start, sect->got_end))
500 else if (IS_IN_RANGE_E(reloc->where, FLASH_BASE, FLASH_BASE + sizeof(struct BinHdr)))
505 DBG("Reloc[%3" PRIu32 "]:\n {@0x%08" PRIX32 ", type %3" PRIu32 ", -> sym[%3" PRIu32 "]: {@0x%08" PRIX32 "}, in %s}",
506 i, reloc->where, reloc->info & 0xff, whichSym, sym->addr, seg);
509 if (IS_IN_FLASH(reloc->where) && reloc->where - FLASH_BASE < sizeof(struct BinHdr) && relocType == RELOC_TYPE_SECT) {
517 switch (fixupReloc(&app, reloc, sym, NULL)) {
519 relocDiag(&app, reloc, "is in APPHDR but relocated to RAM");
529 DBG(" -> Nano reloc skipped for in-header reloc");
531 continue; /* do not produce an output reloc */
535 if (!IS_IN_RAM(reloc->where)) {
536 relocDiag(&app, reloc, "is not in RAM");
540 if (fixupReloc(&app, reloc, sym, nanoReloc) != NANO_RELOC_LAST) {
543 DBG(" -> Nano reloc calculated as 0x%08" PRIX32 ",0x%02" PRIX8 "\n", nanoReloc->ofstInRam, nanoReloc->type);