summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Woodard <woodard@redhat.com>2022-05-04 10:42:29 -0700
committerDodji Seketeli <dodji@redhat.com>2022-05-12 11:58:18 +0200
commitc7a71ba2d146d4253d96d27150a741bc3290d275 (patch)
treeae678028ad4a740d201aa83ce0f48158432deae6
parentsymtab: fix up 64-bit ARM address which may contain tags (diff)
downloadlibabigail-c7a71ba2d146d4253d96d27150a741bc3290d275.tar.gz
libabigail-c7a71ba2d146d4253d96d27150a741bc3290d275.tar.bz2
libabigail-c7a71ba2d146d4253d96d27150a741bc3290d275.tar.xz
Add an option ignore SONAME differences in libraries
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 * src/abg-comparison.cc (compute_diff): don't bother comparing the sonames if you aren't going to print them. * tools/abicompat.cc (options::ignore_soname): Add new data member. (parse_command_line): Support the new --ignore-soname command line option. (display_usage): Add a description string for the new --ignore-soname command line option. (create_diff_context): Set the diff_context::show_soname_change from the new options::ignore_soname data member. * tools/abidiff.cc (options::ignore_soname): Add new data member. (display_usage): Add a description string for the new --ignore-soname command line option. (parse_command_line): Support the new --ignore-soname command line option. (set_diff_context_from_opts): Set the diff_context::show_soname_change from the new options::ignore_soname. Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
-rw-r--r--doc/manuals/abicompat.rst4
-rw-r--r--doc/manuals/abidiff.rst4
-rw-r--r--src/abg-comparison.cc5
-rw-r--r--tools/abicompat.cc9
-rw-r--r--tools/abidiff.cc7
5 files changed, 27 insertions, 2 deletions
diff --git a/doc/manuals/abicompat.rst b/doc/manuals/abicompat.rst
index acb2ab06..6bc56388 100644
--- a/doc/manuals/abicompat.rst
+++ b/doc/manuals/abicompat.rst
@@ -77,6 +77,10 @@ Options
77 Do not show information about where in the *second shared library* 77 Do not show information about where in the *second shared library*
78 the respective type was changed. 78 the respective type was changed.
79 79
80 * ``--ignore-soname``
81
82 Ignore differences in the SONAME when doing a comparison
83
80 * ``--weak-mode`` 84 * ``--weak-mode``
81 85
82 This triggers the weak mode of ``abicompat``. In this mode, only 86 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
310 Show sizes and offsets in decimal base. This option is activated 310 Show sizes and offsets in decimal base. This option is activated
311 by default. 311 by default.
312 312
313 * ``--ignore-soname``
314
315 Ignore differences in the SONAME when doing a comparison
316
313 * ``--no-show-relative-offset-changes`` 317 * ``--no-show-relative-offset-changes``
314 318
315 Without this option, when the offset of a data member changes, 319 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,
10921 10921
10922 ctxt->set_corpus_diff(r); 10922 ctxt->set_corpus_diff(r);
10923 10923
10924 r->priv_->sonames_equal_ = f->get_soname() == s->get_soname(); 10924 if(ctxt->show_soname_change())
10925 r->priv_->sonames_equal_ = f->get_soname() == s->get_soname();
10926 else
10927 r->priv_->sonames_equal_ = true;
10925 10928
10926 r->priv_->architectures_equal_ = 10929 r->priv_->architectures_equal_ =
10927 f->get_architecture_name() == s->get_architecture_name(); 10930 f->get_architecture_name() == s->get_architecture_name();
diff --git a/tools/abicompat.cc b/tools/abicompat.cc
index a7f701fc..f4bc384d 100644
--- a/tools/abicompat.cc
+++ b/tools/abicompat.cc
@@ -74,6 +74,7 @@ public:
74 bool redundant_opt_set; 74 bool redundant_opt_set;
75 bool no_redundant_opt_set; 75 bool no_redundant_opt_set;
76 bool show_locs; 76 bool show_locs;
77 bool ignore_soname;
77 78
78 options(const char* program_name) 79 options(const char* program_name)
79 :prog_name(program_name), 80 :prog_name(program_name),
@@ -85,7 +86,8 @@ public:
85 show_redundant(true), 86 show_redundant(true),
86 redundant_opt_set(), 87 redundant_opt_set(),
87 no_redundant_opt_set(), 88 no_redundant_opt_set(),
88 show_locs(true) 89 show_locs(true),
90 ignore_soname(false)
89 {} 91 {}
90}; // end struct options 92}; // end struct options
91 93
@@ -112,6 +114,7 @@ display_usage(const string& prog_name, ostream& out)
112 << " --suppressions|--suppr <path> specify a suppression file\n" 114 << " --suppressions|--suppr <path> specify a suppression file\n"
113 << " --no-redundant do not display redundant changes\n" 115 << " --no-redundant do not display redundant changes\n"
114 << " --no-show-locs do now show location information\n" 116 << " --no-show-locs do now show location information\n"
117 << " --ignore-soname do not take the SONAMEs into account\n"
115 << " --redundant display redundant changes (this is the default)\n" 118 << " --redundant display redundant changes (this is the default)\n"
116 << " --weak-mode check compatibility between the application and " 119 << " --weak-mode check compatibility between the application and "
117 "just one version of the library.\n" 120 "just one version of the library.\n"
@@ -206,6 +209,8 @@ parse_command_line(int argc, char* argv[], options& opts)
206 } 209 }
207 else if (!strcmp(argv[i], "--no-show-locs")) 210 else if (!strcmp(argv[i], "--no-show-locs"))
208 opts.show_locs = false; 211 opts.show_locs = false;
212 else if (!strcmp(argv[i], "--ignore-soname"))
213 opts.ignore_soname=true;
209 else if (!strcmp(argv[i], "--help") 214 else if (!strcmp(argv[i], "--help")
210 || !strcmp(argv[i], "-h")) 215 || !strcmp(argv[i], "-h"))
211 { 216 {
@@ -277,6 +282,8 @@ create_diff_context(const options& opts)
277 ctxt->show_linkage_names(true); 282 ctxt->show_linkage_names(true);
278 ctxt->show_redundant_changes(opts.show_redundant); 283 ctxt->show_redundant_changes(opts.show_redundant);
279 ctxt->show_locs(opts.show_locs); 284 ctxt->show_locs(opts.show_locs);
285 // Intentional logic flip of ignore_soname
286 ctxt->show_soname_change(!opts.ignore_soname);
280 ctxt->switch_categories_off 287 ctxt->switch_categories_off
281 (abigail::comparison::ACCESS_CHANGE_CATEGORY 288 (abigail::comparison::ACCESS_CHANGE_CATEGORY
282 | abigail::comparison::COMPATIBLE_TYPE_CHANGE_CATEGORY 289 | abigail::comparison::COMPATIBLE_TYPE_CHANGE_CATEGORY
diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index adec742a..763f084e 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -78,6 +78,7 @@ struct options
78 bool no_default_supprs; 78 bool no_default_supprs;
79 bool no_arch; 79 bool no_arch;
80 bool no_corpus; 80 bool no_corpus;
81 bool ignore_soname;
81 bool leaf_changes_only; 82 bool leaf_changes_only;
82 bool fail_no_debug_info; 83 bool fail_no_debug_info;
83 bool show_hexadecimal_values; 84 bool show_hexadecimal_values;
@@ -125,6 +126,7 @@ struct options
125 no_default_supprs(), 126 no_default_supprs(),
126 no_arch(), 127 no_arch(),
127 no_corpus(), 128 no_corpus(),
129 ignore_soname(false),
128 leaf_changes_only(), 130 leaf_changes_only(),
129 fail_no_debug_info(), 131 fail_no_debug_info(),
130 show_hexadecimal_values(), 132 show_hexadecimal_values(),
@@ -205,6 +207,7 @@ display_usage(const string& prog_name, ostream& out)
205 "default suppression specification\n" 207 "default suppression specification\n"
206 << " --no-architecture do not take architecture in account\n" 208 << " --no-architecture do not take architecture in account\n"
207 << " --no-corpus-path do not take the path to the corpora into account\n" 209 << " --no-corpus-path do not take the path to the corpora into account\n"
210 << " --ignore-soname do not take the SONAMEs into account\n"
208 << " --fail-no-debug-info bail out if no debug info was found\n" 211 << " --fail-no-debug-info bail out if no debug info was found\n"
209 << " --leaf-changes-only|-l only show leaf changes, " 212 << " --leaf-changes-only|-l only show leaf changes, "
210 "so no change impact analysis (implies --redundant)\n" 213 "so no change impact analysis (implies --redundant)\n"
@@ -404,6 +407,8 @@ parse_command_line(int argc, char* argv[], options& opts)
404 opts.no_arch = true; 407 opts.no_arch = true;
405 else if (!strcmp(argv[i], "--no-corpus-path")) 408 else if (!strcmp(argv[i], "--no-corpus-path"))
406 opts.no_corpus = true; 409 opts.no_corpus = true;
410 else if (!strcmp(argv[i], "--ignore-soname"))
411 opts.ignore_soname = true;
407 else if (!strcmp(argv[i], "--fail-no-debug-info")) 412 else if (!strcmp(argv[i], "--fail-no-debug-info"))
408 opts.fail_no_debug_info = true; 413 opts.fail_no_debug_info = true;
409 else if (!strcmp(argv[i], "--leaf-changes-only") 414 else if (!strcmp(argv[i], "--leaf-changes-only")
@@ -699,6 +704,8 @@ set_diff_context_from_opts(diff_context_sptr ctxt,
699 ctxt->show_added_vars(opts.show_all_vars || opts.show_added_vars); 704 ctxt->show_added_vars(opts.show_all_vars || opts.show_added_vars);
700 ctxt->show_linkage_names(opts.show_linkage_names); 705 ctxt->show_linkage_names(opts.show_linkage_names);
701 ctxt->show_locs(opts.show_locs); 706 ctxt->show_locs(opts.show_locs);
707 // Intentional logic flip of ignore_soname
708 ctxt->show_soname_change(!opts.ignore_soname);
702 // So when we are showing only leaf changes, we want to show 709 // So when we are showing only leaf changes, we want to show
703 // redundant changes because of this: Suppose several functions have 710 // redundant changes because of this: Suppose several functions have
704 // their return type changed from void* to int*. We want them all 711 // their return type changed from void* to int*. We want them all