From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24119 invoked by alias); 7 Sep 2006 13:38:41 -0000 Received: (qmail 24102 invoked by uid 22791); 7 Sep 2006 13:38:41 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 07 Sep 2006 13:38:38 +0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id k87DcQaA011025; Thu, 7 Sep 2006 15:38:26 +0200 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id k87DcMUs011017; Thu, 7 Sep 2006 15:38:22 +0200 Date: Thu, 07 Sep 2006 13:38:00 -0000 From: Jakub Jelinek To: Ulrich Drepper , Steven Munroe Cc: Glibc hackers Subject: [PATCH] Fix ppc32 lrint (BZ #3155) Message-ID: <20060907133822.GX4556@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00012.txt.bz2 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 [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 /* 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