Author Topic: difficult to manage nasm map files  (Read 12042 times)

Offline duanev

  • Jr. Member
  • *
  • Posts: 4
difficult to manage nasm map files
« on: November 04, 2015, 05:42:51 PM »
Hello all, I've got a symbolic debugger that can use nasm map files (https://github.com/duanev/pgdb), but it looks like the only way to specify an output map file at the moment is via [map symbols xxx.map] inside the source file.  This makes build script management of map files a bit more onerous.  Is it possible to consider a nasm -m command line option in the future?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: difficult to manage nasm map files
« Reply #1 on: November 04, 2015, 08:17:00 PM »
Hi Duane,

I am nominally a "developer" since I have a couple trivial snips of code in Nasm. I never was a good C coder and am not currently active in development. I happen to know that the developers are very busy - have trouble even finding time fixing serious bugs. Don't hold your breath on this, at best.

As you know, "map" files are normally a product of the linker, not the assembler. Since in "-f bin" output format, Nasm acts as its own linker, it can make a "map" file. Options specific to an output format are generally done in the source code rather than on the command line. I think the situation is that the "interface" between modules is not well designed to do otherwise. I'm sure it's "possible"... but perhaps not "convenient". I'm thinking maybe considering a map file to be a "debug info format" might help? The "-g" switch? (silently ignored now I think)

The developer's list can be reached here:
https://lists.sourceforge.net/lists/listinfo/nasm-devel/
... although we can discus the idea further here as well...

(note: the "-M" option is in use)

Best,
Frank


Offline duanev

  • Jr. Member
  • *
  • Posts: 4
Re: difficult to manage nasm map files
« Reply #2 on: November 05, 2015, 01:59:45 AM »
Hey Frank, yes, the world does not need to stop for this one, and I do understand that linkers usually provide the map making this an even more esoteric feature - likely unworthy of a single letter command line option!  There also appear to be additional options for map files which may also need to be folded into the cmdline syntax, complicating things a bit more.  :/

Turns out that boot loaders and kernel images are %97 of my current use cases for nasm, and I use "-o fname" without a dot extension extensively (which I believe implies -f bin).  I recently found the BareMetalOS guys (https://github.com/ReturnInfinity) and see they are in the same boat, but so far don't use map or lst files at all.  This may change soon if I can get PGDB to work with their code  8)   so I just wanted to start the conversation.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: difficult to manage nasm map files
« Reply #3 on: November 05, 2015, 06:58:39 PM »
Quote
and I use "-o fname" without a dot extension extensively (which I believe implies -f bin).
Actually, the "-o" switch specifies the output name only. Using no "-f" switch at all defaults to "-f bin".  This confuses some people who start with "-o fname.com" and think they can change to an MZ executable with "-o fname.exe". Doesn't work, you still get a flat binary. The default output format can be easily changed by a define to the compiler - one of Julian's contributions, I think - but I don't think anyone does it ("-hf" puts a "*" next to the default, just to check). The output name from "-f bin" defaults to just "fname" so you don't need the "-o" switch at all do do that. Just "nasm fname.asm" will do it, but I like to use "nasm -f bin -o fname fname.asm" for clarity.

I haven't done anything with the interesting part, but just wanted to clear that up.

Best,
Frank