Port Linker script to MSBuild link.exe

Teslik 20 Reputation points

I have done a lot of linker modifications under G++ using the ld linker scirpts. I am trying to figure out of there is a way to do something similar in windows. I thought about trying to do it in a def file, but I have had no luck. Specifically what I would like to do is create a new section in the PE file that will contain all the contents of an object file. I would like to do this without having to modify the source code. In a linux linker scirpt it is pretty easy:

     .newSection : {

This will create a new executable section and place all the executable code from the object file test.o into that section. How can I do this without modifying the source code?

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,907 questions
{count} votes

Accepted answer
  1. RLWA32 40,941 Reputation points

    You could use EDITBIN /SECTION Option to rename the section in an .obj file before it is processed by the linker. In a C++ project this could be done by using a Pre-Link Build Event. In order to do this the build cannot be using Link Time Code Generation.

    0 comments No comments

0 additional answers

Sort by: Most helpful