From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>, Steven Munroe <sjmunroe@us.ibm.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix ppc32 lrint (BZ #3155)
Date: Thu, 07 Sep 2006 13:38:00 -0000 [thread overview]
Message-ID: <20060907133822.GX4556@sunsite.mff.cuni.cz> (raw)
Hi!
PPC32 ABI forbids stack accesses below r1 (unlike PPC64 ABI).
The following patch fixes lrint which was violating this (detected by
valgrind).
There are 4 other ppc32 files that violate this:
libc/sysdeps/powerpc/powerpc32/fpu/fprrest.S
libc/sysdeps/powerpc/powerpc32/fpu/fprsave.S
libc/sysdeps/powerpc/powerpc32/gprrest0.S
libc/sysdeps/powerpc/powerpc32/gprsave0.S
The stubs from those files aren't exported from libc.so.6 nor actually
used for anything there, so I wonder if we can't nuke them altogether,
or if they should move to libc_nonshared.a after making all the functions
.hidden there. GCC provides (some of) the PPC32 ABI mandates stubs
in crtsavres.o (and there it accesses memory below r11, not r1),
so I'm not 100% if we need these at all.
2006-09-07 Jakub Jelinek <jakub@redhat.com>
[BZ #3155]
* sysdeps/powerpc/powerpc32/fpu/s_lrint.S (__lrint): Don't access
stack below r1.
--- libc/sysdeps/powerpc/powerpc32/fpu/s_lrint.S.jj 2006-01-29 21:10:24.000000000 +0100
+++ libc/sysdeps/powerpc/powerpc32/fpu/s_lrint.S 2006-09-07 15:23:38.000000000 +0200
@@ -21,13 +21,15 @@
#include <math_ldbl_opt.h>
/* long int[r3] __lrint (double x[fp1]) */
-ENTRY (__lrint)
+ENTRY (__lrint)
+ stwu r1,-16(r1)
fctiw fp13,fp1
- stfd fp13,-8(r1)
+ stfd fp13,8(r1)
nop /* Insure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
- lwz r3,-4(r1)
+ lwz r3,12(r1)
+ addi r1,r1,16
blr
END (__lrint)
Jakub
next reply other threads:[~2006-09-07 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-07 13:38 Jakub Jelinek [this message]
2006-09-07 13:47 ` Ulrich Drepper
2006-09-07 16:18 ` Steven Munroe
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=20060907133822.GX4556@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
--cc=sjmunroe@us.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).