[Bug c/96383] New: Full ABI information missing missing from GCC compiled C

woodard at redhat dot com gcc-bugzilla@gcc.gnu.org
Wed Jul 29 21:20:24 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96383

            Bug ID: 96383
           Summary: Full ABI information missing missing from GCC compiled
                    C
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: woodard at redhat dot com
  Target Milestone: ---

When GCC compiles C and there is a call to an external function the full ABI
information for the function being called doesn't exist in the caller.

For example compiling bzip2 with gcc 10.1.1 this is all that you get for the
function fflush.

 [  93a4]    subprogram           abbrev: 96
             external             (flag_present) yes
             declaration          (flag_present) yes
             linkage_name         (strp) "fflush"
             name                 (strp) "fflush"
             decl_file            (data1) stdio.h (6)
             decl_line            (data1) 218
             decl_column          (data1) 12

However when you compile the same library with clang you get much more
information:

 [  49ec]    subprogram           abbrev: 26
             name                 (strp) "fflush"
             decl_file            (data1) stdio.h (3)
             decl_line            (data1) 218
             prototyped           (flag_present) yes
             type                 (ref4) [  425e]
             declaration          (flag_present) yes
             external             (flag_present) yes
 [  49f7]      formal_parameter     abbrev: 7
               type                 (ref4) [  47c7]

 [  47c7]    pointer_type         abbrev: 3
             type                 (ref4) [  47cc]
 [  47cc]    structure_type       abbrev: 21
             name                 (strp) "_IO_FILE"
             byte_size            (data1) 216
             decl_file            (data1) struct_FILE.h (4)
             decl_line            (data1) 49
 [  47d4]      member               abbrev: 13
               name                 (strp) "_flags"
               type                 (ref4) [  425e]
               decl_file            (data1) struct_FILE.h (4)
               decl_line            (data1) 51
               data_member_location (data1) 0
 [  47e0]      member               abbrev: 13
               name                 (strp) "_IO_read_ptr"
               type                 (ref4) [  4685]
               decl_file            (data1) struct_FILE.h (4)
               decl_line            (data1) 54
               data_member_location (data1) 8
...

This information is useful because it allows you to verify that the library
that the caller is expecting has the same ABI as the function that the callee
is providing.


More information about the Gcc-bugs mailing list