1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/compiler.h>
14 #include "../util/genelf.h"
17 #define TEMPL "/tmp/perf-test-XXXXXX"
19 static int test__jit_write_elf(struct test_suite *test __maybe_unused,
20 int subtest __maybe_unused)
23 static unsigned char x86_code[] = {
24 0xBB, 0x2A, 0x00, 0x00, 0x00, /* movl $42, %ebx */
25 0xB8, 0x01, 0x00, 0x00, 0x00, /* movl $1, %eax */
26 0xCD, 0x80 /* int $0x80 */
35 perror("mkstemp failed");
39 pr_info("Writing jit code to: %s\n", path);
41 ret = jit_write_elf(fd, 0, "main", x86_code, sizeof(x86_code),
47 return ret ? TEST_FAIL : 0;
53 DEFINE_SUITE("Test jit_write_elf", jit_write_elf);