Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Peter Bergner via Gdb <gdb@sourceware.org>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Sachin Monga <smonga@linux.ibm.com>,
	libc-help@sourceware.org,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	gdb@sourceware.org
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
	Michael Meissner <meissner@linux.ibm.com>,
	Surya Kumari Jangala <jskumari@linux.ibm.com>,
	Carl Love <carll@us.ibm.com>
Subject: Re: [EXT] Re: gdb does not stop at printf for ppc
Date: Thu, 2 Oct 2025 10:57:22 -0500	[thread overview]
Message-ID: <d0e6a644-bac1-4727-90cc-b60f209aea13@tenstorrent.com> (raw)
In-Reply-To: <0535055f-7a42-4390-b134-34b8e3ee657e@linaro.org>

Fixing Carl's email.  It seems his old address doesn't work anymore.


>> On 9/25/25 2:47 AM, Sachin Monga wrote:
>>>
>>> There is a test case in GDB where printf is getting converted into 
>>> __printfieee128 when program is compiled with "--no-builtin" flag.
>>> The program is working fine on a machine with glibc 2.34, but not on 
>>> another machine where glibc 2.40 is installed.


> On 01/10/25 01:03, Peter Bergner via Libc-help wrote:
>>
>> There is actually a GLIBC bugzilla about this and it's not just printf,
>> but all IEEE 128-bit floating point functions.  I've assigned it to you now! :-)
>> I don't remember if the solution in Carl's last comment was actually decided
>> to be the correct way to "fix" this though:
>>
>>   https://sourceware.org/bugzilla/show_bug.cgi?id=29989


On 10/1/25 12:20 PM, Adhemerval Zanella Netto wrote:
> This is not only an issue for IBM float128 support, but rather for other places
> that we use asm alias (for instance 64 bit time support on some 32 bits abis,
> fortify support for some symbols that route to _chk variants, etc.).

Ok, it's an even bigger problem than we thought.  I'm surprised no one
else has hit this before us.




> And I think Carl's suggestion might work [1], with the following:
> 
> ---
> diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c
> index 7b1640ceac..d567d98c68 100644
> --- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c
> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c
> @@ -33,3 +33,6 @@ ___ieee128_printf (const char *format, ...)
>    return done;
>  }
>  strong_alias (___ieee128_printf, __printfieee128)
> +
> +asm (".local printf\n"
> +     ".set printf, __printfieee128");
> ---
> 
> Breaking point at printf does work:
> 
> ---
> $ cat printf.c
> #include <stdio.h>
> 
> int main (int argc, char *argv[])
> {
>   printf ("%La\n", 1.2345L);
> }
> $ powerpc64le-glibc-linux-gnu-gcc -mabi=ieeelongdouble printf.c -o printf
> $ gdb -ex 'set breakpoint pending on' -ex 'b printf' -ex 'r' ./tst-printf-ieeelongdouble
> [...]
> Breakpoint 1.2, 0x00007ffff7c92528 in ___ieee128_printf (format=format@entry=0x100000d88 "%La\n") at ../sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c:24
> 24      {
> ---
> 
> I don't think we have a better solution, attribute (alias) requires the
> target symbol to be pre-defined (which would require to reestructure how
> the long double alias as done); nor I think the compiler will be able to
> easy synthesize it because afaiu this need to done at the TU of the
> alternative implementation.

Ok, this is promising and yeah, is what Carl and Uli suggested.
That said, their comment from the bugzilla:

    The new redirected symbols need to be dynamic symbols in case only
    the stripped binary is available.

Does your solution work if you strip your test case?


Peter



  reply	other threads:[~2025-10-02 15:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f4e905f7-48cb-439a-a8e6-a50242c18e6a@linux.ibm.com>
2025-10-01  4:03 ` Peter Bergner via Gdb
2025-10-01 17:20   ` Adhemerval Zanella Netto via Gdb
2025-10-02 15:57     ` Peter Bergner via Gdb [this message]
2025-10-02 16:19       ` [EXT] " Carl Love via Gdb
2025-10-02 16:58       ` Florian Weimer via Gdb
2025-10-02 18:12         ` Peter Bergner via Gdb
2025-10-02 18:49           ` Billie Alsup (balsup) via Gdb
2025-10-02 19:09             ` Peter Bergner via Gdb
2025-10-03 19:43     ` Tom Tromey
2025-10-07 17:21       ` Adhemerval Zanella Netto via Gdb
2025-10-15 14:33         ` [EXT] " Peter Bergner via Gdb
2025-10-15 17:09           ` Sachin Monga via Gdb
2025-11-05  6:00             ` Sachin Monga via Gdb
2025-11-06  4:13               ` Peter Bergner via Gdb

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=d0e6a644-bac1-4727-90cc-b60f209aea13@tenstorrent.com \
    --to=gdb@sourceware.org \
    --cc=adhemerval.zanella@linaro.org \
    --cc=bergner@tenstorrent.com \
    --cc=carll@us.ibm.com \
    --cc=jskumari@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-help@sourceware.org \
    --cc=meissner@linux.ibm.com \
    --cc=segher@kernel.crashing.org \
    --cc=smonga@linux.ibm.com \
    /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