Search code examples
c++linuxgcclinkerlibc

Statically linking new libc symbols to use with a lower libc version


I have an app that uses eventfd and timerfd kernel syscalls. For that use you need a modern kernel and a libc that supports them, at least 2.8.

My current situation is, I have a system with the proper kernel but a 2.7.11 libc version which obviously does not support the required functions for the new syscalls.
But, as those 2 interfaces(timerfd,eventfd) are probably just a syscall call from the libc I was wondering if I could statically link the required symbols with a modern libc and then run the app on the 2.7.11 libc with the proper kernel.

As I see the statically linked functions will just execute the syscalls without using the libc and that would make them safe, but I might be overlooking other problems.

Anybody knows if this sounds feasible and how could I statically link just those functions?


Solution

  • It's probably more feasible to create your own conditionally-compiled versions that use syscall() to call them directly.