[fpc-devel] OS aware RTL proposal

Marco van de Voort marcov at stack.nl
Fri Mar 10 09:00:13 CET 2006

> http://www.freepascal.org/wiki/index.php/OS_aware_RTL
> Tell me what you think

First: only Linux has the main problem. BSD never renumbers ABI calls, newer
abi calls have a different prototype.

>The pros:

>    * ABI compatible binaries

As long as only syscall nrs change. This rarely happens. Usually something
gets 64-bit, or has an extra param, or different structure etc.

>    * Fixes certain future problems (epoll/FPC_USE_LIBC)

That is a nice trick, but IMHO only important for that hand full of
"problematic" calls that are urgently needed but recently added.

>    * It would be just cool since FPC would be the only compiler with proper
>	ABI compat. on linux 

ABI compat is way more than using the right syscall nrs.

>The cons:

>    * Overhead both memory and CPU (initialization slows down, smartlinking
>would be useless on these things)
>    * Detection of OS version is more than tricky even with standardized
>POSIX.1 functions like uname 

* more complicated, thus more bugprone.
* case that this (except libc trick) actually saves anybody is IMHO near
* All binary compability must be prepared in the binaries that go onto the
field. That makes them legacy binaries anyway.

So in short: yes, some of the techniques are usefull if there indeed is such
huge problem with dynlinking, that can't be solved with some form of
lazy linking. 

But the workaround should be kept to those functions _only_, and only if
there is a real chance that anything actually might go wrong.

More information about the fpc-devel mailing list