[llvm] r296998 - [XRay] Allow logging the first argument of a function call.
Bill Seurer via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 6 07:28:03 PST 2017
Your change appears to cause an undefined symbol error when the test
cases are building on ppc64le.
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/4088
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/4088/steps/ninja%20check%201/logs/stdio
[71/143] cd
/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/projects/compiler-rt/lib/xray/tests/unit
&& /home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/./bin/clang
fdr_logging_test.cc.powerpc64le.o xray_unit_test_main.cc.powerpc64le.o
gtest-all.cc.powerpc64le.o -o
/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/projects/compiler-rt/lib/xray/tests/unit/XRayFDRLoggingTest-powerpc64le
-L/home/ubuntu/gcc/install/gcc-6.2.0/lib64 -Wl,-allow-shlib-undefined
-m64 -fno-function-sections -lstdc++ -lm -lpthread -lpthread
-L/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/./lib/clang/5.0.0/lib/linux
-lclang_rt.xray-powerpc64le -latomic -ldl -lrt
FAILED: cd
/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/projects/compiler-rt/lib/xray/tests/unit
&& /home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/./bin/clang
fdr_logging_test.cc.powerpc64le.o xray_unit_test_main.cc.powerpc64le.o
gtest-all.cc.powerpc64le.o -o
/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/projects/compiler-rt/lib/xray/tests/unit/XRayFDRLoggingTest-powerpc64le
-L/home/ubuntu/gcc/install/gcc-6.2.0/lib64 -Wl,-allow-shlib-undefined
-m64 -fno-function-sections -lstdc++ -lm -lpthread -lpthread
-L/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/./lib/clang/5.0.0/lib/linux
-lclang_rt.xray-powerpc64le -latomic -ldl -lrt
/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/./lib/clang/5.0.0/lib/linux/libclang_rt.xray-powerpc64le.a(xray_interface.cc.o):(.toc+0x0):
undefined reference to `__xray_ArgLoggerEntry'
/home/buildbots/ppc64le-clang-test/clang-ppc64le/stage1/./lib/clang/5.0.0/lib/linux/libclang_rt.xray-powerpc64le.a(xray_interface.cc.o):
In function `controlPatching(bool)':
/home/buildbots/ppc64le-clang-test/clang-ppc64le/llvm/projects/compiler-rt/lib/xray/xray_interface.cc:191:
undefined reference to `__xray::patchFunctionEntry(bool, unsigned int,
XRaySledEntry const&, void (*)())'
/home/buildbots/ppc64le-clang-test/clang-ppc64le/llvm/projects/compiler-rt/lib/xray/xray_interface.cc:200:
undefined reference to `__xray::patchFunctionEntry(bool, unsigned int,
XRaySledEntry const&, void (*)())'
clang-4.0: error: linker command failed with exit code 1 (use -v to see
invocation)
ninja: build stopped: subcommand failed.
On 03/06/2017 12:48 AM, Dean Michael Berris via llvm-commits wrote:
> Author: dberris
> Date: Mon Mar 6 00:48:56 2017
> New Revision: 296998
>
> URL: http://llvm.org/viewvc/llvm-project?rev=296998&view=rev
> Log:
> [XRay] Allow logging the first argument of a function call.
>
> Summary:
> Functions with the "xray-log-args" attribute will have a special XRay sled kind
> emitted, for compiler-rt to copy any call arguments to your logging handler.
>
> For practical and performance reasons, only the first argument is supported, and
> only up to 64 bits.
>
> Reviewers: dberris
>
> Reviewed By: dberris
>
> Subscribers: llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D29702
>
> Added:
> llvm/trunk/test/CodeGen/X86/xray-log-args.ll
> Modified:
> llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
> llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=296998&r1=296997&r2=296998&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Mar 6 00:48:56 2017
> @@ -222,6 +222,7 @@ public:
> FUNCTION_ENTER = 0,
> FUNCTION_EXIT = 1,
> TAIL_CALL = 2,
> + LOG_ARGS_ENTER = 3,
> };
>
> // The table will contain these structs that point to the sled, the function
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=296998&r1=296997&r2=296998&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Mar 6 00:48:56 2017
> @@ -2756,8 +2756,11 @@ void AsmPrinter::recordSled(MCSymbol *Sl
> SledKind Kind) {
> auto Fn = MI.getParent()->getParent()->getFunction();
> auto Attr = Fn->getFnAttribute("function-instrument");
> + bool LogArgs = Fn->hasFnAttribute("xray-log-args");
> bool AlwaysInstrument =
> Attr.isStringAttribute() && Attr.getValueAsString() == "xray-always";
> + if (Kind == SledKind::FUNCTION_ENTER && LogArgs)
> + Kind = SledKind::LOG_ARGS_ENTER;
> Sleds.emplace_back(
> XRayFunctionEntry{ Sled, CurrentFnSym, Kind, AlwaysInstrument, Fn });
> }
>
> Added: llvm/trunk/test/CodeGen/X86/xray-log-args.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xray-log-args.ll?rev=296998&view=auto
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/xray-log-args.ll (added)
> +++ llvm/trunk/test/CodeGen/X86/xray-log-args.ll Mon Mar 6 00:48:56 2017
> @@ -0,0 +1,35 @@
> +; When logging arguments is specified, emit the entry sled accordingly.
> +
> +; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
> +; RUN: llc -filetype=asm -o - -mtriple=x86_64-darwin-unknown < %s | FileCheck %s
> +
> +define i32 @callee(i32 %arg) nounwind noinline uwtable "function-instrument"="xray-always" "xray-log-args"="1" {
> + ret i32 %arg
> +}
> +; CHECK-LABEL: Lxray_synthetic_0:
> +; CHECK: .quad {{\.?}}Lxray_sled_0
> +; CHECK: .quad {{_?}}callee
> +; CHECK: .byte 3
> +; CHECK: .byte 1
> +; CHECK: .{{(zero|space)}} 14
> +; CHECK: .quad {{\.?}}Lxray_sled_1
> +; CHECK: .quad {{_?}}callee
> +; CHECK: .byte 1
> +; CHECK: .byte 1
> +; CHECK: .{{(zero|space)}} 14
> +
> +define i32 @caller(i32 %arg) nounwind noinline uwtable "function-instrument"="xray-always" "xray-log-args"="1" {
> + %retval = tail call i32 @callee(i32 %arg)
> + ret i32 %retval
> +}
> +; CHECK-LABEL: Lxray_synthetic_1:
> +; CHECK: .quad {{\.?}}Lxray_sled_2
> +; CHECK: .quad {{_?}}caller
> +; CHECK: .byte 3
> +; CHECK: .byte 1
> +; CHECK: .{{(zero|space)}} 14
> +; CHECK: .quad {{\.?}}Lxray_sled_3
> +; CHECK: .quad {{_?}}caller
> +; CHECK: .byte 2
> +; CHECK: .byte 1
> +; CHECK: .{{(zero|space)}} 14
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
-Bill Seurer
More information about the llvm-commits
mailing list