From e3e21edb19b4535dde96a616963cf8ac4e648c13 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 14 Apr 2019 18:04:53 +0000 Subject: [PATCH] ld-elf.so: make LD_DEBUG always functional. This causes some increase of the dynamic linker size, but benefits of avoiding compiling private copy or the linker when debugging is required. definitely worth it. The dbg() calls can be compiled out by defining LD_NO_DEBUG symbol. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/Makefile | 2 +- libexec/rtld-elf/debug.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile index 52befa6a0d4..a51acf68068 100644 --- a/libexec/rtld-elf/Makefile +++ b/libexec/rtld-elf/Makefile @@ -2,7 +2,7 @@ # Use the following command to build local debug version of dynamic # linker: -# make DEBUG_FLAGS=-g DEBUG=-DDEBUG WITHOUT_TESTS=yes all +# make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all .include PACKAGE= clibs diff --git a/libexec/rtld-elf/debug.h b/libexec/rtld-elf/debug.h index c0528294f1d..1ad0323b42f 100644 --- a/libexec/rtld-elf/debug.h +++ b/libexec/rtld-elf/debug.h @@ -39,10 +39,10 @@ #include #include -extern void debug_printf(const char *, ...) __printflike(1, 2); +void debug_printf(const char *, ...) __printflike(1, 2); extern int debug; -#ifdef DEBUG +#ifndef NO_LD_DEBUG #define dbg(...) debug_printf(__VA_ARGS__) #else #define dbg(...) ((void) 0)