From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: [PATCH] net/mlx5: fix linkage error for glue lib Date: Tue, 24 Jul 2018 18:03:46 +0200 Message-ID: <20180724160346.GU5211@6wind.com> References: <20180724085445.52206-1-shahafs@mellanox.com> <20180724120048.GQ5211@6wind.com> <20180724120551.GR5211@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Shahaf Shuler , Yongseok Koh , "dev@dpdk.org" , "stable@dpdk.org" , =?utf-8?B?TsOpbGlv?= Laranjeiro To: "Yaroslav Brustinov (ybrustin)" Return-path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 5D9251DA4 for ; Tue, 24 Jul 2018 18:04:04 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id o11-v6so3066240wmh.2 for ; Tue, 24 Jul 2018 09:04:04 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Jul 24, 2018 at 02:24:12PM +0000, Yaroslav Brustinov (ybrustin) wrote: > 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. > > :) Hah, this code was originally intended to become a generic EAL function hence the C99 but got rejected. Mellanox PMDs otherwise rely on C11 features already. > 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. Right, this was my first (wrong) suggestion that doesn't work on types. How about the second one instead? Here's how the diff on mlx5_glue.h should look like: +#include #include #include [...] +alignas(max_align_t) const struct mlx5_glue *mlx5_glue; Another comment regarding this patch, commit log should probably mention it addresses a GCC bug that cannot be reproduced with latter versions. Keep in mind DPDK recommends to use at least GCC version 4.9. > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Tuesday, July 24, 2018 16:51 > To: Adrien Mazarguil > Cc: Yongseok Koh ; dev@dpdk.org; Yaroslav Brustinov (ybrustin) ; stable@dpdk.org; Nélio Laranjeiro > 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 > > > #include > > > > > > [...] > > > 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? > > > > > > -- Adrien Mazarguil 6WIND