Bug 279071

Summary: loader build error with EFI_DEBUG
Product: Base System Reporter: John F. Carr <jfc>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: imp
Priority: ---    
Version: 15.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Use -Wno-format for zfs_module.c none

Description John F. Carr 2024-05-17 20:18:18 UTC
Created attachment 250737 [details]
Use -Wno-format for zfs_module.c

When compiling with -DEFI_DEBUG, stand/efi/boot1/zfs_module.c needs the same -Wno-format flag as ufs_module.c.  Otherwise,

/usr/src/stand/efi/boot1/zfs_module.c:155:22: error: format specifies type 'wchar_t *' (aka 'int *') but the argument has type 'CHAR16 *' (aka 'unsigned short *') [-Werror,-Wformat]
  154 |                 DPRINTF("load: '%s' spa: '%s', devpath: %S\n", filepath,
      |                                                         ~~
  155 |                     spa->spa_name, text);
      |                                    ^~~~
/usr/home/15/src/stand/efi/boot1/boot_module.h:37:45: note: expanded from macro 'DPRINTF'
   37 | #define DPRINTF(fmt, args...) printf(fmt, ##args)
      |                                      ~~~    ^~~~
1 error generated.
*** [zfs_module.o] Error code 1

Fix attached.

The comment in stand/efi/boot1/Makefile says this is platform-dependent.  I was cross-compiling aarch64 to riscv64.
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-06-14 17:12:10 UTC
A commit in branch main references this bug:

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

commit cadc9c7db780877396da23f3683a8c69c9b1c01e
Author:     John F. Carr <jfc@mit.edu>
AuthorDate: 2024-06-14 17:06:03 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-06-14 17:11:05 +0000

    boot/efi: Fix warning for non-standard formats when debugging

    Add -Wno-format for zfs_module and regroup. This fixes warnings when
    EFI_DEBUG is defined.

    PR: 279071
    Reviewed-by: imp

 stand/efi/boot1/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Comment 2 Warner Losh freebsd_committer freebsd_triage 2024-06-14 17:14:33 UTC
Committed.

It would make things go smoother in the future if you either (a) used git format-patch for the patches you submit, or (b) submitted this as a pull request. Generally, pull requests will land faster as they are more visible.
Comment 3 John F. Carr 2024-06-14 17:35:51 UTC
Do pull requests go to https://github.com/freebsd/freebsd-src?
Comment 4 Warner Losh freebsd_committer freebsd_triage 2024-06-23 23:41:34 UTC
(In reply to John F. Carr from comment #3)
> Do pull requests go to https://github.com/freebsd/freebsd-src?

Yes.