Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Remove filenames from compiled binary.

Mysticial
Beginner
419 Views

When using ICX to link .asm files with /Zi, all the filenames are embedded into binary in plain-text.

 

Given a simple project:

  • Main.asm
  • Test.asm

I link them as follows:

icx *.asm -Zi

It produces a binary, "Main.exe". But at the end of the binary, the original filenames are visible in plain text.

image.png

 

How do I remove these filenames while still producing a working .pdb file?

Other Observations:

  • This does not happen if I compile source files directly into a binary (without a separate linking step).
  • If I rename all the .asm files prior to linking, the resulting .pdb file still works. Thus proving that the filenames are not needed.
  • If I omit the `-Zi` flag, the filenames no longer appear. But this also disables the .pdb file which I need.

 

Is there there a compiler flag that will omit the filenames in the binary? Or is the only option to obfuscate the filenames prior to linking? (or perhaps post-compilation binary-modification to overwrite those filenames)

 

 

 

0 Kudos
5 Replies
Alex_Y_Intel
Moderator
303 Views

By using the Microsoft compiler cl, the file names are also in the executable (binary) file. Have you ever seen that the file names are completed omitted under any circumstances ? 

 

0 Kudos
Mysticial
Beginner
298 Views

I don't see it with MSVC (17.7.1). But those use .obj instead of .asm, not sure if that matters.

cl *.obj /PDB:"program.pdb" /OUT:"program.exe"

 No filenames in the binary. (Not the exact flags, there are more of them.)

0 Kudos
Alex_Y_Intel
Moderator
293 Views

C:\Users\ayu1\Project14>cl /Zi main.obj test.obj
Microsoft (R) C/C++ Optimizing Compiler Version 19.39.33523 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.39.33523.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:main.exe
/debug
main.obj
test.obj

 

And when main.exe is checked: 

Alex_Y_Intel_0-1717719304191.png

Can you please clarify your question by supplying a reproducer and exact commands used to demonstrate your issue? And please clearly indicate that which file you'd like to omit the file names. 

 

 

0 Kudos
Mysticial
Beginner
286 Views

ICX Version: 2024.1.0 Build 20240308

 

Main.cpp

#include <iostream>
using namespace std;

int test();

int main(){
    cout << "hello world" << endl;
    test();
}

Test.cpp

#include <iostream>
using namespace std;


int test(){
    cout << "hello world" << endl;
    return 0;
}

 

Compilation steps:

icx *.cpp /S
icx *.asm /Zi

 

The resulting "Main.exe" contains the names "Main.asm" and "Test.asm". I want both of these names omitted from the binary. In a larger proprietary project with many sensitive filenames, this will obviously leak too much IP (intellectual property).

The binary also contains the name "Main.pdb", but that's okay since it's just the name of the .pdb.

 

Again, this only happens with ICX on Windows. It doesn't happen with MSVC, or even ICX on Linux.

0 Kudos
Alex_Y_Intel
Moderator
239 Views

Thanks, I understood now. I'm escalating your issue to our internal engineer team and will come back with update. 

0 Kudos
Reply