From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: "Marc Poulhiès" <poulhies@adacore.com>
Subject: [COMMITTED] ada: Fix Ada representation of r_debug and link_map types
Date: Tue, 16 May 2023 10:40:48 +0200 [thread overview]
Message-ID: <20230516084048.1501804-1-poulhies@adacore.com> (raw)
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/libgnat/s-tsmona__linux.adb | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/libgnat/s-tsmona__linux.adb b/gcc/ada/libgnat/s-tsmona__linux.adb
index 7e1b493c991..6b539f13c16 100644
--- a/gcc/ada/libgnat/s-tsmona__linux.adb
+++ b/gcc/ada/libgnat/s-tsmona__linux.adb
@@ -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);
--
2.40.0
reply other threads:[~2023-05-16 8:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230516084048.1501804-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).