https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109217
Bug ID: 109217 Summary: failure statically linking shared lib Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc Assignee: unassigned at gcc dot gnu.org Reporter: stsp at users dot sourceforge.net Target Milestone: --- Use any dummy source like this: void foo(void) {} Then: $ cc -Wall -o libmain.so -shared main.c -static /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object /usr/bin/ld: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status