From patchwork Mon Mar 21 20:55:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Woodard X-Patchwork-Id: 52187 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 9BD74389EC53 for ; Mon, 21 Mar 2022 20:55:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BD74389EC53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1647896133; bh=DM5IGqxLVdssvvadjXlOXMUZkN81OPo7ilv+73mPnmI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=HOlU1JwFMdX06wINzGXIfczUBhN9L1kUmJePtcoN92TW/efYbIaHbTsJ/S3CjMEpc HnuohUHOYtGl9sGZH/1opjz9oMRBh74MWKgDlDvyVyFbE3mmi/P3Q2tcAOg5gh8K5h x5G3Dv26iZpMNNuxBmhS2qKtaiwJfFPMD3UHdM+Q= 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 DA925385E444 for ; Mon, 21 Mar 2022 20:55:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA925385E444 Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-cNeYIKnHPsy3BVyQwpJ1YQ-1; Mon, 21 Mar 2022 16:55:27 -0400 X-MC-Unique: cNeYIKnHPsy3BVyQwpJ1YQ-1 Received: by mail-pg1-f199.google.com with SMTP id q7-20020a63e207000000b003801b9bb18dso7771438pgh.15 for ; Mon, 21 Mar 2022 13:55:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DM5IGqxLVdssvvadjXlOXMUZkN81OPo7ilv+73mPnmI=; b=e9wGPf7t4b5si+JGARnCWBWBADVBsxThbrZs26K/2d79iwDNAboao3YyokbUkbOJhY W1rvgnLBkbFiWq0qOJjDGyVJX92/dUnQa/O2+kTrVdV19oyDdHuNnw9M8oES8LruJsU8 4kQoM/H56Evi9agztoHPpeQb9XQNbuv0hmMQDs5RpJG4smSnOvaHsKoItIdPkVEu3A/C dcua4jQ3N/HKqLliTQeGsX79cXgIBJKA/ygn7ZQS85SbGyn3NzTMMtJzjMISYmq+CcQZ wSJNLoQkg0wejY1kwmGM9r+eMH3CsYQ9PcvGuGMJ4NkOojTASUcKLQjXaKjEj/WaCtol l5LQ== X-Gm-Message-State: AOAM533bqAxgUFvjCebE+H/6aOUkSNvkKxLGlKiQNoBmBaQPw53clCV2 +ZXavClDJjl0gV38sF4IpWN/nzhbP01znmgwCsgXn4uYF+cfoTzz96eIosXjMKMmD7td7luMcB8 KDtdOiahQi2wIeEgVp5efxnb2koA4GOPayMAOoLfcupfczIjwWdgV66rcpUDTdCkGU3Lxlaw= X-Received: by 2002:a63:8843:0:b0:37c:94d1:4ceb with SMTP id l64-20020a638843000000b0037c94d14cebmr19639987pgd.408.1647896125872; Mon, 21 Mar 2022 13:55:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCKFjlYfNyKH+UFKFap44qxX5xeTxpm5wSLK1FijCN+nFQL2xTVr6/T3HHLtpG8gulTUJv+A== X-Received: by 2002:a63:8843:0:b0:37c:94d1:4ceb with SMTP id l64-20020a638843000000b0037c94d14cebmr19639969pgd.408.1647896125227; Mon, 21 Mar 2022 13:55:25 -0700 (PDT) Received: from alien.localdomain (47-208-199-57.trckcmtc01.res.dyn.suddenlink.net. [47.208.199.57]) by smtp.gmail.com with ESMTPSA id ca9-20020a17090af30900b001c658fd7b47sm309132pjb.36.2022.03.21.13.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 13:55:24 -0700 (PDT) To: libabigail@sourceware.org Subject: [PATCH] Add an option ignore SONAME differences in libraries Date: Mon, 21 Mar 2022 13:55:19 -0700 Message-Id: <20220321205519.37445-1-woodard@redhat.com> X-Mailer: git-send-email 2.35.1 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Ben Woodard via Libabigail From: Ben Woodard Reply-To: Ben Woodard Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" There are rare use cases where we do not want to compare the SONAME when testing libraries for compatiblity or diffing libraries. This adds an option to ignore the SONAME when doing the comparison. In these cases, we will edit the application's DT_NEEDED to point to the other library. This reuses the show_soname_change() function and slightly changes its meaning to not only control if the sonames are printed but also if they are compared. There didn't seem to be any other users of this function and slight semantic change seemed harmless. * doc/manuals/abicompat.rst - added new option * doc/manuals/abidiff.rst - added new option to manpage * tools/abicompat.cc - added new command line option and passed it to the diff_context. * tools/abidiff.cc - added new command line option and passed it to the diff_context. * src/abg-comparison.cc - don't bother comparing the sonames if you aren't going to print them. Signed-off-by: Ben Woodard --- doc/manuals/abicompat.rst | 4 ++++ doc/manuals/abidiff.rst | 4 ++++ src/abg-comparison.cc | 5 ++++- tools/abicompat.cc | 9 ++++++++- tools/abidiff.cc | 7 +++++++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/doc/manuals/abicompat.rst b/doc/manuals/abicompat.rst index acb2ab06..3540dd21 100644 --- a/doc/manuals/abicompat.rst +++ b/doc/manuals/abicompat.rst @@ -77,6 +77,10 @@ Options Do not show information about where in the *second shared library* the respective type was changed. +️ * ``--ignore-soname`` + + Ignore differences in the SONAME when doing a comparison + * ``--weak-mode`` This triggers the weak mode of ``abicompat``. In this mode, only diff --git a/doc/manuals/abidiff.rst b/doc/manuals/abidiff.rst index b37ed17e..f17fed2f 100644 --- a/doc/manuals/abidiff.rst +++ b/doc/manuals/abidiff.rst @@ -310,6 +310,10 @@ Options Show sizes and offsets in decimal base. This option is activated by default. + * ``--ignore-soname`` + + Ignore differences in the SONAME when doing a comparison + * ``--no-show-relative-offset-changes`` Without this option, when the offset of a data member changes, diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 193af52f..525605cb 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -10921,7 +10921,10 @@ compute_diff(const corpus_sptr f, ctxt->set_corpus_diff(r); - r->priv_->sonames_equal_ = f->get_soname() == s->get_soname(); + if(ctxt->show_soname_change()) + r->priv_->sonames_equal_ = f->get_soname() == s->get_soname(); + else + r->priv_->sonames_equal_ = true; r->priv_->architectures_equal_ = f->get_architecture_name() == s->get_architecture_name(); diff --git a/tools/abicompat.cc b/tools/abicompat.cc index a7f701fc..358596d1 100644 --- a/tools/abicompat.cc +++ b/tools/abicompat.cc @@ -74,6 +74,7 @@ public: bool redundant_opt_set; bool no_redundant_opt_set; bool show_locs; + bool ignore_soname; options(const char* program_name) :prog_name(program_name), @@ -85,7 +86,8 @@ public: show_redundant(true), redundant_opt_set(), no_redundant_opt_set(), - show_locs(true) + show_locs(true), + ignore_soname(false) {} }; // end struct options @@ -112,6 +114,7 @@ display_usage(const string& prog_name, ostream& out) << " --suppressions|--suppr specify a suppression file\n" << " --no-redundant do not display redundant changes\n" << " --no-show-locs do now show location information\n" + << " --ignore-soname do not take the SONAMEs into account\n" << " --redundant display redundant changes (this is the default)\n" << " --weak-mode check compatibility between the application and " "just one version of the library.\n" @@ -206,6 +209,8 @@ parse_command_line(int argc, char* argv[], options& opts) } else if (!strcmp(argv[i], "--no-show-locs")) opts.show_locs = false; + else if (!strcmp(argv[i], "--ignore-soname")) + opts.ignore_soname=true; else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { @@ -277,6 +282,8 @@ create_diff_context(const options& opts) ctxt->show_linkage_names(true); ctxt->show_redundant_changes(opts.show_redundant); ctxt->show_locs(opts.show_locs); + // Intentional logic flip of ignore_soname + ctxt->show_soname_change(!opts.ignore_soname); ctxt->switch_categories_off (abigail::comparison::ACCESS_CHANGE_CATEGORY | abigail::comparison::COMPATIBLE_TYPE_CHANGE_CATEGORY diff --git a/tools/abidiff.cc b/tools/abidiff.cc index adec742a..8f53f81f 100644 --- a/tools/abidiff.cc +++ b/tools/abidiff.cc @@ -78,6 +78,7 @@ struct options bool no_default_supprs; bool no_arch; bool no_corpus; + bool ignore_soname; bool leaf_changes_only; bool fail_no_debug_info; bool show_hexadecimal_values; @@ -125,6 +126,7 @@ struct options no_default_supprs(), no_arch(), no_corpus(), + ignore_soname(false), leaf_changes_only(), fail_no_debug_info(), show_hexadecimal_values(), @@ -205,6 +207,7 @@ display_usage(const string& prog_name, ostream& out) "default suppression specification\n" << " --no-architecture do not take architecture in account\n" << " --no-corpus-path do not take the path to the corpora into account\n" + << " --ignore-soname do not take the SONAMEs into account\n" << " --fail-no-debug-info bail out if no debug info was found\n" << " --leaf-changes-only|-l only show leaf changes, " "so no change impact analysis (implies --redundant)\n" @@ -404,6 +407,8 @@ parse_command_line(int argc, char* argv[], options& opts) opts.no_arch = true; else if (!strcmp(argv[i], "--no-corpus-path")) opts.no_corpus = true; + else if (!strcmp(argv[i], "--ignore-soname")) + opts.ignore_soname = true; else if (!strcmp(argv[i], "--fail-no-debug-info")) opts.fail_no_debug_info = true; else if (!strcmp(argv[i], "--leaf-changes-only") @@ -699,6 +704,8 @@ set_diff_context_from_opts(diff_context_sptr ctxt, ctxt->show_added_vars(opts.show_all_vars || opts.show_added_vars); ctxt->show_linkage_names(opts.show_linkage_names); ctxt->show_locs(opts.show_locs); + // Intentional logic flip of ignore_soname + ctxt->show_soname_change(!opts.ignore_soname); // So when we are showing only leaf changes, we want to show // redundant changes because of this: Suppose several functions have // their return type changed from void* to int*. We want them all