Hi shaka,
Welcome to the forum.
It's easy to add a relocation to a PE file. All you need to do is to specify the /FIXED:NO linker switch :
In Pelles IDE, follow the path Project -> Options -> Macros and edit
LINKFLAGS :
-subsystem:windows -machine:x86 -fixed:no kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp.lib
Attached is a quick example built with the relocation section.
podump.exe /HEADERS Window.exe
SECTION #4
.reloc name
20C virtual size
5000 virtual address (00405000 to 0040520B)
400 size of raw data
2600 offset to raw data
0 offset to relocation table
0 offset to line numbers
0 number of relocations
0 number of line numbers
42000040 characteristics:
Initialized data
Memory discardable
Memory read
SUMMARY
1000 .data
1000 .rdata
1000 .reloc
2000 .text
You cannot use directly tlink.exe with Pelles tools as it does not support the MS COFF format used by Pelles development suit.
To convert between MS COFF and OMF, you need a tool like Agner Fog's
Object file converter