Bug 276079

Summary: "options DDB" causes sys/dev/iommu/iommu_gas.c: 1095:1: error: incompatible pointer types passing 'db_cmdfcn_t *' (aka 'void (*)(long, _Bool, long, char *)') to parameter of type 'struct db_command *'
Product: Base System Reporter: Trond Endrestøl <Trond.Endrestol>
Component: kernAssignee: Konstantin Belousov <kib>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: ---    
Version: 13.2-STABLE   
Hardware: Any   
OS: Any   

Description Trond Endrestøl 2024-01-02 15:41:52 UTC
Custom kernel for stable/13 amd64 includes GENERIC and adds "options DDB", causing:

--- iommu_gas.o ---
/usr/src/sys/dev/iommu/iommu_gas.c:1095:1: error: redefinition of 'iommu_domain_show' as different kind of symbol
DB_SHOW_COMMAND(iommu_domain, iommu_domain_show)
^
/usr/src/sys/ddb/ddb.h:176:2: note: expanded from macro 'DB_SHOW_COMMAND'
        DB_SHOW_COMMAND_FLAGS(cmd_name, func_name, 0)
        ^
/usr/src/sys/ddb/ddb.h:174:2: note: expanded from macro 'DB_SHOW_COMMAND_FLAGS'
        _DB_FUNC(_show, cmd_name, func_name, db_show_table, flags, NULL)
        ^
/usr/src/sys/ddb/ddb.h:156:31: note: expanded from macro '_DB_FUNC'
static db_cmdfcn_t _func;                                       \
                                                                ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/usr/src/sys/sys/cdefs.h:150:23: note: expanded from macro '__CONCAT'
#define __CONCAT(x,y)   __CONCAT1(x,y)
                        ^
/usr/src/sys/sys/cdefs.h:149:24: note: expanded from macro '__CONCAT1'
#define __CONCAT1(x,y)  x ## y
                        ^
<scratch space>:116:1: note: expanded from here
iommu_domain_show
^
/usr/src/sys/dev/iommu/iommu_gas.c:1095:31: note: previous definition is here
DB_SHOW_COMMAND(iommu_domain, iommu_domain_show)
                              ^
/usr/src/sys/dev/iommu/iommu_gas.c:1095:1: error: incompatible pointer types passing 'db_cmdfcn_t *' (aka 'void (*)(long, _Bool, long, char *)') to parameter of type 'struct db_command *' [-Werror,-Wincompatible-pointer-types]
DB_SHOW_COMMAND(iommu_domain, iommu_domain_show)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:176:2: note: expanded from macro 'DB_SHOW_COMMAND'
        DB_SHOW_COMMAND_FLAGS(cmd_name, func_name, 0)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:174:2: note: expanded from macro 'DB_SHOW_COMMAND_FLAGS'
        _DB_FUNC(_show, cmd_name, func_name, db_show_table, flags, NULL)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:156:31: note: expanded from macro '_DB_FUNC'
static db_cmdfcn_t _func;                                       \
                                                                ^
/usr/src/sys/ddb/ddb.h:136:34: note: expanded from macro '\
_DB_SET'
    { db_command_register(&list, &__CONCAT(_name,_suffix)); }   \
                                 ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:234:26: note: passing argument to parameter here
                    struct db_command *);
                                       ^
/usr/src/sys/dev/iommu/iommu_gas.c:1095:1: error: incompatible pointer types passing 'db_cmdfcn_t *' (aka 'void (*)(long, _Bool, long, char *)') to parameter of type 'struct db_command *' [-Werror,-Wincompatible-pointer-types]
DB_SHOW_COMMAND(iommu_domain, iommu_domain_show)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:176:2: note: expanded from macro 'DB_SHOW_COMMAND'
        DB_SHOW_COMMAND_FLAGS(cmd_name, func_name, 0)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:174:2: note: expanded from macro 'DB_SHOW_COMMAND_FLAGS'
        _DB_FUNC(_show, cmd_name, func_name, db_show_table, flags, NULL)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:156:31: note: expanded from macro '_DB_FUNC'
static db_cmdfcn_t _func;                                       \
                                                                ^
/usr/src/sys/ddb/ddb.h:140:36: note: expanded from macro '\
_DB_SET'
    { db_command_unregister(&list, &__CONCAT(_name,_suffix)); } \
                                   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/ddb/ddb.h:236:26: note: passing argument to parameter here
                    struct db_command *);
                                       ^
3 errors generated.
*** [iommu_gas.o] Error code 1

Disabling "options DDB" effectively hides the problematic code, leading to a successful build.
Source tree is at commit c85ff48a092e4c5989f91a4a1ccf99441ffb3170, "nfscl: Fix handling of expired Kerberos credentials (NFSv4.1/4.2)".
Comment 1 Trond Endrestøl 2024-01-02 15:44:16 UTC
Commit 5eb2fcd1f232f992c2c77549e5cb04aff9ae6dae, "iommu_gas: add ddb 'show iommu_domain' command," appears to be the problematic commit. Maybe something is missing.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2024-01-02 18:55:56 UTC
^Triage: over to committer of 5eb2fcd1f232f992c2c77549e5cb04aff9ae6dae (MFC of change to 13).
Comment 3 Trond Endrestøl 2024-01-04 07:56:50 UTC
Fixed in commit 915edb4ecb86a197a5a1d297bed819b3163558f3.