]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix Ada representation of r_debug and link_map types
authorMarc Poulhiès <poulhies@adacore.com>
Thu, 12 Jan 2023 15:13:45 +0000 (16:13 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 16 May 2023 08:30:57 +0000 (10:30 +0200)
Both record types need to have their components 'aliased' to match their
C version. The mismatch could be observed when using LTO:

  warning: type of 'r_debug' does not match original declaration
       [-Wlto-type-mismatch]

  /usr/include/link.h:66:23: note: type 'struct r_debug' should match
  type 'struct  system__traceback__symbolic__module_name__build_...
   ...cache_for_all_modules__r_debug_type'

gcc/ada/

* libgnat/s-tsmona__linux.adb (link_map, r_debug_type): Add
'aliased' on all components.

gcc/ada/libgnat/s-tsmona__linux.adb

index 7e1b493c9915c2d331d6fbcbd51944a52c02d94e..6b539f13c16af26a4611f2fc6a344497a41c080a 100644 (file)
@@ -93,23 +93,30 @@ package body Module_Name is
       pragma Convention (C, link_map_acc);
 
       type link_map is record
-         l_addr : Address;
+         l_addr : aliased Address;
          --  Base address of the shared object
 
-         l_name : Address;
+         l_name : aliased Address;
          --  Null-terminated absolute file name
 
-         l_ld   : Address;
+         l_ld   : aliased Address;
          --  Dynamic section
 
-         l_next, l_prev : link_map_acc;
+         l_next, l_prev : aliased link_map_acc;
          --  Chain
       end record;
       pragma Convention (C, link_map);
 
+      type r_debug_state is (RT_CONSISTENT, RT_ADD, RT_DELETE);
+      pragma Convention (C, r_debug_state);
+      pragma Unreferenced (RT_CONSISTENT, RT_ADD, RT_DELETE);
+
       type r_debug_type is record
-         r_version : Integer;
-         r_map : link_map_acc;
+         r_version : aliased int;
+         r_map     : aliased link_map_acc;
+         r_brk     : aliased Address;
+         r_state   : aliased r_debug_state;
+         r_ldbase  : aliased Address;
       end record;
       pragma Convention (C, r_debug_type);