From patchwork Thu Oct 3 15:27:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 98330 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6000B385DDD1 for ; Thu, 3 Oct 2024 15:27:33 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 744A13858CDB for ; Thu, 3 Oct 2024 15:27:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 744A13858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 744A13858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727969248; cv=none; b=KAm663M4vlR8V5bWIEHMWpNIqvQlHPY4NagFMchU8V85SIOJgzIGpxTitu6lOW23LYzsNAiG1enVdkv3Cl3kVnTQKgFOSE7iyT+1GpPJ30JA03vhPBrG7/eyQQNwBNFqxig6/wWZRw1hWBJcj2CoaXfRv5QfUuCZeEJFzKabZFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727969248; c=relaxed/simple; bh=sp+Dt9G1E4noKD0CZxvssnjsnatMqqTq9EVKyEB1wAY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YcBl62x9w5KJs1MFTILry+Px6ZOjb6nl7hU5zM6RodMm9l+P9L6ch3H3aNjlfzH/ruS60PrBESffonrLspit+hZc6wJ3BV4Oxa+RmM3CTNZ7Hc8VuiUbOcRQ3NipS721WeROcmF1diSAqx3Arz734v0LO2qpEbiPXZCGTdzcIZY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727969246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=ioM14yPJQvE1dXD7UbrDKUxVWiHwfatBLHSX+8BMOKw=; b=BfRXOajF0dSQs2aSGhXRaGo7zIUZ+OulC5tTLdwdWgJNIb62dM06DK/vPHJ4rgEPx4fCdI yY8o6vooIm5A4bbvc1QPclhDcWGmpjsQFYJw9Lhoyq9zo2MxV1xYIMjm7MuOEVbNOZ5JNM YJJiqNOMm54svtb3+QKAd0/LwVpfN2k= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-124-vCoyaM5fPa6ifM7ktqZNrQ-1; Thu, 03 Oct 2024 11:27:25 -0400 X-MC-Unique: vCoyaM5fPa6ifM7ktqZNrQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37ce6262705so459850f8f.1 for ; Thu, 03 Oct 2024 08:27:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727969243; x=1728574043; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ioM14yPJQvE1dXD7UbrDKUxVWiHwfatBLHSX+8BMOKw=; b=spK66HMXXKHhBlRUqEKhMbEN72Kp9FXkPWld5DhcTiw/axI11rLJGJuUvKPRfy3fEz psPATPSIbphX6nUhCkzxNUdq+VAs9OsuQL7QyH7PbysNzD6TQ+TfRPpjcjwSorgHzNWT mvEAyYTDZM/X/94JnjJesw5nwOttImiv6mi6GshUFSR5t0dMF6xJS+m/AOxFBAleDkMy R99BH2TAaHpcoI99E6UT12/H5lMrGlNmuHDohqtmYwBFyWYAgbE9cneecELN/E+BzSds BjGDQMgq17SL7Tw+PX1fWT8gPKAPAFGo9JUgi11uCsLfObobpTbi2EeVpqAJsQkxIvjR 7MCQ== X-Gm-Message-State: AOJu0YyVaPMwwdeMTyXsD2wgkdvJTCTUNOBo4YViS5pXVp3P3rHDIcA2 1psBwUxCbeswMa8s12TFD3UohlR/ZAoHNXFzZaQkU4Y5FEEeA4jO7iAtcqBbAs3KUrkRSxh2CUE laK8ux4nZm80Dx1vgMjXh6AkF/I5r3pWg51C679g1L+gwxhV39JdGAMkR8kpXGZTajB+TNOx30w taaGAu9Xc4uO+RjjYwCMP2GsXjxxzPI+YQf6DIlw== X-Received: by 2002:a5d:6790:0:b0:37c:cd0d:3437 with SMTP id ffacd0b85a97d-37cfba20ea4mr3657910f8f.58.1727969243526; Thu, 03 Oct 2024 08:27:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuS1ziDJOSQ+WCHi5Xiki10OxXdRTKZYkntHst/OzWt8aiA1nkAnoHUjpFXAZTxzDDDhnZ+Q== X-Received: by 2002:a5d:6790:0:b0:37c:cd0d:3437 with SMTP id ffacd0b85a97d-37cfba20ea4mr3657862f8f.58.1727969241612; Thu, 03 Oct 2024 08:27:21 -0700 (PDT) Received: from localhost (88-120-130-27.subs.proxad.net. [88.120.130.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d081f736esm1503325f8f.18.2024.10.03.08.27.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 08:27:21 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 8A0F4B4FC3; Thu, 3 Oct 2024 17:27:20 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Use canonical types in comparison when --enable-debug-type-canonicalization Organization: Red Hat / France X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Thu, 03 Oct 2024 17:27:20 +0200 Message-ID: <87y135ky07.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org Hello, The commit below introduced the fact that we now always use canonical types for comparisons (when possible) in try_canonical_compare even when there is only one type that is canonicalized. That hasn't been done for when the code has been configured with --enable-debug-type-canonicalization, leading to binutils failing comparison in fc36 on aarch64 in that case. Fixed thus. Here is the commit I am talking about: commit 8b3b3d89b32c666c2a3c318d36c3bea2f2c4103a Author: Dodji Seketeli Date: Fri Sep 27 12:14:23 2024 +0200 ir: Always use canonical types in comparison when possible After staring at DWARF and ABIXML dumps for a while, I realized that in the current (non-perfect) state of things, comparing type A and type B can be slightly different from comparing canonical_type_of(A) against type B, for instance. This is essentially because comparing canonical_type_of(A) against B rather than A against B changes the order in which the nodes of the graph of types are visited. Because that graph has cycles, the order of visiting would essentially change the value of the hashes that we compute during those visits. This in turn changes the value of the comparisons depending on the order of the comparisons. So, to avoid those subtle changes, this patch ensures that whenever a type has a canonical type, then it's that canonical type that is always used in comparison. This ensures that types coming from ABIXML (as they are all canonical types) are compared in the same order as types coming from the ELF binaries. This fixes the self-comparison of the infinipath-psm package from fc36, referenced in bug https://sourceware.org/bugzilla/show_bug.cgi?id=29413. * src/abg-ir.cc (try_canonical_compare): When --enable-debug-type-canonicalization is activated use canonical types for structural comparison. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 60225718..0f98de7b 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -949,6 +949,10 @@ try_canonical_compare(const T *l, const T *r) if (l_hash != r_hash) ABG_RETURN_FALSE; + // If a type has a canonical type, use its canonical type, always. + l = maybe_get_canonical_type(l); + r = maybe_get_canonical_type(r); + return equals(*l, *r, 0); #else if (const type_base *lc = l->get_naked_canonical_type())