How to avoid STT_GNU_IFUNC symbols in your binary?

In general, UNIX systems support backward binary compatibility (a binary built on an old machine continues to run on a newer one), but not the reverse. You can’t expect a binary built on a new system to run on an older one. STT_GNU_IFUNC is only the first of many problems you’ll encounter.

If you need to build a binary on a newer machine that will run on an older one, see this document.

There used to be “apgcc: A GCC wrapper to make portable binaries” that made this easy (it’s referenced from above), but it appears to be gone ;-(

The easiest option is to build on an old machine (I used to build on RedHat 6.2, and the resulting binary ran everywhere). You don’t have to actually run RH-6.2 on a physical machine, just bring it up in a VM.

The other relatively easy option is to build in a chroot, again using tools and libraries from an old distribution (e.g. RH-6.2).

Leave a Comment