[Bug,default/33076] New: abicompat does not categorize and filter out harmless diff nodes

Message ID bug-33076-9487@http.sourceware.org/bugzilla/
State New
Headers
Series [Bug,default/33076] New: abicompat does not categorize and filter out harmless diff nodes |

Commit Message

mark at klomp dot org June 11, 2025, 4:05 p.m. UTC
  https://sourceware.org/bugzilla/show_bug.cgi?id=33076

            Bug ID: 33076
           Summary: abicompat does not categorize and filter out harmless
                    diff nodes
           Product: libabigail
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: default
          Assignee: unassigned at sourceware dot org
          Reporter: dodji at seketeli dot org
                CC: libabigail at sourceware dot org
  Target Milestone: ---

Consider this application and shared libraries compared:

$ cat 0/test-diff-ptr-to-void-ptr-fn-v0.c
typedef void* VOID_PTR;

void
foo(int a __attribute__((unused)),
    char b __attribute__((unused)),
    VOID_PTR c __attribute__((unused)))
{
}

$ gcc -g -Wall -shared -fPIC -o 0/libtest-diff-ptr-to-void-ptr-fn.so
0/test-diff-ptr-to-void-ptr-fn-v0.c
$ cat 1/test-diff-ptr-to-void-ptr-fn-v1.c

typedef void (*PTR_TO_FN)(...);

void
foo(int a __attribute__((unused)),
    char b __attribute__((unused)),
    PTR_TO_FN c __attribute__((unused)))
{
}

$ diff -u 0/test-diff-ptr-to-void-ptr-fn-v0.c
1/test-diff-ptr-to-void-ptr-fn-v1.c

$ gcc -g -Wall -shared -fPIC -o 1/libtest-diff-ptr-to-void-ptr-fn.so
1/test-diff-ptr-to-void-ptr-fn-v1.c
$ cat test-diff-ptr-to-void-ptr-app.c
#include <stddef.h>

typedef void* VOID_PTR;

void
foo(int a __attribute__((unused)),
    char b __attribute__((unused)),
    VOID_PTR c __attribute__((unused)));

int
main()
{
  foo(0, 0, NULL);
  return 0;
}

$ gcc -g -Wall -L0/ -ltest-diff-ptr-to-void-ptr-fn
test-diff-ptr-to-void-ptr-app.c -o test-diff-ptr-to-void-ptr-app
$ abicompat test-diff-ptr-to-void-ptr-app 0/libtest-diff-ptr-to-void-ptr-fn.so 
$ abicompat test-diff-ptr-to-void-ptr-app 1/libtest-diff-ptr-to-void-ptr-fn.so 
functions defined in library '1/libtest-diff-ptr-to-void-ptr-fn.so'
have sub-types that are different from what application
'test-diff-ptr-to-void-ptr-app' expects:

  function void foo(int, char, VOID_PTR):
    parameter 3 of type 'typedef VOID_PTR' changed:
      typedef name changed from VOID_PTR to PTR_TO_FN at
test-diff-ptr-to-void-ptr-fn-v1.c:1:1
      underlying type 'void*' changed:
        in pointed to type 'void':
          entity changed from 'void' to 'function type void (...)'
          type size changed from 0 to 64 (in bits)

$ abidiff  0/libtest-diff-ptr-to-void-ptr-fn.so 
1/libtest-diff-ptr-to-void-ptr-fn.so 
Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added
function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

$ abidiff  --harmless 0/libtest-diff-ptr-to-void-ptr-fn.so 
1/libtest-diff-ptr-to-void-ptr-fn.so 
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 function with some indirect sub-type change:

  [C] 'function void foo(int, char, VOID_PTR)' at
test-diff-ptr-to-void-ptr-fn-v0.c:4:1 has some indirect sub-type changes:
    parameter 3 of type 'typedef VOID_PTR' changed:
      typedef name changed from VOID_PTR to PTR_TO_FN at
test-diff-ptr-to-void-ptr-fn-v1.c:1:1
      underlying type 'void*' changed:
        in pointed to type 'void':
          entity changed from 'void' to 'function type void (...)'
          type size changed from 0 to 64 (in bits)

$ 

Note how 0/libtest-diff-ptr-to-void-ptr-fn.so and
1/libtest-diff-ptr-to-void-ptr-fn.so have a slight harmless ABI change that is
filtered out by default by abidiff, but not by abicompat.

That makes tests/build/runtestabidb1.sh fail on ppc64le running fedora40
because /usr/bin/make expects a libguile.so that has a slight harmless ABI
change with the libguile.so provided.

The exact error is:
https://builder.sourceware.org/testrun/ad48bd119f677c0d2165c0083c3010fe57412634?filename=tests%2Fruntestabidb1.sh.log.

Note that we don't have that error on other versions of Fedora where
/usr/bin/make doesn't depend on libguile.so
  

Comments

mark at klomp dot org June 12, 2025, 3:50 p.m. UTC | #1
https://sourceware.org/bugzilla/show_bug.cgi?id=33076

Dodji Seketeli <dodji at seketeli dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
  
mark at klomp dot org June 12, 2025, 3:52 p.m. UTC | #2
https://sourceware.org/bugzilla/show_bug.cgi?id=33076

--- Comment #1 from Dodji Seketeli <dodji at seketeli dot org> ---
A fix for this is being worked on in the branch
https://sourceware.org/cgit/libabigail/log/?h=users/dodji/abicompat-filter-diff-node
  
mark at klomp dot org June 12, 2025, 11:58 p.m. UTC | #3
https://sourceware.org/bugzilla/show_bug.cgi?id=33076

Dodji Seketeli <dodji at seketeli dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Dodji Seketeli <dodji at seketeli dot org> ---
This bug should be fixed by commit
https://sourceware.org/cgit/libabigail/commit/?id=e3f967cd93d39ed3ff2fcbef2c07c42350d5a11f.

The fix should be available in libabigail 2.8.
  

Patch

--- 0/test-diff-ptr-to-void-ptr-fn-v0.c 2025-06-11 14:58:03.660096563 +0200
+++ 1/test-diff-ptr-to-void-ptr-fn-v1.c 2025-06-11 14:59:23.292433838 +0200
@@ -1,8 +1,8 @@ 
-typedef void* VOID_PTR;
+typedef void (*PTR_TO_FN)(...);

 void
 foo(int a __attribute__((unused)),
     char b __attribute__((unused)),
-    VOID_PTR c __attribute__((unused)))
+    PTR_TO_FN c __attribute__((unused)))
 {
 }