From patchwork Tue Nov 6 21:44:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 30048 Received: (qmail 48529 invoked by alias); 6 Nov 2018 21:44:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 48305 invoked by uid 89); 6 Nov 2018 21:44:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, 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=Hx-languages-length:2038, H*RU:209.85.210.194, Hx-spam-relays-external:209.85.210.194, HX-HELO:sk:mail-pf X-HELO: mail-pf1-f194.google.com Received: from mail-pf1-f194.google.com (HELO mail-pf1-f194.google.com) (209.85.210.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Nov 2018 21:44:11 +0000 Received: by mail-pf1-f194.google.com with SMTP id g7-v6so4452195pfo.10 for ; Tue, 06 Nov 2018 13:44:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YX/2QKMGc7gbqte916Pzn6J6CzRSRFTc2rKAr0dXB4I=; b=lCkb7J9Uz47L59W29Z+mleyje4O5CKZmvqbz5Ve0/wNVJoQno7Cptyx8ge+LqUUzFb WYsBNVWugzjLSEXMav65nuLEeKOkIFKKiruGrgE3ToH1+z0y1QfEThH4qAcze9RiiP45 /uUNycgvc418/Z2tD9q3fteHcEV9vHPKXqtMm5f5FWutSGGSr8Ksag3+54jGOOVxuHKx 1S0rS+TfrD9oVISLn1XAOt+FfU3DxKGCfM64uFtq1K0Ot/Y5SPmebupkYUEwIdmSZeua Q1EmlA3EKXrkKCgrkVcw+//r7XQ4Ka3BZ6zuO+tcGlwS1T7r0Mr6RvIu/muCqpkmjORP FMKQ== Return-Path: Received: from rohan.guest.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id n82-v6sm61390627pfg.21.2018.11.06.13.44.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 13:44:09 -0800 (PST) From: Jim Wilson To: gdb-patches@sourceware.org Cc: Jim Wilson Subject: [PATCH 1/3] RISC-V: gdb.base/gnu_vector fixes. Date: Tue, 6 Nov 2018 13:44:03 -0800 Message-Id: <20181106214403.22192-1-jimw@sifive.com> In-Reply-To: References: Ensure that stack slots are always the same size as XLEN by rounding up arg sizes when computing the address of the next stack slot. gdb/ * riscv-tdep.c (riscv_assign_stack_location): New arg slot_align. Use with align_up when setting arg_offset. (riscv_call_arg_scalar_int): Call riscv_assign_stack_location with cinfo->xlen as new arg. --- gdb/riscv-tdep.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index db372e2163..ac4f2533f4 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -1868,13 +1868,13 @@ riscv_assign_reg_location (struct riscv_arg_info::location *loc, static void riscv_assign_stack_location (struct riscv_arg_info::location *loc, struct riscv_memory_offsets *memory, - int length, int align) + int length, int align, int slot_align) { loc->loc_type = riscv_arg_info::location::on_stack; memory->arg_offset = align_up (memory->arg_offset, align); loc->loc_data.offset = memory->arg_offset; - memory->arg_offset += length; + memory->arg_offset += align_up (length, slot_align); loc->c_length = length; /* Offset is always 0, either we're the first location part, in which @@ -1919,7 +1919,7 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo, cinfo->xlen, 0)) riscv_assign_stack_location (&ainfo->argloc[1], &cinfo->memory, cinfo->xlen, - cinfo->xlen); + cinfo->xlen, cinfo->xlen); } else { @@ -1928,7 +1928,8 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo, if (!riscv_assign_reg_location (&ainfo->argloc[0], &cinfo->int_regs, len, 0)) riscv_assign_stack_location (&ainfo->argloc[0], - &cinfo->memory, len, ainfo->align); + &cinfo->memory, len, ainfo->align, + cinfo->xlen); if (len < ainfo->length) { @@ -1937,7 +1938,8 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo, &cinfo->int_regs, len, cinfo->xlen)) riscv_assign_stack_location (&ainfo->argloc[1], - &cinfo->memory, len, cinfo->xlen); + &cinfo->memory, len, cinfo->xlen, + cinfo->xlen); } } }