Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: alignment and packed structs



On Wed, 6 Jan 2021, Patrick Welche wrote:

I just tried to compile if_iwn as a module. It failed with

dev/pci/if_iwn.c:2685:6: error: converting a packed 'struct iwn_fw_dump' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member]


I got around it with
...
Why isn't this necessary when building if_iwn.c as part of a kernel?

This isn't an isolated case. I recently built some other (Intel
DRM) code as modules and had to "fix " the code in 3 or 4 places
for the whole kernel/module compilation to complete successfully.
I figured it was a case of slightly different compiler flags being
used for the monolithic vs. modular kernel builds.

-RVP


Home | Main Index | Thread Index | Old Index