From patchwork Mon Feb 12 21:24:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 85631 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 DD7FD3858409 for ; Mon, 12 Feb 2024 21:25:10 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id 49D6A3858C2D for ; Mon, 12 Feb 2024 21:25:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49D6A3858C2D 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 49D6A3858C2D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707773104; cv=none; b=NkypufJLm4KG1FQMbLY9jRZ+G8+cnqoB+uaEcf7zf8SD7u25AGIHuz2wuuc2y7AjiqIv3fpTwv7BwiAYf71BYGJWMx7Itiihyr/UaCb2pCWXATdJCZIluFCIPEaw4+A+17svJRNzd8344GAk41jc9N89eNs5qwANdKHIa1ZxnfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707773104; c=relaxed/simple; bh=MULDOuRqYJLuHq2pdhWoRkMgKPKNPvqZcOoJHqJG2mM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mVDYu/oYujWuARJ9LL+sMg+7G5fiswc4ei7gTSa4m0zv3E1q3lc6WuqLsfTxJcYRyz/FGL2wL61nCRoOtvj9K+J9HInfCWrQtV3cmUFQ+qwdPQImPhmeJIsl+izIRJVRdyHO+mKMZYWLu0uKz6fp8q/V4WZz5IAyYCY8o1aIoIg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707773103; 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=iFHqJTY29XRBBI/CwIO/febFgyzgByAGbY9k33mLfNQ=; b=NvtB22h36mRHGiZHsxisohCJI0uamEpFXPpf/k28Lhq4FCG1o9aar6yMLcqqmArwh1KVC3 SiipDwaNkDpaWYcScQPrtR9DvJrbx3MwOPRWCT7LwE9VOl/OJ7IrTT2IzkqermIXm+MbkA Cu0joBzPhZMP6ESmF6iFz7Tz3lHP1dY= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-uQCQeQMWMXCVZK7uA6ne-Q-1; Mon, 12 Feb 2024 16:25:01 -0500 X-MC-Unique: uQCQeQMWMXCVZK7uA6ne-Q-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-68c4f4bdcaaso73064936d6.1 for ; Mon, 12 Feb 2024 13:25:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707773101; x=1708377901; 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=iFHqJTY29XRBBI/CwIO/febFgyzgByAGbY9k33mLfNQ=; b=QF7+m5hvdJQAv2D9iYYLP0rB1+DIjh2N46cq1vBCG49odvrPjjPT1ExNVjQVzpmlkf LgHhdQ5bGTwe1QRs3JLTTgMSBOYF0eQqQYgu2CAg+I2HEM8FMbaqUhYTsz4hKoc3QJZr WgNjniVjCGYcAbaC7mZjVOJ2Qo/ilv9I+8qkM6g6CFdbyaPc3eBGpkv3rsIwEC9sEDO+ XzVf0WVjdeROBIx6sC1Og91EBVitSiUV+ynXd8YxG8M1neU8bXnj31Je8Jzca5592uOP UdzisA+44yKu3Awre0Sb6mz9ckLJ4MJvU/84DgkRtqD6gKDn4o+hTRJShcyHaZeW+D1E PiGg== X-Gm-Message-State: AOJu0YygVRFqENiF0iTDOop1bxo42icXr5My3odcJjwWKvb+z062R7S5 RkHjangwJv23iZfzusBYTkm+kbJ5YjEZmKBX3PgUS6tQ26+a/fTekT/bsKp5159gNLZckYsdkuB nb756aTVpNonSIsud0bOhsRyuyBLQYcMqNFrM2QuJu0AgG1gGdoj/QYiUv8T4LdMmcQ== X-Received: by 2002:a0c:ab1c:0:b0:68c:c8d4:7073 with SMTP id h28-20020a0cab1c000000b0068cc8d47073mr7990898qvb.20.1707773101216; Mon, 12 Feb 2024 13:25:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IESRJWUPXAqGBazjJlzhgzC1n8NPGbmooHNJ/P4SHb04+P7JGyJA3HWnsCzuQXHx4nj+ZI8iQ== X-Received: by 2002:a0c:ab1c:0:b0:68c:c8d4:7073 with SMTP id h28-20020a0cab1c000000b0068cc8d47073mr7990886qvb.20.1707773100955; Mon, 12 Feb 2024 13:25:00 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV41wt07U6JX667abkTEC+n0yIb/HNqosDE3pNi5lTYw5302KL7w1h41/20JmDz7mkQcsHq+DCysaGV0lr9Pu/V Received: from localhost (88-120-130-27.subs.proxad.net. [88.120.130.27]) by smtp.gmail.com with ESMTPSA id na4-20020a0562142d4400b0068c4aabcdb6sm563102qvb.29.2024.02.12.13.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:25:00 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id 00224B4FCA; Mon, 12 Feb 2024 22:24:58 +0100 (CET) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applying to mainline] dwarf-reader: Avoid duplicating union members Organization: Red Hat / France X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Mon, 12 Feb 2024 22:24:58 +0100 Message-ID: <878r3pz87p.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=-11.6 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_H2, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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 DWARF from some C++ binaries represents unions in a "piece wise" fashion. When dealing with those unions, we need to avoid adding the same member twice, just like what we do for classes. * src/abg-dwarf-reader.cc (add_or_update_union_type): Do not add an union member that already exists in the union. Signed-off-by: Dodji Seketeli Applying to the master branch. --- src/abg-dwarf-reader.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index 735f0342..8c624d48 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -13582,6 +13582,9 @@ add_or_update_union_type(reader& rdr, if (n.empty() && result->find_data_member(dm)) continue; + if (!n.empty() && lookup_var_decl_in_scope(n, result)) + continue; + result->add_data_member(dm, access, /*is_laid_out=*/true, /*is_static=*/false, offset_in_bits);