From patchwork Wed Oct 21 11:08:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Matthias_M=C3=A4nnich?= X-Patchwork-Id: 40796 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 1AE7F39724AB; Wed, 21 Oct 2020 11:10:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1AE7F39724AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1603278605; bh=xoWVzEiL3HMdzm2w6qYT71/cLf+iwb1DN45b2bTNtqI=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=bu3XcVJLEELVe2zBzIdsFfw870RM4VWX3cWPTSkHEyQMai2O1cVV/fHYJxrnkvyjW kJtNVoUMG1IanzzWOiM0B8sW3648zdaWZAS6HVi4OYxpUd1uJ5JOf1uxIXthVwMwoY 1Ja1KCHbqLFaMtBoRM5tHM00kwzfNlyd3BmoJfxg= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by sourceware.org (Postfix) with ESMTPS id E752C39724AB for ; Wed, 21 Oct 2020 11:10:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E752C39724AB Received: by mail-qk1-x749.google.com with SMTP id v186so1419421qkb.11 for ; Wed, 21 Oct 2020 04:10:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=xoWVzEiL3HMdzm2w6qYT71/cLf+iwb1DN45b2bTNtqI=; b=Ab58yACKjmsyL//ktY8s4VCHoQv8UwHUOJdjjA4fakDLEm0eCNlOmQWnM8+wVpKgz9 KI0WbbSAHgebloCZZOnR7QqCRro8pptBdeBNVPBDGlqbjJ9oMoudrcvi8P8qoQyNtp4d +VXA2+Sup4QJPXgzWZV22dhOwamtHbE7XzD2gelYHbhpwXQLG0SCmJr0DVSQCFWJuDJU sZ/3CZpV1EJV7X25+ZopJIM9CLGthVEjHSwcD6BtUnEsOE4ZJDL/s8cbB9FoP2yOL7jY xA7/Pm0Ur6GHau9AFEL8/BJ5XlLtCkoJlUWZFmKUabTz7jPenOeEbHmITu05OF028R5T SDVw== X-Gm-Message-State: AOAM531FWBI8s5GMox9TQsy1wI3r4Pfj2YXolDH9u2z7/jpN0MUJ6+jk 625NB08VkMJaHJxJ6PYOWXXZmrT+Q5Ek4jJClum/JiVN1E+tS289d9lsi062rDB8Yd/bHhG5TZF Mc3hJOe2J94pbmVQeKq2OdPKKPrsdb/mdxjpvBE6lpfC9kkDnscWQv/DCThMeN+P5q6EX9Bs= X-Google-Smtp-Source: ABdhPJy3OEIlV2SBsZbVz2KBKlT2Ik9LFA/5E3rmHbEUvvmM5OqrIoNmI5M3Z+JCxVxKdrJPm6kN5K00gNZxkA== X-Received: from lux.lon.corp.google.com ([2a00:79e0:d:210:7220:84ff:fe09:a3aa]) (user=maennich job=sendgmr) by 2002:a05:6214:4ae:: with SMTP id w14mr2367467qvz.5.1603278602399; Wed, 21 Oct 2020 04:10:02 -0700 (PDT) Date: Wed, 21 Oct 2020 12:08:19 +0100 In-Reply-To: <20201021110815.4025428-1-maennich@google.com> Message-Id: <20201021110815.4025428-3-maennich@google.com> Mime-Version: 1.0 References: <20201021110815.4025428-1-maennich@google.com> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog Subject: [PATCH 3/3] dwarf-reader: fix lookup for repeated translation unit paths To: libabigail@sourceware.org X-Spam-Status: No, score=-23.0 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Matthias Maennich via Libabigail From: =?utf-8?q?Matthias_M=C3=A4nnich?= Reply-To: Matthias Maennich Cc: maennich@google.com, kernel-team@android.com, Dan Albert Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" When using relative compilation unit paths in DWARF, the lookup for an existing one was done with an incorrect path. In particular, a '/' was prefixed to the path regardless of whether the compilation_dir is set. That led to the instantiation of an additional translation unit that and failed when adding it to the corpus due to violating translation unit uniqueness. Fix that by correcting the lookup. * src/abg-dwarf-reader.cc(build_translation_unit_and_add_to_ir): Fix lookup for potentially already existing translation units. Reported-by: Dan Albert Signed-off-by: Matthias Maennich --- src/abg-dwarf-reader.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index c65e1b921945..2934f11e8db7 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -12826,7 +12826,8 @@ build_translation_unit_and_add_to_ir(read_context& ctxt, // unit. That is, it's going to be the union of all the translation // units of the same path. { - string abs_path = compilation_dir + "/" + path; + const string& abs_path = + compilation_dir.empty() ? path : compilation_dir + "/" + path; result = ctxt.current_corpus()->find_translation_unit(abs_path); }