git: dc7ae2bc6fad - main - kern_ctf.c: fix linking with nooptions DDB

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Fri, 22 Mar 2024 16:30:14 UTC
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc7ae2bc6fadd67cef0e1c65d79aa82818ac9793

commit dc7ae2bc6fadd67cef0e1c65d79aa82818ac9793
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-03-22 16:26:00 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-03-22 16:26:00 +0000

    kern_ctf.c: fix linking with nooptions DDB
    
    !DDB builds don't include the db_ctf_lookup_typename() symbol, so this
    is a stop-gap to fix linking of the MINIMAL kernel config.
    
    Reported by:    bapt
    Fixes:          c21bc6f3c242 ("ddb: Add CTF-based pretty printing")
---
 sys/kern/kern_ctf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c
index 8a2106a15308..b525c274f9e0 100644
--- a/sys/kern/kern_ctf.c
+++ b/sys/kern/kern_ctf.c
@@ -326,5 +326,9 @@ link_elf_ctf_lookup_typename(linker_file_t lf, linker_ctf_t *lc,
 	if (link_elf_ctf_get_ddb(lf, lc))
 		return (ENOENT);
 
+#ifdef DDB
 	return (db_ctf_lookup_typename(lc, typename) ? 0 : ENOENT);
+#else
+	return (ENOENT);
+#endif
 }