https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65134
--- Comment #1 from Ian Lance Taylor <ian at airs dot com> --- It's pretty ugly, but a workaround is to drop something like this into sub.go: var AlwaysFalse bool func init() { if AlwaysFalse { C.init() } } The idea is to force in something that refers to the function that the compiler and linker aren't smart enough to discard.