the necessary version number for each symbol can be extracted relatively easily from libc.so.6 using readelf.
Each FPC rtl interface declaration for glibc (i.e. FPC glibc header translations) must be used with a compatible symbol version in the glibc library. Is there confidence that all the FPC glibc interface declarations are API compatible with the "base" versions of the glibc symbols?
First: there is no specific glibc header. Multiple parts import symbols from libc in isolation in a cross *nix matter. That ranges from Linux,*BSD,OSX to AIX, Solaris to half *nixes like BeOS and in the past Netware-libc. This roughly follows header divisions in *libc too.
So the base RTL imports base calls like mmap,seek and read/write. (see rtl/unix/bunxh.inc) _IF_ it doesn't use syscalls, which are default. The socket units import socket related calls, the optional memory manager substitute imports malloc/free/realloc, one of several DNS resolves import libc, the Users package does the user and password stuff etc etc, unit DL manages dynamic library loading etc. There is no single unified glibc header, and those local declarations usually have a OS specific part for header parts with variation among OSes, and use *nix wide declarations for the rest, possibly even ifdefed for arch etc.
This is all to minimize maintenance and keep a bit of overview.
I expect no problems with the calls themselves. Symbol versioning would be more about fixating a certain version for a while (and cross distro) because FPC doesn't adapt automatically to different headers (with different structs, constants and macros). So the same build on an old Debian STABLE and the newest rolling ARCH can be seen as using the same headers etc, but linking to the same default symbol (_read, _write etc), whose version might differ between those distros.
For symbol versioning to improve anything, a debian old stable and a new a flashy distro would both have to implement exactly the same base subset. i.e. using the exact same definition of the STAT record/struct etc. Or adding some extra constant to an ORed set of values, or change the implementation of some macro.
But as said, nothing of this is proven. It is all theory. Something else might become the next bottleneck preventing cross distro binary generation like changes to startup code (libc initialization!), or linker changes. The problems are not even properly investigated even, it is all anecdotal. We don't even have proper knowledge about omitting the syscalls, even though that option exists for 19 years.
At this stage, interested users should do a long term test to see if any proposed changes or strategy really improve cross-distro compatibility for a longer term (e.g. release cycles). To ease that it would be wise to do a setup with minimal source changes to make it easier to rebase to trunk regularly. See my previous post.
Things like reordering all sources to specific OS-target combinations is out of the question. It is way to invasive for what it solves and hurts all *nixes for a Linux problem. Same with decorating all symbols in sources. As soon as multiple distros with differing base versions happen during some transition (and the 5+ year window that old LTSes die out), that is an mess.
A mapping file that works on the .o writing backend would be more logical, and could be switched in such cases.
A related, but separate question: Is there confidence that the behavior of the "base" version of the symbols is compatible with the way FPC expects it to behave?
See above. I don't really think it is detail behaviour of the call itself, but more pinning a certain version that match the translated headers definition, and less tension about what to do, update the header for newer distros, or keep it working with LTSes.
The base call prototypes themselves work across *nix mostly OSX, *BSD and Linux. But BSD usually saves compatibility breaks for major version transitions so this problem is easier to manage, and also has the seemless COMPAT mechanisms to keep binaries built on older binaries working on newer. (but the FPC BSD ports recently suffer from the LLVM transitions).
One could argue though that during a base version transition there should be simply two FPC releases to pick from.
Also who is going to manage all this long term, monitor the glibc lists to provide updates or alert on changes etc etc?