Skip to content

Can -mcmodel=small .map file be parsed to determine output binary file offsets of sections?

I recently changed my SRDisk build so it generates .s and .lst files for the gcc-ia16 compiled C source text files. These are then fed into my convlist.pl script to generate a .tls file (trace listing format expected by TracList).

Way back I asked about the gas listing file missing the relocation markers I wanted in its hexdumps: https://github.com/tkchia/gcc-ia16/issues/106 Later, I adapted an OMF processing tool to emit .rel relocation files to be fed into convlist.pl along with listing files. Recently I adapted this to the ELF files generated by gcc-ia16's gas, but I simply re-used the objdump --reloc output for this.

Now there's a question remaining: Looking at the gcc-ia16 linker's .map file I was unable to determine the section "bases" of the different sections. A base for convlist.pl allows to relate the trace listing hexdumps to their respective positions in the binary executable output file. For now, I made it so with a gcc .map file the bases end up as "unknown". These .tls files are still useful for some applications.

Here's an example .map file: https://pushbx.org/ecm/test/20250911/srdisk.map