From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 30D1C38FEF5C; Thu, 6 Jun 2024 12:35:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30D1C38FEF5C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1717677319; bh=Qo8WW1odwT9anWzD/NLfL4FFaHoX+iUu/IWfw4wmgNk=; h=From:To:Subject:Date:From; b=vhdoQnOLJvyX2uCnX4WziId3je29TmrYWp3a20BImmmrT5STVRo6RzXefJOMXJ/qy PuEEIfW7hnOeAFQpjMIptZGRpknfMOTnSTvR1eUFFUJLWIYq4g5fhW+MfDDJbINtoa 3tHmscM8KivlU/xGdXTFf3fBcMhAj4pk7YAXvXzo= From: "marian.buschsieweke at posteo dot net" To: gdb-prs@sourceware.org Subject: [Bug gdb/31851] New: GDB ignores absolute function symbols Date: Thu, 06 Jun 2024 12:35:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 14.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marian.buschsieweke at posteo dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31851 Bug ID: 31851 Summary: GDB ignores absolute function symbols Product: gdb Version: 14.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: marian.buschsieweke at posteo dot net Target Milestone: --- Hi, for xtensa-esp32-elf targets some functions end up being absolute symbols. I created a simple proof of concept that does not require exotic targets (e= .g. I used this on x86_64 / Linux): main.c: extern void func(void); int main(void) { func(); return 0; } func.c: #include void func_impl(void) { puts("Hello from func"); } And I used a custom linker script that is based on the default linker scrip= t, but I added the following line: PROVIDE(func =3D ABSOLUTE(func_impl)); With nm I can confirm that func_impl is a regular function symbol (section .text) and func is an absolute symbol (section *ABS*) at the same address. = When I try to create a break point I get Function "func" not defined. When I change the linker script to use PROVIDE(func =3D func_impl); I get a regular symbol for func (section .text) and setting the break point just works: (gdb) break func Breakpoint 1 at 0x1199: file func.c, line 5. To my understanding this is a bug, as GDB should not ignore absolute functi= on symbols. (Context: There is no special handling of functions that end up as absolute symbols in either the C code or the linker script, so there is no obvious reason why those functions do end up being absolute. My wild guess is that those functions are being called from functions that get placed in flash as well as from functions that are placed in instruction RAM. I would happily apply any change that would prevent functions from becoming absolute symbol= s, if someone knows what could cause this. I do however believe that there is a valid use case for function symbols being explicitly absolute symbols: E.g.= on the RP2040 MCU there are functions in Mask ROM. So even if I could fix this= on my side by not having functions as absolute symbols, I do think that GDB sh= ould be prepared to handle functions that are absolute symbols.) Kind regards, Marian --=20 You are receiving this mail because: You are on the CC list for the bug.=