Changeset View
Changeset View
Standalone View
Standalone View
share/man/man9/DEFINE_IFUNC.9
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | DEFINE_IFUNC(, size_t, strlen, (const char *)) | ||||
if (enabled && (cpu_features & CPUID_FAST_STRLEN) != 0) | if (enabled && (cpu_features & CPUID_FAST_STRLEN) != 0) | ||||
return (fast_strlen); | return (fast_strlen); | ||||
else | else | ||||
return (slow_strlen); | return (slow_strlen); | ||||
} | } | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
This defines a | This defines a | ||||
.Fn strlen | .Xr strlen 3 | ||||
function with an optimized implementation for CPUs that advertise support. | function with an optimized implementation for CPUs that advertise support. | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr elf 5 | .Xr elf 5 | ||||
.Sh NOTES | .Sh NOTES | ||||
ifuncs are not supported on all architectures. | ifuncs are not supported on all architectures. | ||||
They require both toolchain support, to emit function symbols of type | They require both toolchain support, to emit function symbols of type | ||||
.Dv STT_GNU_IFUNC , | .Dv STT_GNU_IFUNC , | ||||
and kernel linker support to invoke ifunc resolvers during boot or | and kernel linker support to invoke ifunc resolvers during boot or | ||||
during module load. | during module load. |