Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755273AbcLNJhg convert rfc822-to-8bit (ORCPT ); Wed, 14 Dec 2016 04:37:36 -0500 Received: from seketeli.net ([94.23.218.202]:45850 "EHLO ms.seketeli.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755166AbcLNJg3 (ORCPT ); Wed, 14 Dec 2016 04:36:29 -0500 From: Dodji Seketeli To: Michal Marek Cc: Nicholas Piggin , Ian Campbell , Ben Hutchings , Linus Torvalds , Adam Borowski , Greg Kroah-Hartman , Linux Kbuild mailing list , Debian kernel maintainers , "linux-arch\@vger.kernel.org" , Arnd Bergmann , Ingo Molnar , Linux Kernel Mailing List Subject: Re: [PATCH] x86/kbuild: enable modversions for symbols exported from asm Organization: Me, myself and I References: <20161201125545.406d092c@roar.ozlabs.ibm.com> <1480559754.16599.92.camel@decadent.org.uk> <20161201143928.07a08348@roar.ozlabs.ibm.com> <6e8cf20b-2d2f-ba1f-e02c-c757d5a25db7@suse.com> <20161209133308.0acbb57a@roar.ozlabs.ibm.com> <1481296893.4509.135.camel@hellion.org.uk> <20161210021529.4a6e684f@roar.ozlabs.ibm.com> <86vaus3eld.fsf@seketeli.org> <867f72vqec.fsf@seketeli.org> <20161214091539.GA9000@sepie.suse.cz> X-Operating-System: Red Hat Enterprise Linux Server 7.3 X-URL: http://www.seketeli.net/~dodji Date: Wed, 14 Dec 2016 10:36:25 +0100 In-Reply-To: <20161214091539.GA9000@sepie.suse.cz> (Michal Marek's message of "Wed, 14 Dec 2016 10:15:39 +0100") Message-ID: <86twa6svhi.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1773 Lines: 89 Michal Marek a écrit: [...] > A minimal example would be > > t1.c: > struct s1; > struct s2 { > int i; > } > struct s3 { > struct s1 *ptr1; > struct s2 *ptr2; > } > void foo(struct s3*); > EXPORT_SYMBOL(foo); > > t2.c: > struct s1 { > int j; > } > struct s2; > struct s3 { > struct s1 *ptr1; > struct s2 *ptr2; > } > void foo(struct s3*); > EXPORT_SYMBOL(foo); > > genksyms expands this to > void foo ( struct s3 { struct s1 { UNKNOWN } * ptr1 ; struct s2 { int i ; } * ptr2 ; } * ) > > or > > void foo ( struct s3 { struct s1 { int j ; } * ptr1 ; struct s2 { UNKNOWN } * ptr2 ; } * ) > respectively. Thanks, I have built an independant test case from this: $ cat t1.c struct s1; struct s2 { int i; }; struct s3 { struct s1 *ptr1; struct s2 *ptr2; }; void foo(struct s3*); $ cat t2.c struct s1 { int j; }; struct s2; struct s3 { struct s1 *ptr1; struct s2 *ptr2; }; void foo(struct s3*); $ gcc -g -c t1.c $ gcc -g -c t2.c $ abidiff t1.o t2.o $ So, as you see here, abidiff considers t1.o and t2.o has having the same ABI, so it considers the two foo functions to be equivalent. > The types are the same, but their visibility in the different > compilation units differs. I see, for genksyms, the order of declarations matters, especially when forward declarations are involved. Libabigail does a "whole binary" analysis of types. So, consider the point of use of the type 'struct s1*'. Even if 'struct s' is just forward-declared at that point, the declaration of struct s1 is "resolved" to its definition. Even if the definition comes later in the binary. In other words, if struct s1 is defined in the binary, you'll never have that "struct s1 {UNKNOWN} *ptr1;" that you see in genksyms's representation. Cheers, -- Dodji