linux(4): Fix gcc buld.
gcc failed as it didn't inlined the builtins and generates calls to the libgcc, ld can't find libgcc as cross-toolchain libgcc is not installed. To avoid this add internal vDSO ffs functions without optimized builtins. Reported by: jhb MFC after: 2 weeks
This commit is contained in:
parent
272144ab41
commit
f337940144
@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/vdso.h>
|
||||
#undef _KERNEL
|
||||
#include <stdbool.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <machine/atomic.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/vdso.h>
|
||||
#undef _KERNEL
|
||||
#include <stdbool.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <machine/atomic.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/vdso.h>
|
||||
#undef _KERNEL
|
||||
#include <stdbool.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <machine/atomic.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
@ -26,6 +26,40 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
static int
|
||||
fls(int mask)
|
||||
{
|
||||
|
||||
if (mask == 0)
|
||||
return (0);
|
||||
return ((__builtin_clz(mask) ^ 0x1f) + 1);
|
||||
}
|
||||
|
||||
#ifdef _LP64
|
||||
static int
|
||||
ffsl(long mask)
|
||||
{
|
||||
int bit;
|
||||
|
||||
if (mask == 0)
|
||||
return (0);
|
||||
for (bit = 1; !(mask & 1); bit++)
|
||||
mask = (unsigned long)mask >> 1;
|
||||
return (bit);
|
||||
}
|
||||
#else
|
||||
static int
|
||||
ffsll(long long mask)
|
||||
{
|
||||
int bit;
|
||||
|
||||
if (mask == 0)
|
||||
return (0);
|
||||
for (bit = 1; !(mask & 1); bit++)
|
||||
mask = (unsigned long long)mask >> 1;
|
||||
return (bit);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
__vdso_native_to_linux_timespec(struct l_timespec *lts,
|
||||
|
@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/vdso.h>
|
||||
#undef _KERNEL
|
||||
#include <stdbool.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <machine/atomic.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
Loading…
Reference in New Issue
Block a user