From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17457 invoked by alias); 31 May 2012 04:04:34 -0000 Received: (qmail 17433 invoked by uid 22791); 31 May 2012 04:04:32 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_DD X-Spam-Check-By: sourceware.org Received: from mail-pb0-f41.google.com (HELO mail-pb0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 31 May 2012 04:04:19 +0000 Received: by pbbrp2 with SMTP id rp2so902445pbb.0 for ; Wed, 30 May 2012 21:04:18 -0700 (PDT) Received: by 10.68.239.161 with SMTP id vt1mr1537810pbc.15.1338437058715; Wed, 30 May 2012 21:04:18 -0700 (PDT) Received: from anchor.twiddle.home ([173.160.232.49]) by mx.google.com with ESMTPS id rs3sm2727422pbc.47.2012.05.30.21.04.17 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 May 2012 21:04:18 -0700 (PDT) From: Richard Henderson To: libc-ports@sourceware.org Subject: [PATCH 1/2] alpha: Fix error path for PIC __brk Date: Thu, 31 May 2012 04:04:00 -0000 Message-Id: <1338437052-11536-1-git-send-email-rth@twiddle.net> X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00208.txt.bz2 A new build of qemu, which is almost certainly buggy, fails the first brk syscall, which lead me to discover that the error path for brk was incorrect. The SYSCALL_ERROR_HANDLER into which it appears that we are dropping is empty for the pic build, so we actually drop into the next function which caused all sorts of mahem. r~ ChangeLog.alpha | 2 ++ sysdeps/unix/sysv/linux/alpha/brk.S | 32 ++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) * sysdeps/unix/sysv/linux/alpha/brk.S: Fix error path for PIC. diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S index 826d737..cb759db 100644 --- a/sysdeps/unix/sysv/linux/alpha/brk.S +++ b/sysdeps/unix/sysv/linux/alpha/brk.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1993-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe , 1993. @@ -36,16 +36,22 @@ __curbrk: .skip 8 #endif .text -LEAF(__brk, 8) + .align 4 + .globl __brk + .ent __brk + .usepv __brk, std + + cfi_startproc +__brk: ldgp gp, 0(t12) - subq sp, 8, sp + subq sp, 16, sp + cfi_adjust_cfa_offset (16) #ifdef PROF .set noat lda AT, _mcount jsr AT, (AT), _mcount .set at #endif - .prologue 1 /* Save the requested brk across the system call. */ stq a0, 0(sp) @@ -54,27 +60,25 @@ LEAF(__brk, 8) call_pal PAL_callsys ldq a0, 0(sp) + addq sp, 16, sp + cfi_adjust_cfa_offset (-16) /* Be prepared for an OSF-style brk. */ - bne a3, $err1 + bne a3, SYSCALL_ERROR_LABEL beq v0, $ok /* Correctly handle the brk(0) query case. */ cmoveq a0, v0, a0 xor a0, v0, t0 - bne t0, $err0 + lda v0, ENOMEM + bne t0, SYSCALL_ERROR_LABEL /* Update __curbrk and return cleanly. */ - mov zero, v0 + lda v0, 0 $ok: stq a0, __curbrk - addq sp, 8, sp ret - /* What a horrible way to die. */ -$err0: ldi v0, ENOMEM -$err1: addq sp, 8, sp - SYSCALL_ERROR_HANDLER - - END(__brk) +PSEUDO_END(__brk) + cfi_endproc weak_alias (__brk, brk) -- 1.7.7.6