From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id A27243858C98 for ; Wed, 20 Mar 2024 23:30:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A27243858C98 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A27243858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710977439; cv=none; b=CAAEPJS4v7yOV2lAot9i5tf3RSI+4ZKFPlEtl978nJ6fs0aysP+SHaVvv2lMSeGsKKD54/J10ZbzFxWpsdbgIw7djXi7VNYuPKh8WXicOKKQ3zbcy0rzIFTqPJbArmdq0ayj5f4n2EyVv8w1XvM8w+rqCucmwWeiqYJGe458kdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710977439; c=relaxed/simple; bh=6W+wbIy07NkLDhjrPZnyJalPujh3qdbgtVvmBIgTHxw=; h=DKIM-Signature:Date:Subject:From:To:Message-ID:Mime-Version; b=q8EyfNRaFmDZhGBU/6VbUyapae1jQ1MoB3vAUqqjaaHlK76x148JbYMXLoZ0FPK7+EwauEFxDutsh+FVS+eYG9AMkG1EitvEhKUTKu6f0qEr5Rl+hnSL5QqhiXzfWa9TOY2nPhU+1XKig96CrZtBixJdrnRFWg6ZikyP8hXsEY8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1def3340682so2700465ad.1 for ; Wed, 20 Mar 2024 16:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20230601.gappssmtp.com; s=20230601; t=1710977435; x=1711582235; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=9cReH1vp4HM+8MyeTACRJSvkS2K5TVGwyEfFZ+3/Vlo=; b=Uis9dY7Bo1AvR49IJF6f2okGwdT34InWxKZ1EzH4CfV7mv5drl6jRctqqLEqH9eaQU cxyTdrfzyj5Muv4cgK1wfyJHWBB25pY4veSgf/oYboAZLrCAJPROvTBlqVheRrZIWu6m vdhHkvjo9MJ9eS4rw5pEjOdS+W7vOio3rwc6Mw6nJ+q/FXadBMjo4u4fGxREHkmITSp9 spSpqB0THAOTtBkdY3725JfI6e8iDE8ZhoteZoLygha7VcHA26XZNL5xAkTVQUomdTSh R2NUR3ZekokOtV4fO9OkwBcDbcPun3kUM4UaellGU4hnYXUpj8TLcL4R8oXHSA26VTX2 ZxIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710977435; x=1711582235; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9cReH1vp4HM+8MyeTACRJSvkS2K5TVGwyEfFZ+3/Vlo=; b=pXCsTqmsDf+QxSGX8GEBd61EpJxPg4z2Lw9+kGCDG2hsjgLSNal6mMA8v+S+qwC9Ta VdjLhHkp0uHJrOq4pcZe7lGkhYe95abofMwg5wF+BRLlVUmKo6HAJq8QL0Zdn8K1AEZ8 Z2bou1tso82M8XYAei0762Tl3yyuMgXIas/keTerIk9PHj5tguXKf3ZOtXFjnmFwg/6J ZtOX9hAsPVKZBTjFXO17UL1jRHrCQ4Gp+fFeHPArd5aTra8KHaKW0K+tnZCMPvB28yZM tTdfrxlvizHFD769sDiYnJMQo31Cm2OnzYaPdz2lYUhC5+hRQI4paZ8t6jdsi124hFRt rz6g== X-Gm-Message-State: AOJu0Yx289hVfL6Is9lw6+FnKHbakAOPDRxk2/I4YB+MbwtbC6gfCNlC XuHs90f3hN9YxCG2yBrvrbpem5rj7OJJNLB7p8xN6Qq6923LJEvDxJi0Umd9aE0eaWMCzoDBS1/ l X-Google-Smtp-Source: AGHT+IHngAd11LudRc02uGd0F0DVU8ytB4moTs00uSdDIpCCtANcBlIYZ5+IVfsRS14LiplbvHjyRw== X-Received: by 2002:a17:902:6f01:b0:1e0:2590:9b14 with SMTP id w1-20020a1709026f0100b001e025909b14mr7088732plk.6.1710977435067; Wed, 20 Mar 2024 16:30:35 -0700 (PDT) Received: from localhost ([50.213.54.97]) by smtp.gmail.com with ESMTPSA id b10-20020a170903228a00b001e01c1124absm7644330plh.171.2024.03.20.16.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 16:30:34 -0700 (PDT) Date: Wed, 20 Mar 2024 16:30:34 -0700 (PDT) X-Google-Original-Date: Wed, 20 Mar 2024 16:30:31 PDT (-0700) Subject: Re: [PATCH] riscv: Partial implementation of flatten_aggregate In-Reply-To: <20240320231530.GM8319@gnu.wildebeest.org> CC: elfutils-devel@sourceware.org From: Palmer Dabbelt To: mark@klomp.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 20 Mar 2024 16:15:30 PDT (-0700), mark@klomp.org wrote: > Hi Palmer, > > On Wed, Mar 20, 2024 at 01:17:14PM -0700, Palmer Dabbelt wrote: >> >+flatten_aggregate_arg (Dwarf_Die *typedie, >> >+ Dwarf_Word size, >> >+ Dwarf_Die *arg0, >> >+ Dwarf_Die *arg1) >> > { >> >- /* ??? */ >> >+ int tag0, tag1; >> >+ Dwarf_Die member; >> >+ Dwarf_Word encoding0, encoding1; >> >+ Dwarf_Attribute attr; >> >+ Dwarf_Word size0, size1; >> >+ >> >+ if (size < 8 || size > 16) >> >+ return 0; >> >> IIUC elfutils only supports riscv64? Assuming that's the case this >> looks fine. > > Yes, at the moment we only support riscv64, we do accept 32bit riscv > ELF files, but don't know anything about how it handles calling > conventions, core file layout, etc. > >> >+ tag1 = dwarf_peeled_die_type (arg1, arg1); >> >+ if (tag1 != DW_TAG_base_type) >> >+ return 0; /* We can only handle two equal base types for now. */ >> >+ >> >+ if (dwarf_attr_integrate (arg1, DW_AT_encoding, &attr) == NULL >> >+ || dwarf_formudata (&attr, &encoding1) != 0 >> >+ || encoding0 != encoding1) >> >+ return 0; /* We can only handle two of the same for now. */ >> >> We have that special case in the psABI where "struct { int; float; >> }" gets split into int/FP registers. I don't really understand >> elfutils, but I think it'll be possible to trip this up with >> something along those lines. > > aha, I see... > > "A struct containing one floating-point real and one integer (or > bitfield), in either order, is passed in a floating-point register and > an integer register, provided the floating-point real is no more than > ABI_FLEN bits wide and the integer is no more than XLEN bits wide." > > Yes, that isn't currently recognized. I'll try to add an update to > handle this specific case. Cool, thanks. In general the RISC-V specs have a lot of these non-local statements, so it's kind of hard to just read sub-components of it as you're likely to get tripped up. > > Thanks, > > Mark