* [PATCH] Fix ppc32 lrint (BZ #3155)
@ 2006-09-07 13:38 Jakub Jelinek
2006-09-07 13:47 ` Ulrich Drepper
2006-09-07 16:18 ` Steven Munroe
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2006-09-07 13:38 UTC (permalink / raw)
To: Ulrich Drepper, Steven Munroe; +Cc: Glibc hackers
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix ppc32 lrint (BZ #3155)
2006-09-07 13:38 [PATCH] Fix ppc32 lrint (BZ #3155) Jakub Jelinek
@ 2006-09-07 13:47 ` Ulrich Drepper
2006-09-07 16:18 ` Steven Munroe
1 sibling, 0 replies; 3+ messages in thread
From: Ulrich Drepper @ 2006-09-07 13:47 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
[-- Attachment #1: Type: text/plain, Size: 101 bytes --]
Applied.
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix ppc32 lrint (BZ #3155)
2006-09-07 13:38 [PATCH] Fix ppc32 lrint (BZ #3155) Jakub Jelinek
2006-09-07 13:47 ` Ulrich Drepper
@ 2006-09-07 16:18 ` Steven Munroe
1 sibling, 0 replies; 3+ messages in thread
From: Steven Munroe @ 2006-09-07 16:18 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers
Jakub Jelinek wrote:
>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.
>
I am not sure where these came from or their history. As you say they
don't match the Linux ABI but we can get away with this because of the
way the kernel's signal.c builds signal frames. Not something we should
depend on. Easiest to just remove them from sysdeps/powerpc/powerpc32.
Looks like they do match the AIX xcoff ABI. So perhaps they should be
moved to sysdeps/unix/sysv/aix. I don't know who if any one is
maintaining the AIX code in libc. I'll check around.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-09-07 16:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-07 13:38 [PATCH] Fix ppc32 lrint (BZ #3155) Jakub Jelinek
2006-09-07 13:47 ` Ulrich Drepper
2006-09-07 16:18 ` Steven Munroe
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).