Only fake ELF soname's if requested
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 3 Jan 2013 12:16:20 +0000 (14:16 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 29 Jan 2013 06:12:27 +0000 (08:12 +0200)
- This helps cutting down the number of bogus provides from dlopen()'ed
  plugins and internal libraries which preferrably shouldn't have a
  soname at all. Unfortunately libtool always puts in a soname even if
  -module -avoid-version is used :-/
- OTOH there are broken libraries which dont have a soname even though
  they should, so (we need to) allow falling back to the former behavior
  of faking up a soname from the basename.
(cherry picked from commit 6c0bdc393dda3de8bacd3a1844d980802e45d195)

tools/elfdeps.c

index 65ef4f5..2a8fea3 100644 (file)
@@ -14,6 +14,7 @@
 
 int filter_private = 0;
 int soname_only = 0;
+int fake_soname = 0;
 
 typedef struct elfInfo_s {
     Elf *elf;
@@ -254,7 +255,7 @@ static int processFile(const char *fn, int dtype)
     }
 
     /* For DSO's, provide the basename of the file if DT_SONAME not found. */
-    if (ei->isDSO && !ei->gotDEBUG && !ei->gotSONAME) {
+    if (ei->isDSO && !ei->gotDEBUG && !ei->gotSONAME && fake_soname) {
        const char *bn = strrchr(fn, '/');
        addDep(&ei->provides, bn ? bn + 1 : fn, NULL, ei->marker);
     }
@@ -288,6 +289,7 @@ int main(int argc, char *argv[])
        { "requires", 'R', POPT_ARG_VAL, &requires, -1, NULL, NULL },
        { "filter-private", 0, POPT_ARG_VAL, &filter_private, -1, NULL, NULL },
        { "soname-only", 0, POPT_ARG_VAL, &soname_only, -1, NULL, NULL },
+       { "fake-soname", 0, POPT_ARG_VAL, &fake_soname, -1, NULL, NULL },
        POPT_AUTOHELP 
        POPT_TABLEEND
     };