#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/err.h>
#include "debug.h"
#include "llvm-utils.h"
#include "config.h"
#include "util.h"
#include <sys/wait.h>
#include <subcmd/exec-cmd.h>
Go to the source code of this file.
|
int | perf_llvm_config (const char *var, const char *value) |
|
static int | search_program (const char *def, const char *name, char *output) |
|
static int | read_from_pipe (const char *cmd, void **p_buf, size_t *p_read_sz) |
|
static void | force_set_env (const char *var, const char *value) |
|
static void | version_notice (void) |
|
static int | detect_kbuild_dir (char **kbuild_dir) |
|
void | llvm__get_kbuild_opts (char **kbuild_dir, char **kbuild_include_opts) |
|
int | llvm__get_nr_cpus (void) |
|
void | llvm__dump_obj (const char *path, void *obj_buf, size_t size) |
|
int | llvm__compile_bpf (const char *path, void **p_obj_buf, size_t *p_obj_buf_sz) |
|
int | llvm__search_clang (void) |
|
◆ CLANG_BPF_CMD_DEFAULT_TEMPLATE
#define CLANG_BPF_CMD_DEFAULT_TEMPLATE |
Value:"$CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS "\
"-DLINUX_VERSION_CODE=$LINUX_VERSION_CODE " \
"$CLANG_OPTIONS $KERNEL_INC_OPTIONS $PERF_BPF_INC_OPTIONS " \
"-Wno-unused-value -Wno-pointer-sign " \
"-working-directory $WORKING_DIR " \
"-c \"$CLANG_SOURCE\" -target bpf -O2 -o -"
Definition at line 19 of file llvm-utils.c.
◆ READ_SIZE
◆ detect_kbuild_dir()
static int detect_kbuild_dir |
( |
char ** |
kbuild_dir | ) |
|
|
static |
◆ force_set_env()
static void force_set_env |
( |
const char * |
var, |
|
|
const char * |
value |
|
) |
| |
|
inlinestatic |
◆ llvm__compile_bpf()
int llvm__compile_bpf |
( |
const char * |
path, |
|
|
void ** |
p_obj_buf, |
|
|
size_t * |
p_obj_buf_sz |
|
) |
| |
◆ llvm__dump_obj()
void llvm__dump_obj |
( |
const char * |
path, |
|
|
void * |
obj_buf, |
|
|
size_t |
size |
|
) |
| |
◆ llvm__get_kbuild_opts()
void llvm__get_kbuild_opts |
( |
char ** |
kbuild_dir, |
|
|
char ** |
kbuild_include_opts |
|
) |
| |
◆ llvm__get_nr_cpus()
int llvm__get_nr_cpus |
( |
void |
| ) |
|
◆ llvm__search_clang()
int llvm__search_clang |
( |
void |
| ) |
|
◆ perf_llvm_config()
int perf_llvm_config |
( |
const char * |
var, |
|
|
const char * |
value |
|
) |
| |
◆ read_from_pipe()
static int read_from_pipe |
( |
const char * |
cmd, |
|
|
void ** |
p_buf, |
|
|
size_t * |
p_read_sz |
|
) |
| |
|
static |
◆ search_program()
static int search_program |
( |
const char * |
def, |
|
|
const char * |
name, |
|
|
char * |
output |
|
) |
| |
|
static |
◆ version_notice()
static void version_notice |
( |
void |
| ) |
|
|
static |
◆ kinc_fetch_script
const char* kinc_fetch_script |
|
static |
Initial value:=
"#!/usr/bin/env sh\n"
"if ! test -d \"$KBUILD_DIR\"\n"
"then\n"
" exit -1\n"
"fi\n"
"if ! test -f \"$KBUILD_DIR/include/generated/autoconf.h\"\n"
"then\n"
" exit -1\n"
"fi\n"
"TMPDIR=`mktemp -d`\n"
"if test -z \"$TMPDIR\"\n"
"then\n"
" exit -1\n"
"fi\n"
"cat << EOF > $TMPDIR/Makefile\n"
"obj-y := dummy.o\n"
"\\$(obj)/%.o: \\$(src)/%.c\n"
"\t@echo -n \"\\$(NOSTDINC_FLAGS) \\$(LINUXINCLUDE) \\$(EXTRA_CFLAGS)\"\n"
"EOF\n"
"touch $TMPDIR/dummy.c\n"
"make -s -C $KBUILD_DIR M=$TMPDIR $KBUILD_OPTS dummy.o 2>/dev/null\n"
"RET=$?\n"
"rm -rf $TMPDIR\n"
"exit $RET\n"
Definition at line 265 of file llvm-utils.c.
◆ llvm_param
Initial value:= {
.clang_path = "clang",
.clang_opt = NULL,
.kbuild_dir = NULL,
.kbuild_opts = NULL,
.user_set_param = false,
}
#define CLANG_BPF_CMD_DEFAULT_TEMPLATE
Definition at line 27 of file llvm-utils.c.