All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Shahaf Shuler <shahafs@mellanox.com>
Cc: yskoh@mellanox.com, dev@dpdk.org,
	Yaroslav Brustinov <ybrustin@cisco.com>,
	stable@dpdk.org, nelio.laranjeiro@6wind.com
Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib
Date: Tue, 24 Jul 2018 14:05:51 +0200	[thread overview]
Message-ID: <20180724120551.GR5211@6wind.com> (raw)
In-Reply-To: <20180724120048.GQ5211@6wind.com>

On Tue, Jul 24, 2018 at 02:00:48PM +0200, Adrien Mazarguil wrote:
> On Tue, Jul 24, 2018 at 11:54:45AM +0300, Shahaf Shuler wrote:
> > From: Yaroslav Brustinov <ybrustin@cisco.com>
> > 
> > Compiling with gcc 4.7.2 introduced the linkage error
> > 
> > "bin/ld: Warning: alignment 8 of symbol `mlx5_glue' in
> > src/dpdk/drivers/net/mlx5/mlx5_glue.c.21.o is smaller than 16 in
> > src/dpdk/drivers/net/mlx5/mlx5_rxq.c.21.o"
> > 
> > Fix it be forcing the alignment of the glue lib.
> > 
> > Fixes: 0e83b8e536c1 ("net/mlx5: move rdma-core calls to separate file")
> > Cc: stable@dpdk.org
> > Cc: nelio.laranjeiro@6wind.com
> > Cc: adrien.mazarguil@6wind.com
> > 
> > Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> 
> 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;

> 
> > ---
> >  drivers/net/mlx5/mlx5_glue.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
> > index c7965e51fe..c56c69bb13 100644
> > --- a/drivers/net/mlx5/mlx5_glue.c
> > +++ b/drivers/net/mlx5/mlx5_glue.c
> > @@ -343,7 +343,9 @@ mlx5_glue_dv_create_qp(struct ibv_context *context,
> >  #endif
> >  }
> >  
> > -const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
> > +const struct mlx5_glue *mlx5_glue __attribute__((__aligned__(64))) =
> > +						&(const struct mlx5_glue)
> > +{
> >  	.version = MLX5_GLUE_VERSION,
> >  	.fork_init = mlx5_glue_fork_init,
> >  	.alloc_pd = mlx5_glue_alloc_pd,
> > -- 
> > 2.12.0
> > 
> 
> -- 
> Adrien Mazarguil
> 6WIND

-- 
Adrien Mazarguil
6WIND

  reply	other threads:[~2018-07-24 12:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24  8:54 [PATCH] net/mlx5: fix linkage error for glue lib Shahaf Shuler
2018-07-24 12:00 ` Adrien Mazarguil
2018-07-24 12:05   ` Adrien Mazarguil [this message]
2018-07-24 13:51     ` Shahaf Shuler
2018-07-24 14:24       ` Yaroslav Brustinov (ybrustin)
2018-07-24 16:03         ` Adrien Mazarguil
2018-07-25  7:38           ` Yaroslav Brustinov (ybrustin)
2018-07-25  9:24             ` Adrien Mazarguil
2018-07-25 10:02               ` Yaroslav Brustinov (ybrustin)
2018-07-25 13:18 ` [PATCH v2] " Shahaf Shuler
2018-07-25 13:22   ` Adrien Mazarguil
2018-07-26  5:44     ` Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180724120551.GR5211@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=shahafs@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=ybrustin@cisco.com \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.