If the user provides an ELF file that's been linked to a wrong address, we try to load it, fails, and keep going silently. Instead, Display a warning instead, but keep going to not disrupt users accidentally relying on this 'continues-anyway' behaviour.
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- hw/core/loader.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index b3c4a654b45..37a2f2c4959 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -1147,8 +1147,16 @@ static void rom_reset(void *unused) void *host = memory_region_get_ram_ptr(rom->mr); memcpy(host, rom->data, rom->datasize); } else { - address_space_write_rom(rom->as, rom->addr, MEMTXATTRS_UNSPECIFIED, - rom->data, rom->datasize); + MemTxResult res; + + res = address_space_write_rom(rom->as, rom->addr, + MEMTXATTRS_UNSPECIFIED, + rom->data, rom->datasize); + if (res != MEMTX_OK) { + warn_report("rom: unable to write data (file '%s', " + "addr=0x" TARGET_FMT_plx ", size=0x%zu)", + rom->name, rom->addr, rom->datasize); + } } if (rom->isrom) { /* rom needs to be written only once */ -- 2.26.3