rtld-elf: Reuse _BASENAME_RTLD for debug.h rather than duplicating logic

Reviewed by:	kib, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40919
This commit is contained in:
Jessica Clarke 2023-07-09 18:45:49 +01:00
parent be01082b86
commit 5181fe24b2

View File

@ -37,6 +37,7 @@
#include <sys/cdefs.h>
#include <string.h>
#include "rtld_paths.h"
#include "rtld_printf.h"
void debug_printf(const char *, ...) __printflike(1, 2);
@ -48,17 +49,11 @@ extern int debug;
#define dbg(...) ((void) 0)
#endif
#ifndef COMPAT_32BIT
#define _MYNAME "ld-elf.so.1"
#else
#define _MYNAME "ld-elf32.so.1"
#endif
#define assert(cond) ((cond) ? (void) 0 : \
(msg(_MYNAME ": assert failed: " __FILE__ ":" \
#define assert(cond) ((cond) ? (void) 0 : \
(msg(_BASENAME_RTLD ": assert failed: " __FILE__ ":" \
__XSTRING(__LINE__) "\n"), abort()))
#define msg(s) rtld_putstr(s)
#define trace() msg(_MYNAME ": " __XSTRING(__LINE__) "\n")
#define trace() msg(_BASENAME_RTLD ": " __XSTRING(__LINE__) "\n")
#endif /* DEBUG_H */