Hardcoded filepaths in compiled exe
Raikia
raikiasec at gmail.com
Tue Dec 29 16:13:53 UTC 2020
Hey all,
I'm trying to compile a release-level binary but it looks like
the resulting executable has metadata in it that I would like to
avoid. I've tried using both LDC and DMD with the below commands
(I've tried many variations of them, you can see the switches are
in an attempt to remove this problem):
dmd -m64 -O -J. -release -inline -boundscheck=off
-L/SUBSYSTEM:WINDOWS -L/ENTRY:mainCRTStartup .\program.d
and
ldc2.exe --link-internally -O --boundscheck=off --o- --release
--relocation-model=pic --static .\program.d
However, after doing those, if you look at the strings in the
compiled exe, you'll see things like:
$ strings -a program.exe | grep 'dmd2'
C:\D\dmd2\windows\bin\..\..\src\phobos\std\file.d
C:\D\dmd2\windows\bin\..\..\src\phobos\std\utf.d
C:\D\dmd2\windows\bin\..\..\src\phobos\std\base64.d
This problem is more egregious when I am using a home folder,
like "C:\Users\<my name>\" instead of "C:\D\". Am I missing
something? Is there a way to compile D without leaking metadata
like this in a production release binary?
More information about the Digitalmars-d-learn
mailing list