ICC 184.108.40.20600925 seem to use GNU linkonce section instead of COMMON section for `__gxx_personality_v0` function.
GNU linkonce is a old way to do so-called "vague linking", and COMDAT superseded it very long ago.
`__gxx_personality_v0` is a function used by the C++ runtime to handle exceptions. That function is provided by libc.
If you use a linker that doesn't support GNU linkonce (such as LLVM lld or mold) to statically-link ICC-generated object files with GCC-generated object files, you'll get a duplicate symbol error for `__gxx_personality_v0` because the linker fails to de-duplicate symbols.
I believe ICC generate COMDAT sections most of the time. `__gxx_personality_v0` is an exception in which ICC for some reason generate a GNU linkonce section. There might be legacy code in ICC which is used only for `__gxx_personality_v0`.
My question is, is there any reason to stick with GNU linkonce? Can ICC always generate COMDAT?
Thank you for posting on Intel Communities.
You could use "ffunction-sections" optimization option which places each function in its own COMDAT section. By default it's in "OFF" state.
Please refer below link for help regarding "ffunction-sections" compiler option.
Regrets for inconvenience caused regarding the difference in understanding. We are looking into your mentioned issue. We will get back to you soon.
Can you tell us the OS, gcc version you have?
Does this issue occur with the latest ICC 2021.5 ( in oneAPI2022.1.2 HPC toolkits)?
Would you also provide a reproducer and steps to show a "duplicate symbol error for gxx_personality_v0?
You can no longer produce the duplicate symbol error because I made a change to the mold linker to ignore ICC-generated .gnu.linkonce.d sections.
Here is a bug: https://github.com/rui314/mold/issues/271
So, searchbv.cpp.o in libsse_icc.a uses .gnu.linkonce instead of COMDAT. As I wrote in the first post, the use of .gnu.linkonce is effectively deprecated and major tools have migrated to COMDAT more than a decade ago. I want ICC to also stop producing .gnu.linkonce sections and instead use COMDAT.
I followed your github link, but don't see any test case to reproduce it.
Does this issue occur with ICC2021.5?
AFAIK, we don't support other linkers (llvm lld, mold) to link objects built with icc/icpc.