From e69dc8626a52ba77fbee80ced3b39edd2526d833 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 26 Jun 2019 15:43:26 +0000 Subject: [PATCH] Use rtld_putstr() instead of write() for the rtld msg() macro This removes an unnecessary libc dependency from rtld. See https://reviews.freebsd.org/D20663 for more details. --- libexec/rtld-elf/debug.h | 4 ++-- libexec/rtld-elf/rtld_printf.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/debug.h b/libexec/rtld-elf/debug.h index 1ad0323b42f..4dcefbabdb4 100644 --- a/libexec/rtld-elf/debug.h +++ b/libexec/rtld-elf/debug.h @@ -37,7 +37,7 @@ #include #include -#include +#include "rtld_printf.h" void debug_printf(const char *, ...) __printflike(1, 2); extern int debug; @@ -57,7 +57,7 @@ extern int debug; #define assert(cond) ((cond) ? (void) 0 : \ (msg(_MYNAME ": assert failed: " __FILE__ ":" \ __XSTRING(__LINE__) "\n"), abort())) -#define msg(s) write(STDOUT_FILENO, s, strlen(s)) +#define msg(s) rtld_putstr(s) #define trace() msg(_MYNAME ": " __XSTRING(__LINE__) "\n") diff --git a/libexec/rtld-elf/rtld_printf.h b/libexec/rtld-elf/rtld_printf.h index 5cfcc6d062f..3d3a0480ecc 100644 --- a/libexec/rtld-elf/rtld_printf.h +++ b/libexec/rtld-elf/rtld_printf.h @@ -31,6 +31,7 @@ #define RTLD_PRINTF_H 1 #include +#include #include int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...)