From 9de2d312a3eeea3523bb71f040eca702cc508865 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 26 Sep 2019 23:54:08 +0200 Subject: [PATCH] Tiny binary. --- extra/systrace/build | 3 +++ extra/systrace/tracy_systrace.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 extra/systrace/build diff --git a/extra/systrace/build b/extra/systrace/build new file mode 100644 index 00000000..c023ffc8 --- /dev/null +++ b/extra/systrace/build @@ -0,0 +1,3 @@ +clang tracy_systrace.c -s -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -fno-stack-protector -Wl,-z,norelro -Wl,--build-id=none -nostdlib -lc +strip --strip-all -R .note.gnu.gold-version -R .comment -R .note -R .note.gnu.build-id -R .note.ABI-tag -R .eh_frame -R .eh_frame_hdr -R .gnu.hash -R .gnu.version -R .got a.out +sstrip -z a.out (elfkickers) diff --git a/extra/systrace/tracy_systrace.c b/extra/systrace/tracy_systrace.c index 3ecc0f4d..56b7df49 100644 --- a/extra/systrace/tracy_systrace.c +++ b/extra/systrace/tracy_systrace.c @@ -3,17 +3,18 @@ #include #include #include +#include #include #include enum { BufSize = 64*1024 }; -int main() +void _start() { char buf[BufSize]; int kernelFd = open( "/sys/kernel/debug/tracing/trace_pipe", O_RDONLY ); - if( kernelFd == -1 ) return -1; + if( kernelFd < 0 ) exit( 0 ); struct pollfd pfd; pfd.fd = kernelFd; @@ -31,6 +32,5 @@ int main() write( STDOUT_FILENO, buf, rd ); } - close( kernelFd ); - return 0; + exit( 0 ); }