On Mon, 15 Dec 2025 16:06:42 +0100
Jean Delvare <[email protected]> wrote:

> Hi Chris,
> 
> > On Sun, 12 Oct 2025 23:04:03 +0800
> > Chris Billington <[email protected]> wrote:  
> > > 
> > > Compilation warnings
> > > 
> > > OpenBSD uses clang as default compiler. Both before and after the
> > > patch, it emits -Wcast-align warnings for each use of the macros
> > > WORD, DWORD and QWORD defined in type.h, about 300 in total.
> > > 
> > > Example:
> > > 
> > > dmidecode.c:612:26: warning: cast from 'const u8 *' (aka 'const
> > > unsigned char *') to 'const u16 *' (aka 'const unsigned short *')
> > > increases required alignment from 1 to 2 [-Wcast-align]
> > > pr_list_item("0x%04X", WORD(p + sizeof(u16) * i));
> > > ^~~~~~~~~~~~~~~~~~~~~~~~~ ./types.h:31:24: note: expanded from
> > > macro 'WORD'
> > > #define WORD(x) (u16)(*(const u16 *)(x))
> > >                        ^~~~~~~~~~~~~~~~
> > > 
> > > Compilation succeeds, because the x86 platform is tolerant of such
> > > alignment issues. However, other platforms that need strict
> > > alignment may not build. (The port is amd64/i386 only on OpenBSD,
> > > however).  
> 
> I have just committed a fix for this:
> 
> Use unaligned memory accesses unconditionally
> https://cgit.git.savannah.gnu.org/cgit/dmidecode.git/commit/?id=892a0072e58aea00e5873c3c28965d40c82a9165
> 
> -- 
> Jean Delvare
> SUSE L3 Support

Thanks- I can confirm that Git HEAD builds on OpenBSD-7.8 without the
many -Wcast-align warnings previously seen on version 3.6 in OpenBSD's
ports tree. (version.h is still at 3.6 in Git).

It runs without problems on the amd64 machines I have tested. However,
the DMI information is only found on those very old (10y+) machines that
still have SMBIOS pointers in the legacy BIOS area. 

Maybe OpenBSD port maintainers will accept a small local patch enabling
scanning from an arbitrary base address when 3.7 is released, because
as far as I know there are no plans to expose the SMBIOS base address
found on boot to userland programs.

-- 
Chris Billington

Reply via email to