0

In C++ will the address of the symbols change or not when the code to be recompiled again?

What if the code is not changed?

What if I compile multi files simultaneously with make -jN? Will this cause a random order for the linking? Will this lead the address of symbols changes?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
jayatubi
  • 1,972
  • 1
  • 21
  • 51
  • If the correctness of your program depends on the answer either way, the program is incorrect. – Armen Tsirunyan Nov 13 '15 at 15:37
  • I've miss published an executable without stripping. It contains all the debug symbols which I don't want. I'm going to publish a new version with all the symbols stripped. I'm worried the old symbols could still be valid for the new executable. – jayatubi Nov 13 '15 at 15:38
  • @jayatubi did you do something illegal in your code? – Slava Nov 13 '15 at 15:39
  • @Slava no, It is a game and I just want to make the it's harder to be hacked for anti-cheating. – jayatubi Nov 13 '15 at 15:40
  • In my experience (one specific embedded compiler), recompiling does not change the symbol map one iota. Even if your compile in parallel, linking is single-threaded, probably unlikely to be dependent on compilation order or parallelism. I don't know if hosted compilers are in the habit of randomizing link addresses for security. – John Nov 13 '15 at 16:00
  • @John How about if I force change the order of the linking, for example randomize all the `.o` file names, if this is doable? – jayatubi Nov 13 '15 at 16:05
  • 1
    I suspect changing the order the .o files are listed for linking would work with gcc. You'll have to try it to be sure. I'm basing this off of how sensitive gcc is to .o order for resolving references. http://stackoverflow.com/questions/34732/how-do-i-list-the-symbols-in-a-so-file – John Nov 13 '15 at 23:37

0 Answers0