From patchwork Wed Aug 1 22:23:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 952438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-94987-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=twiddle.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AUW5hRh8"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41gnsm02bwz9s3q for ; Thu, 2 Aug 2018 08:24:27 +1000 (AEST) Received: (qmail 24395 invoked by alias); 1 Aug 2018 22:24:00 -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 24267 invoked by uid 89); 1 Aug 2018 22:23:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=PROF, Jump X-HELO: mail-ua0-f173.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=sOhRp65/pGulKyAWQDLjGPI89+CTFVdgL3WNY/sc4X4=; b=AUW5hRh81h5n8nP4IbeGivMSIWMtM9SKr4mkjg9yZYmN8atGBDfDCYzvba79PiRxUo krJ33cOIFsOQnfRi/n3vUiy77hTOSXwQwNN05uX/qgQC1EomLcLNFcG1awAkNMBb4qS3 /kysswfSrYKnoc1r3+bk55t4yjg2IQBWN8AjZiQLPU7vCnMF94tGACb59FMNxRYtWXMO q+EaKhR1LTY4IDUnjlvvThm0GwJLgads7XwOmBN6N3cCrp+VEsiTqzQhcWplDR71Ne13 NgVqK+kWVa09qSO/aDAm/snG4L0EAcW8CUzZNOswknoCYAeU1BHZzDWuZHa1I2NEoHo4 Tynw== Sender: Richard Henderson From: rth@twiddle.net To: libc-alpha@sourceware.org Cc: marcus.shawcroft@linaro.org, szabolcs.nagy@arm.com, Richard Henderson Subject: [PATCH 1/3] aarch64: Clean up _dl_runtime_resolve Date: Wed, 1 Aug 2018 18:23:45 -0400 Message-Id: <20180801222347.18903-2-rth@twiddle.net> In-Reply-To: <20180801222347.18903-1-rth@twiddle.net> References: <20180801222347.18903-1-rth@twiddle.net> From: Richard Henderson * sysdeps/aarch64/dl-trampoline.S (_dl_runtime_resolve): Do not record unwind info for arguments; this is unneeded; do not save x9 just to have a register to pair with x8; properly include the 16 bytes of PLT stack into the unwind; create a frame pointer with the spare stack slot; rearrange the exit to only adjust the stack once. --- sysdeps/aarch64/dl-trampoline.S | 50 +++++++++------------------------ 1 file changed, 14 insertions(+), 36 deletions(-) diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index a86d0722d4..e8e2af485a 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -32,7 +32,6 @@ .text .globl _dl_runtime_resolve .type _dl_runtime_resolve, #function - cfi_startproc .align 2 _dl_runtime_resolve: /* AArch64 we get called with: @@ -41,46 +40,24 @@ _dl_runtime_resolve: [sp, #8] lr [sp, #0] &PLTGOT[n] */ - + cfi_startproc + cfi_adjust_cfa_offset(16) /* Incorporate PLT */ cfi_rel_offset (lr, 8) /* Save arguments. */ - stp x8, x9, [sp, #-(80+8*16)]! + stp x29, x8, [sp, #-(80+8*16)]! cfi_adjust_cfa_offset (80+8*16) - cfi_rel_offset (x8, 0) - cfi_rel_offset (x9, 8) + cfi_rel_offset (x29, 0) + mov x29, sp stp x6, x7, [sp, #16] - cfi_rel_offset (x6, 16) - cfi_rel_offset (x7, 24) - stp x4, x5, [sp, #32] - cfi_rel_offset (x4, 32) - cfi_rel_offset (x5, 40) - stp x2, x3, [sp, #48] - cfi_rel_offset (x2, 48) - cfi_rel_offset (x3, 56) - stp x0, x1, [sp, #64] - cfi_rel_offset (x0, 64) - cfi_rel_offset (x1, 72) - stp q0, q1, [sp, #(80+0*16)] - cfi_rel_offset (q0, 80+0*16) - cfi_rel_offset (q1, 80+1*16) - stp q2, q3, [sp, #(80+2*16)] - cfi_rel_offset (q0, 80+2*16) - cfi_rel_offset (q1, 80+3*16) - stp q4, q5, [sp, #(80+4*16)] - cfi_rel_offset (q0, 80+4*16) - cfi_rel_offset (q1, 80+5*16) - stp q6, q7, [sp, #(80+6*16)] - cfi_rel_offset (q0, 80+6*16) - cfi_rel_offset (q1, 80+7*16) /* Get pointer to linker struct. */ ldr PTR_REG (0), [ip0, #-PTR_SIZE] @@ -101,25 +78,26 @@ _dl_runtime_resolve: mov ip0, x0 /* Get arguments and return address back. */ - ldp q0, q1, [sp, #(80+0*16)] - ldp q2, q3, [sp, #(80+2*16)] - ldp q4, q5, [sp, #(80+4*16)] + ldr lr, [sp, #80+8*16+8] ldp q6, q7, [sp, #(80+6*16)] + ldp q4, q5, [sp, #(80+4*16)] + ldp q2, q3, [sp, #(80+2*16)] + ldp q0, q1, [sp, #(80+0*16)] ldp x0, x1, [sp, #64] ldp x2, x3, [sp, #48] ldp x4, x5, [sp, #32] ldp x6, x7, [sp, #16] - ldp x8, x9, [sp], #(80+8*16) - cfi_adjust_cfa_offset (-(80+8*16)) - - ldp ip1, lr, [sp], #16 - cfi_adjust_cfa_offset (-16) + ldp x29, x8, [sp], 80+8*16+16 + cfi_adjust_cfa_offset (-(80+8*16+16)) + cfi_restore (lr) + cfi_restore (x29) /* Jump to the newly found address. */ br ip0 cfi_endproc .size _dl_runtime_resolve, .-_dl_runtime_resolve + #ifndef PROF .globl _dl_runtime_profile .type _dl_runtime_profile, #function