https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100851
--- Comment #4 from michaldrozd at protonmail dot ch --- PR 91737 seems similar enough to be related I've narrowed it down to the -Wl,-init functionality, if you comment out this lines it exits cleanly. https://github.com/eclipse/paho.mqtt.c/blob/master/src/CMakeLists.txt#L220 Interestingly enough if you edit the function https://github.com/eclipse/paho.mqtt.c/blob/master/src/MQTTClient.c#L119 to do absolutely nothing it still aborts, so it seems it's something with the init functionality itself, not this specific function