diff options
Diffstat (limited to 'tools/perf/util/llvm-utils.c')
-rw-r--r-- | tools/perf/util/llvm-utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c index 4952b429caa7..1cca0a2fa641 100644 --- a/tools/perf/util/llvm-utils.c +++ b/tools/perf/util/llvm-utils.c | |||
@@ -433,6 +433,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, | |||
433 | char serr[STRERR_BUFSIZE]; | 433 | char serr[STRERR_BUFSIZE]; |
434 | char *kbuild_dir = NULL, *kbuild_include_opts = NULL; | 434 | char *kbuild_dir = NULL, *kbuild_include_opts = NULL; |
435 | const char *template = llvm_param.clang_bpf_cmd_template; | 435 | const char *template = llvm_param.clang_bpf_cmd_template; |
436 | char *command_echo, *command_out; | ||
436 | 437 | ||
437 | if (path[0] != '-' && realpath(path, abspath) == NULL) { | 438 | if (path[0] != '-' && realpath(path, abspath) == NULL) { |
438 | err = errno; | 439 | err = errno; |
@@ -487,6 +488,16 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, | |||
487 | (path[0] == '-') ? path : abspath); | 488 | (path[0] == '-') ? path : abspath); |
488 | 489 | ||
489 | pr_debug("llvm compiling command template: %s\n", template); | 490 | pr_debug("llvm compiling command template: %s\n", template); |
491 | |||
492 | if (asprintf(&command_echo, "echo -n \"%s\"", template) < 0) | ||
493 | goto errout; | ||
494 | |||
495 | err = read_from_pipe(command_echo, (void **) &command_out, NULL); | ||
496 | if (err) | ||
497 | goto errout; | ||
498 | |||
499 | pr_debug("llvm compiling command : %s\n", command_out); | ||
500 | |||
490 | err = read_from_pipe(template, &obj_buf, &obj_buf_sz); | 501 | err = read_from_pipe(template, &obj_buf, &obj_buf_sz); |
491 | if (err) { | 502 | if (err) { |
492 | pr_err("ERROR:\tunable to compile %s\n", path); | 503 | pr_err("ERROR:\tunable to compile %s\n", path); |
@@ -497,6 +508,8 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, | |||
497 | goto errout; | 508 | goto errout; |
498 | } | 509 | } |
499 | 510 | ||
511 | free(command_echo); | ||
512 | free(command_out); | ||
500 | free(kbuild_dir); | 513 | free(kbuild_dir); |
501 | free(kbuild_include_opts); | 514 | free(kbuild_include_opts); |
502 | 515 | ||
@@ -509,6 +522,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, | |||
509 | *p_obj_buf_sz = obj_buf_sz; | 522 | *p_obj_buf_sz = obj_buf_sz; |
510 | return 0; | 523 | return 0; |
511 | errout: | 524 | errout: |
525 | free(command_echo); | ||
512 | free(kbuild_dir); | 526 | free(kbuild_dir); |
513 | free(kbuild_include_opts); | 527 | free(kbuild_include_opts); |
514 | free(obj_buf); | 528 | free(obj_buf); |