[dpdk-stable] [PATCH] net/mlx5: fix linkage error for glue lib

Yaroslav Brustinov (ybrustin) ybrustin at cisco.com
Tue Jul 24 16:24:12 CEST 2018


Hi,

Are you OK with C11?
I saw in file dpdk/drivers/net/mlx4/mlx4_utils.c:

     * C11 code would include stdalign.h and use alignof(max_align_t) however
     * we'll stick with C99 for the time being.

:)

As far as I understand, the issue is alignment of the pointer itself, not the struct.
I'm not familiar with this command: "alignof(max_align_t)".
Applying this on the struct:

    struct mlx5_glue {
    ...
    } __attribute__((__aligned__(64)));

    struct __attribute__((__aligned__(64))) mlx5_glue {
    ...
    };

...still keeps the linker unhappy.

Thanks,
Yaroslav.


-----Original Message-----
From: Shahaf Shuler [mailto:shahafs at mellanox.com] 
Sent: Tuesday, July 24, 2018 16:51
To: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
Cc: Yongseok Koh <yskoh at mellanox.com>; dev at dpdk.org; Yaroslav Brustinov (ybrustin) <ybrustin at cisco.com>; stable at dpdk.org; Nélio Laranjeiro <nelio.laranjeiro at 6wind.com>
Subject: RE: [PATCH] net/mlx5: fix linkage error for glue lib

Yaroslav, 

Tuesday, July 24, 2018 3:06 PM, Adrien Mazarguil:
> Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
> > Odd, how could this happen assuming both files are compiled during 
> > the same run using identical flags? Looks like a compiler issue.
> >
> > Anyway, may I suggest an alignment constraint on the structure type 
> > in mlx5_glue.h instead, so that all users inherit it. E.g. using C11 syntax:
> >
> >  #include <stdalign.h>
> >  #include <stddef.h>
> >
> >  [...]
> >  alignas(max_align_t)
> >  struct mlx5_glue {
> >      [...]
> >  };
> 
> My bad, this is not a correct use for alignas(), it doesn't work on types.
> How about this instead:
> 
>  alignas(max_align_t)
>  const struct mlx5_glue *mlx5_glue;

Can you confirm the above suggestion fixes your issue? 

> 
> >


More information about the stable mailing list