Author Topic: Must have feature - Renaming exports  (Read 22468 times)

Offline rickodesea

  • Jr. Member
  • *
  • Posts: 2
Must have feature - Renaming exports
« on: July 03, 2015, 03:40:15 AM »
I think NASM (even though Linker support is also required) should provide a feature to rename functions and variables.
For example, if we are importing c's printf, we could do something like:

extern _printf as _cprint

so, througout the remainder of the code, we refer to the name _cprint, which in turns, refer to executable snippet
that was under the name _printf.

However, I recognize the fact that for the functionality to work, a linker that supports the functionality is required.  In this case,
the linker would change the original name to the new one you set when it copies the object code, that the function or variable, is from into the PE, dll or static library file.

It would be the same for exports.

For example,

global myfunc as superfunc
The latter may not require much linker support.

PS:
The Netwide Assembler Team has made a great Assembler (NASM) and a great Disassembler (NDISASM); why
not also make a netwide linker? One, that's not only a great linker, but also do special things to support NASM special
functionalities.
 

Offline Cyrill Gorcunov

  • NASM Developer
  • Full Member
  • *****
  • Posts: 179
  • Country: 00
Re: Must have feature - Renaming exports
« Reply #1 on: July 04, 2015, 10:59:17 AM »
> extern _printf as _cprint

I believe you can use macros for that and define any aliases you like.

> why not also make a netwide linker

Because it's a lot of work. But we would happily accept contributions/patches.

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: Must have feature - Renaming exports
« Reply #2 on: July 04, 2015, 12:16:38 PM »
And is it possible to have a documentation of how nasm work (about source-code) and why not a guideline of source-code for a faster understanding = faster produce of contributions/patches.

Maybe the commentary of source-code can seem enough but, I have a little difficult to read them and make the link directly to other codes x)
« Last Edit: July 04, 2015, 12:21:40 PM by shaynox »

Offline Cyrill Gorcunov

  • NASM Developer
  • Full Member
  • *****
  • Posts: 179
  • Country: 00
Re: Must have feature - Renaming exports
« Reply #3 on: July 09, 2015, 05:49:05 PM »
Having docs about nasm internals is really a problem, for the very same reason -- lack of time. After all the code is changed all the time (well, novadays not frequently but still), so you'll have to read source code anyway.

You may build the nasm with debug info and run assmebling of some file under debugger so you'll see how code flows.