News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Feature suggestion for the GoLink linker

Started by Ben321, July 12, 2020, 09:45:40 PM

Previous topic - Next topic

Ben321

I emailed the author of the Go tools with this suggestion, but I've not heard back from him yet. I don't even know if he checks his email, so I'm posting the suggestion here now, hoping he reads it.

I would like to see the ability to override default section flags in the output file, for example setting the ".text" section of an EXE file to not be read-only. This would allow for making self-modifying EXEs or DLLs. I propose the following commandline switches for GoLink.

/sar (section allow read)
/sdr (section disallow read)
/saw (section allow write)
/sdw (section disallow write)
/scw (section copy on write)
/sae (section allow execution)
/sde (section disallow execution)

The format would be the switch, followed by the section name (which is case sensitive, if I'm not mistaken).
For example, if you wanted to allow writing to the code section (called .text), you would use the command line switch as below.
/saw .text

Vortex

Hello,

As a quick solution : MS Link coming with the Masm32 installation is providing the section modification capability :

C:\masm32\bin>link.exe /? | findstr "SECTION"
      /SECTION:name,[E][R][W][S][D][K][L][P][X]


https://docs.microsoft.com/en-us/cpp/build/reference/section-specify-section-attributes?view=vs-2015