Open sport-climber opened 2 years ago
possibly related or similar to https://github.com/msys2/MSYS2-packages/issues/2966
possibly related or similar to msys2/MSYS2-packages#2966
I don't think so, the linked issue fails during the linking process.
My issue is a little different in that the code compiles and links successfully but crashes with a segfault when the code is run on the line for strncpy.
The problem I'm having is building and linking against a library that I'm doing unit test on. This previously worked in msys2 for many years (though a previous release broke it in the same way and was subsequently fixed). The problem I'm observing is that some standard lib functions are not linking correctly into my application if used in the library under test. However, if the unit tests use that same function then it links correctly. The failure is repeatable on multiple computer.
The following tools are used:
I've attached a simple project to illustrate the issue. The interesting thing is that the linking fails when the strncpy() call is in the library being unit tested. However, if we add a call to strncpy() to the unit test then the linker finds it in the library and correctly links the test.
The code under tests is located in the source files of relevance are: ./msys2_gcc_v11_bug.c //Source below:
./unit_test/test-msys2_gcc_v11_bug.c // Test function - note #if 0 which allows the linking to operate correct if enabled
msys2_gcc_v11_bug.zip
So far I have traced the symbols using objdump at each stage of the compilation and noted that the symbols present and weak after the initial compile of the library under test. I've also recompiled and reinstalled CMake using the msys2 gcc v11 tool chain to see if that made any difference and it did not.