https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7748
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Yes moving the attrribute fixed the issue. Note a few other things: * I needed to add -fPIC to the command line while building the shared libraries. * I needed to add -Wl,--no-as-needed while linking the executable due to Ubuntu's gcc defaulting to --as-needed. Other than that, it seems like it works and seems to have worked since GCC 4 or earlier.