libctiny
libctiny copied to clipboard
Linker warning LNK4254
When linking projects with libctiny (or the "successor": minicrt.lib) you will get a linker warning: minicrt.lib(initterm.obj) : warning LNK4254: section '.CRT' (40000040) merged into '.data' (C0000040) with different atributes
I think the problem lies in "initterm.cc" #pragma comment(linker, "/merge:.CRT=.data")
As far as I understood this code handles constructor/destructor for constant objects. The section ".data" is considered read/write. When compiling other code with VS the ".CRT$XCA" sections are being put into a readonly section (".rdata"). This seems to cause the conflict and trigger the above warning.
In my build I changed the merge command to #pragma comment(linker, "/merge:.CRT=.rdata")
and the linker warning disappeared. Perhaps someone can verify, if my fix is valid and this can be added to the repo.