Providing your own version of FOO
You would like to provide an optimized version of function FOO for your target.
The following constraints hold:
- The new version is compatible with the old (no versioning required)
- You are providing function FOO for all targets that use directory BAR
In glibc the canonical target selects a directory, we call it BAR, which is used as a suffix when building a a list of all the system dependency directories to search.
For example, the canonical target "hppa-linux-gnu" selects the directory "hppa", and searches all the "hppa" sysdep directories.
See http://www.gnu.org/software/libc/manual/html_node/Porting.html#Porting for more information.
The default implementation of function FOO exists as a C file, assembly file, or auto-generated syscall stub, named FOO.c or FOO.S or a line in a syscalls.list. These files are somewhere in one of the sysdep directories.
The sysdep directories are searched in order, and the target specific directories are searched first. This allows the target to override the default FOO with their own implementation.
To override FOO simply provide a FOO.c or FOO.s or syscalls.list in the early system dependency directories for the target.
The directories under sysdeps/BAR/ are used for OS independent functions.
The directories under sysdep/unix/sysv/linux/BAR/ are used for Linux dependent functions.
For example if your newly implemented memcpy uses a Linux syscall then it goes in the latter, otherwise the former.
- The generic memcpy.c exists in "string/memcpy.c"
- The target-specific memcpy could exist in "ports/sysdeps/BAR/memcpy.[cS]"
Be aware that each sysdep directory has it's own configure and therefore may carry some intelligence, and could possibly do things differently.