From patchwork Sat Jan 23 22:52:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Pluzhnikov X-Patchwork-Id: 10533 Received: (qmail 39215 invoked by alias); 23 Jan 2016 22:52:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 39138 invoked by uid 89); 23 Jan 2016 22:52:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=no version=3.3.2 spammy=786, 376, rsi, lifting X-HELO: mail-wm0-f48.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=nnUWPonbgwx61Gx4beolboekzoQ6wJQYpmCiTD2CoHs=; b=VLG+oiyvysbGHlljfAun7fxjDoYRl+SOr/VAFANuoPQtWPokr3hpW5K+/GfJdoMOKp NeXWdi549WzEV8pvahCIv3AOagYOIgXPSdsjr5kehOFf5WYKufGoiox8hTaBuJtGk1/N W+w8/uebL65IIobPPIhfJOCIzhuFtj3NSThFBm25Fx+JvszAyQGOF1H5ymex4ob/FeSq 4chHxZmPAvM+nb+ASvgx5lOC51fwpcGveuEkEJZHdSDX8c94UtiwPBvMKkBFwK/Jd6uW K5SXG01GYSmM9cyhMdYUHMS+7qshfX5mzrxk4SMxitNR/no4N8UqDp5NAU/U5VT92lGf bkoA== X-Gm-Message-State: AG10YOS7ui1H5H1SvdkO/fgwRrpIBpLTsTJpDXSBLvgT8sSQQPg/wlxYhRwAW1CBtaN6WZHhPN9pAvNGZyHOJWnY X-Received: by 10.28.127.87 with SMTP id a84mr10059913wmd.83.1453589552943; Sat, 23 Jan 2016 14:52:32 -0800 (PST) MIME-Version: 1.0 From: Paul Pluzhnikov Date: Sat, 23 Jan 2016 14:52:02 -0800 Message-ID: Subject: [PATCH][BZ #19490] Add unwind descriptors for x86_64 _mcount and __fentry__ To: GLIBC Devel Greetings, Attached patch adds unwind descriptors for x86_64 _mcount and __fentry__. Tested on Linux/x86_64, no failures. Assuming this is OK, should I wait for lifting of the freeze? Thanks, 2016-01-23 Paul Pluzhnikov [BZ #19490] * sysdeps/x86_64/_mcount.S (_mcount): Add unwind descriptor. (__fentry__): Likewise diff --git a/sysdeps/x86_64/_mcount.S b/sysdeps/x86_64/_mcount.S index 5d7edd2..5f186be 100644 --- a/sysdeps/x86_64/_mcount.S +++ b/sysdeps/x86_64/_mcount.S @@ -28,8 +28,10 @@ .type C_SYMBOL_NAME(_mcount), @function .align ALIGNARG(4) C_LABEL(_mcount) + cfi_startproc /* Allocate space for 7 registers. */ subq $56,%rsp + cfi_adjust_cfa_offset (56) movq %rax,(%rsp) movq %rcx,8(%rsp) movq %rdx,16(%rsp) @@ -37,6 +39,13 @@ C_LABEL(_mcount) movq %rdi,32(%rsp) movq %r8,40(%rsp) movq %r9,48(%rsp) + cfi_rel_offset (rax, 0) + cfi_rel_offset (rcx, 8) + cfi_rel_offset (rdx, 16) + cfi_rel_offset (rsi, 24) + cfi_rel_offset (rdi, 32) + cfi_rel_offset (r8, 40) + cfi_rel_offset (r9, 48) /* Setup parameter for __mcount_internal. */ /* selfpc is the return address on the stack. */ @@ -58,7 +67,16 @@ C_LABEL(_mcount) movq 8(%rsp),%rcx movq (%rsp),%rax addq $56,%rsp + cfi_restore (r9) + cfi_restore (r8) + cfi_restore (rdi) + cfi_restore (rsi) + cfi_restore (rdx) + cfi_restore (rcx) + cfi_restore (rax) + cfi_adjust_cfa_offset (-56) ret + cfi_endproc ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount)) @@ -69,8 +87,10 @@ weak_alias (_mcount, mcount) .type C_SYMBOL_NAME(__fentry__), @function .align ALIGNARG(4) C_LABEL(__fentry__) - /* Allocate space for 7 registers. */ + cfi_startproc + /* Allocate space for 7 registers (+8 for proper stack alignment). */ subq $64,%rsp + cfi_adjust_cfa_offset (64) movq %rax,(%rsp) movq %rcx,8(%rsp) movq %rdx,16(%rsp) @@ -78,6 +98,13 @@ C_LABEL(__fentry__) movq %rdi,32(%rsp) movq %r8,40(%rsp) movq %r9,48(%rsp) + cfi_rel_offset (rax, 0) + cfi_rel_offset (rcx, 8) + cfi_rel_offset (rdx, 16) + cfi_rel_offset (rsi, 24) + cfi_rel_offset (rdi, 32) + cfi_rel_offset (r8, 40) + cfi_rel_offset (r9, 48) /* Setup parameter for __mcount_internal. */ /* selfpc is the return address on the stack. */ @@ -98,7 +125,16 @@ C_LABEL(__fentry__) movq 16(%rsp),%rdx movq 8(%rsp),%rcx movq (%rsp),%rax + cfi_restore (r9) + cfi_restore (r8) + cfi_restore (rdi) + cfi_restore (rsi) + cfi_restore (rdx) + cfi_restore (rcx) + cfi_restore (rax) addq $64,%rsp + cfi_adjust_cfa_offset (-64) ret + cfi_endproc ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(__fentry__))