Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/strace/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
#define HAVE_STRUCT_IOCB_AIO_RW_FLAGS 1
#define HAVE_STRUCT_KBDIACRSUC 1
#define HAVE_STRUCT_KBDIACRUC 1
#define HAVE_STRUCT_KVM_CPUID2 1
/* #undef HAVE_STRUCT_KVM_CPUID2 */
#define HAVE_STRUCT_KVM_REGS 1
#define HAVE_STRUCT_KVM_SREGS 1
#define HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION 1
Expand Down Expand Up @@ -258,13 +258,13 @@
#define HAVE_STRUCT_TERMIOS2 1
/* #undef HAVE_STRUCT_TERMIOS_C_ISPEED */
/* #undef HAVE_STRUCT_TERMIOS_C_OSPEED */
#define HAVE_STRUCT_USER_DESC 1
#define HAVE_STRUCT_USER_DESC_LM 1
/* #undef HAVE_STRUCT_USER_DESC */
/* #undef HAVE_STRUCT_USER_DESC_LM */
#define HAVE_STRUCT_UTSNAME_DOMAINNAME 1
/* #undef HAVE_STRUCT___AIO_SIGSET */
#define HAVE_STRUCT___KERNEL_SOCK_TIMEVAL 1
#define HAVE_STRUCT___KERNEL_TIMESPEC 1
#define HAVE_STRUCT___OLD_KERNEL_STAT 1
/* #undef HAVE_STRUCT___OLD_KERNEL_STAT */
#define HAVE_STRUCT___PTRACE_SYSCALL_INFO 1
#define HAVE_SYNC_FILE_RANGE 1
#define HAVE_SYS_EVENTFD_H 1
Expand Down Expand Up @@ -540,7 +540,7 @@
# endif
#endif
/* #undef X32 */
#define X86_64 1
/* #undef X86_64 */
/* #undef XTENSA */
/* #undef gid_t */
/* #undef typeof */
Expand Down
35 changes: 29 additions & 6 deletions pkg/strace/gen.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
local arch = ({
aarch64='aarch64',
x86_64='x86_64',
})[config.target.platform:match('[^-]*')]
-- NOTE: strace is architecture specific, skip generation on unsupported archs
if not arch then return end

cflags{
'-D HAVE_CONFIG_H',
'-D IN_STRACE',
-- it is important that the arch-specific directory is searched first
'-I $srcdir/src/linux/x86_64',
'-I $srcdir/src/linux/'..arch,
'-I $srcdir/src/linux/generic',
'-I $srcdir/src',
'-I $outdir',
'-isystem $builddir/pkg/linux-headers/include',
}

local arch_cflags = {}
arch_cflags['aarch64'] = {'-D AARCH64=1'}
arch_cflags['x86_64'] = {
'-D X86_64=1',
'-D HAVE_STRUCT_KVM_CPUID2=1',
'-D HAVE_STRUCT_USER_DESC=1',
'-D HAVE_STRUCT_USER_DESC_LM=1',
'-D HAVE_STRUCT___OLD_KERNEL_STAT=1',
}
cflags(arch_cflags[arch])

build('cat', '$outdir/config.h', {
'$builddir/probe/HAVE___BUILTIN_POPCOUNT',
'$dir/config.h',
Expand All @@ -22,16 +40,21 @@ build('sed', '$outdir/ioctl_iocdef.h', '$outdir/ioctl_iocdef.i', {
sub('tools.ninja', function()
toolchain(config.host)
cflags{
'-D X86_64=1',
'-I $srcdir/src/linux/x86_64',
'-I $srcdir/src/linux/'..arch,
'-I $srcdir/src/linux',
'-I $outdir',
}
cflags(arch_cflags[arch])

local arch_h_count = {
aarch64=1,
x86_64=2,
}

for i = 0, 2 do
for i = 0, arch_h_count[arch] do
build('cat', '$outdir/ioctls_all'..i..'.h', {
'$srcdir/src/linux/x86_64/ioctls_inc'..i..'.h',
'$srcdir/src/linux/x86_64/ioctls_arch'..i..'.h',
'$srcdir/src/linux/'..arch..'/ioctls_inc'..i..'.h',
'$srcdir/src/linux/'..arch..'/ioctls_arch'..i..'.h',
})
build('cc', '$outdir/ioctlsort'..i..'.c.o', {
'$srcdir/src/ioctlsort.c',
Expand Down