[Skiboot] [PATCH] errorlog: Prevent alignment error building with gcc9.
Oliver O'Halloran
oohall at gmail.com
Fri Jul 26 14:34:04 AEST 2019
On Tue, 2019-07-23 at 11:46 +0200, Michal Suchanek wrote:
> Fixes this build error:
> [ 52s] hw/fsp/fsp-elog-write.c: In function 'opal_elog_read':
> [ 52s] hw/fsp/fsp-elog-write.c:213:12: error: taking address of packed member of 'struct errorlog' may result in an unaligned pointer value [-Werror=address-of-packed-member]
> [ 52s] 213 | list_del(&log_data->link);
> [ 52s] | ^~~~~~~~~~~~~~~
>
> Fixes: https://github.com/open-power/skiboot/issues/247
> Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> ---
> include/errorlog.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/errorlog.h b/include/errorlog.h
> index 6da96649e048..b4cc163ced39 100644
> --- a/include/errorlog.h
> +++ b/include/errorlog.h
> @@ -119,7 +119,7 @@ struct __attribute__((__packed__))elog_user_data_section {
> * needs to populate this structure using pre-defined interfaces
> * only
> */
> -struct __attribute__((__packed__)) errorlog {
> +struct __attribute__((__packed__)) __attribute__ ((aligned (8))) errorlog {
This'll work since our allocator always returns 8 byte aligned memory,
but it seems like a hack.
I think we might be better off just disabling that warning. All the
CPUs we support (power8 onwards) fully support unaligned accesses to
cacheable memory so even if this can create unaligned pointers it
shouldn't cause any problems. For non-cacheable memory we have seperate
accessor functions anyway so I don't really view that as a problem
either.
> uint16_t component_id;
> uint8_t error_event_type;
More information about the Skiboot
mailing list