commit: c99cffd412a041586e8a475bbb75212f3746ca1d
parent 43c67768e8b6655c9ae3276f3c2704181437bfea
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 11 Aug 2019 02:31:34 +0000
strace: Probe for __builtin_popcount
Diffstat:
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/pkg/strace/config.h b/pkg/strace/config.h
@@ -536,7 +536,7 @@
/* #undef HAVE_USTAT_H */
#define HAVE_UTIMENSAT 1
/* #undef HAVE__STATIC_ASSERT */
-#define HAVE___BUILTIN_POPCOUNT 1
+/* probe HAVE___BUILTIN_POPCOUNT */
#define HAVE___KERNEL_LONG_T 1
#define HAVE___KERNEL_ULONG_T 1
/* #undef HPPA */
diff --git a/pkg/strace/gen.lua b/pkg/strace/gen.lua
@@ -1,6 +1,5 @@
cflags{
'-D HAVE_CONFIG_H',
- '-I $dir',
-- it is important that the arch-specific directory is searched first
'-I $srcdir/linux/x86_64',
'-I $srcdir/linux',
@@ -8,6 +7,11 @@ cflags{
'-I $outdir',
}
+build('cat', '$outdir/config.h', {
+ '$builddir/probe/HAVE___BUILTIN_POPCOUNT',
+ '$dir/config.h',
+})
+
build('cpp', '$outdir/ioctl_iocdef.i', '$srcdir/ioctl_iocdef.c')
build('sed', '$outdir/ioctl_iocdef.h', '$outdir/ioctl_iocdef.i', {
expr=[[-n 's/^DEFINE HOST/#define /p']],
@@ -39,7 +43,7 @@ end)
local mpers = lines('mpers.txt')
for _, f in ipairs(mpers) do
- build('cpp', '$outdir/'..f..'.mpers.i', '$srcdir/'..f, {
+ build('cpp', '$outdir/'..f..'.mpers.i', {'$srcdir/'..f, '|', '$outdir/config.h'}, {
cflags='$cflags -DIN_MPERS_BOOTSTRAP',
})
end
@@ -327,6 +331,7 @@ build('sed', '$outdir/sys_func.h', expand{'$srcdir/', {libsrcs, srcs}}, {
})
pkg.deps = {
+ '$outdir/config.h',
'$outdir/ioctlent0.h',
'$outdir/ioctlent1.h',
'$outdir/ioctlent2.h',
diff --git a/probe/HAVE___BUILTIN_POPCOUNT b/probe/HAVE___BUILTIN_POPCOUNT
@@ -0,0 +1,4 @@
+unsigned x = 0;
+int main(void) {
+ return __builtin_popcount(x);
+}
diff --git a/probe/gen.lua b/probe/gen.lua
@@ -7,6 +7,7 @@ probe('HAVE__MM_MOVEMASK_EPI8')
probe('HAVE__THREAD_LOCAL')
probe('HAVE___BUILTIN_CLZ')
probe('HAVE___BUILTIN_CTZL')
+probe('HAVE___BUILTIN_POPCOUNT')
local function probesize(var)
build('probesize', '$outdir/'..var, {'$dir/'..var, '|', 'scripts/probe-size.sh'}, {var=var})