Attached is simple reproducer that works on Mac with:
s1038899:~ kbelco$ icpc --version
icpc (ICC) 19.1.3 20200925
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
but fails on Linux with Intel 19.1.4
The name mangling is different, you get the leading underscore on the Mac which is correct but on Linux you don't get the leading underscore.
I have to inline the source code since the attachment is rejected.
#include "junk.hpp"
int foo(char*) {
return 0;
}
void foo2(char*) {
}
int main(int, char**) {
return 0;
}
Here's the Mac output:
s1038899:~ kbelco$ nm a.out | grep -i foo
0000000100000c10 T _foo
0000000100000c20 T _foo2
Here's the Linux output:
-bash-4.2$ nm a.out | grep -i foo
0000000000400c40 T foo
0000000000400c50 T foo2
Link Copied
Hi,
Thank you for reaching out. We’ll check it and get back to you.
Regards
Gopika Ajit
Hi,
Thank you for reaching out. We’ll check it and get back to you.
Regards
Gopika Ajit
On Linux, it needs to be compatible with Gnu. If icpc generated _foo symbol, then there would be an "undefined reference to foo" when you try to link mix objects (compile with icpc/g++).
Thanks,
For more complete information about compiler optimizations, see our Optimization Notice.