Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1286646lqs; Sat, 15 Jun 2024 02:33:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXo6LsYN9VZJf3o28twWGSTuhcZ09vqf9fPJ5PKjz0EACpRIH52QtizCqfwikKBNP8jTa2dUHFvtLEtZAPsnjzCi7e490LxwPzSKiHxOQ== X-Google-Smtp-Source: AGHT+IH2+enJzQlR13JoBa7FPvT+M2Y8NvdPHwsGpQ4JyDxptA92y1UiKCtUfHbBYNmsYGnNyso2 X-Received: by 2002:a05:6a20:6a0e:b0:1b8:9d79:7839 with SMTP id adf61e73a8af0-1bae7effc98mr6049078637.29.1718444007115; Sat, 15 Jun 2024 02:33:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718444007; cv=pass; d=google.com; s=arc-20160816; b=HQsFXR2pyXShgBku7Mhb06FNyeQ/grij3FnG802L+0LHCM+lJ38NkSO6y9H6N3Oyag JOMDYwC+/zCTRJrxj3W73m/vWRAqoLncs7yw9j0BtYLq+FYIyz/kC4x+iLvG5KSr+10A G1MjxdvM3cJsNfwqb+CYdNjX18QM+QPHl+chT+xx2HkvCNbrRfXAwSzOjlflAkxlhlpR QUzZKJM8vpUioLpczhBS6BG8XZ1UrSF9XJCAaU0iYZ0kmx+G90EUSb992sA+dL3FbugO 7h8f7cFGkAM6cwdXsESM87RvA3Uqj6e5JGUES/rJB+CPzXvMk0C9BJ7syrzJ+50q5WUL TjDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ilBJawGNB7ZX0A+RBiYRx2RTi8IrFnmcjtbUXnZsJgs=; fh=ELdnBXuguEu/PeLXO14ejAv5OROe3/eXq+TMBS70ar4=; b=DJDtYTIRIp/mxOtHEj/UJFMC8xaed7CGHtfQnfrkIMub23TS1QjmHLXQWwFfurWrx4 95PVqncCdiFXhro0gZZWATDEdXEsh48PIjeHUAw6w8yvWGIpgaaNBF9Yew9ddtC2KWDK U4+TO4noBC3/SizDPrOkFVdDinOOYmEmOQabXJnRN9rV/to+vUBF2yyiDRNQPkRSAE1/ blKHtf5/+ho2mviil1CYAwHZuSyQ4+cAihlkaNTRR6ozHCg8m0dpnBVxRORh0QtKqC/5 T8acI3qLs7jge2VSCKWTuDk4Jj+lsm+44v2ZoCZlJHmxCVHGO4rt+Lt+PiNzkPFaHuZA iAtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rfBFLmRb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee3108bc6si5251081a12.259.2024.06.15.02.33.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 02:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rfBFLmRb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4E38FB224D6 for ; Sat, 15 Jun 2024 09:33:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79C6224B34; Sat, 15 Jun 2024 09:33:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rfBFLmRb" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9769F1BC20 for ; Sat, 15 Jun 2024 09:33:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718443995; cv=none; b=SF3mm+Pqq+/2A76JcnbeWx91FHlITj6rTqdO55RQVD2X5QHnCgDClHQO1TcRsMdBncLouuaIH8I5NrG/7dwdwtSsDD4yilr9j5OVUakSvpQ3SpdJ4FOq2qfMV+ShaMguMA96rZ/10osK6jBzSEgEwkfBmBvc3cdBaK1fUVX+Ntg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718443995; c=relaxed/simple; bh=bc/4Tso4iRzwTk7+zSbemISLUV6nGZBGzfAmqNVY59g=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=l++u7OdGoZr9Gw7KVQPzQyYDOEKcrq1UjnvpfxJ6WvYLFb2B804Ck14dLk6XgdiFxEfR7Wva1OeOnKf8TOyoASjQqrGCfvxE5y8sCU8cFgG6Uh9hMttFjSyldiGScOeMfgnhxE8/BXD6A9lbY6JvgwVUwOeQ8c5ZrodpLz/bkxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rfBFLmRb; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22981C4AF1A for ; Sat, 15 Jun 2024 09:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718443995; bh=bc/4Tso4iRzwTk7+zSbemISLUV6nGZBGzfAmqNVY59g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rfBFLmRbcYnoj+61ZEMp+Z5GwifgAx7DGspwyRk9vBKukG7kOAbVcbXSJma2MzF0Y vCQqjeIj8QbDMqSWRY7KBBhKAOMgQ75eVZlpoAUS7xa6sOSwZbXwhqfm9Z6keh58DK UXxK9j4OVXmdswAvARW20YbrSMbyKkTGFGtx0btdBD+1DziLFkmLy1vp13pfYROcb3 V4bUFM6snfO1knltzXJnymxtfc7nrnThbpWgcSx7oA3nbkL+wwqWoIbjKMlw6tMqYL 5eS+u9A/P+JNsKdm6SRvAcWdecTCVrphQ7ldFk0nxBXMdi+Xcr75hcjoGtz36s5jBa AQ99irCVhkwvQ== Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a6f09eaf420so349301366b.3 for ; Sat, 15 Jun 2024 02:33:14 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXeQsXL5BEdMMinhEndLFtxx4JydvuM3Pk906OiPoUSYivVJnULLNMPshAcXJ/mvZDdiHk46lX7W3PkxLE8UilsRe9RnN2U13NbaETg X-Gm-Message-State: AOJu0Yxb3szKZD3RVKi27WQ/gGhKE8sgWtrc/z9Z+G5k4jHwaicCLMpt KG+YEALcbaXj68YPGTe5csPcnXGVfcL7u/UlMgkDuZIbiM5KlLrZzFoVGeYf/JpESZWqfnEvdm2 vCBrU4csXzOLFk9Bq9ZwSCQ6XzWM= X-Received: by 2002:a17:907:d303:b0:a6f:6803:57d2 with SMTP id a640c23a62f3a-a6f6803596cmr268616866b.53.1718443993585; Sat, 15 Jun 2024 02:33:13 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240604150741.30252-1-xry111@xry111.site> <20240605054328.GA279426@thelio-3990X> <20240605062548.GF279426@thelio-3990X> <444ec2031ef6ca016cbfa8dfedc51bddc8529ba7.camel@xry111.site> <82b7e6ea-c2cb-6364-ebe9-bff928028408@loongson.cn> <1c132209a612e2e8953f0b458fc01853120db9a9.camel@xry111.site> <2bf11cd2-8449-acda-f5ad-659c38cb018e@loongson.cn> <96a2e8a80c06772b64fcbdba42e1dae2d68a53a7.camel@xry111.site> <2bd6ae20-ec56-c1a2-c5dd-e8c978a376d3@loongson.cn> <329dac82e09dfc75e77ae93ebbeacdec1dc9ff7f.camel@xry111.site> In-Reply-To: From: Huacai Chen Date: Sat, 15 Jun 2024 17:33:02 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] loongarch: Only select HAVE_OBJTOOL and allow ORC unwinder if the inline assembler supports R_LARCH_{32,64}_PCREL To: Xi Ruoyao Cc: Jinyang He , Nathan Chancellor , Peter Zijlstra , WANG Xuerui , Tiezhu Yang , Nick Desaulniers , Bill Wendling , Justin Stitt , Youling Tang , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, mengqinggang@loongson.cn, cailulu@loongson.cn, wanglei@loongson.cn, luweining@loongson.cn, Yujie Liu , Heng Qi , Tejun Heo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jun 15, 2024 at 4:54=E2=80=AFPM Xi Ruoyao wrot= e: > > On Sat, 2024-06-15 at 16:45 +0800, Huacai Chen wrote: > > Hi, Ruoyao and Jinyang, > > > > On Fri, Jun 7, 2024 at 4:29=E2=80=AFPM Xi Ruoyao w= rote: > > > > > > On Fri, 2024-06-07 at 15:14 +0800, Jinyang He wrote: > > > > > Note: on RISC-V and LoongArch, the stack slot for the previo= us frame > > > > > pointer is stored at fp[-2] instead of fp[0]. See [Consider > > > > > standardising which stack slot fp points > > > > > to](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/iss= ues/18) > > > > > for the RISC-V discussion. > > > > > > > > In most cases the $fp is saved at cfa-16. But for va args, somethin= g > > > > becomes different at LoongArch (I do not know the case of riscv), t= he > > > > $fp isn't saved at cfa-16. (e.g. printk?) > > > > > > Oops indeed. Even with a very simple case: > > > > > > int sum(int a, int b) { > > > return a + b; > > > } > > > > > > with -fno-omit-frame-pointer we get: > > > > > > sum: > > > addi.d $r3,$r3,-16 > > > st.d $r22,$r3,8 > > > addi.d $r22,$r3,16 > > > ld.d $r22,$r3,8 > > > add.w $r4,$r4,$r5 > > > addi.d $r3,$r3,16 > > > jr $r1 > > > > > > So for leaf functions (where we don't save $ra) $fp is saved at cfa-8= . > > > > > > > I feel that the update_cfi_state should be arch specific. I believe > > > > that some logic can be reused, but each arch may have its own logic= . > > > > > > I agree it now. > > What is the conclusion about the clang part now? And for the original > > -mno-thin-add-sub problem, do you have some way to fix it in the root? > > I think we needn't rush, there are some weeks before 6.10 released. > > To me for now we should just make OBJTOOL and ORC depend on BROKEN and > backport to stable... But this patch allows clang to build objtool, which seems broken, too. > > Even if we can fix both the -mno-thin-add-sub problem and the frame > pointer problem in these weeks, they'll be some nontrivial large change > and improper to backport. Thus we have to admit objtool doesn't really > work for old releases and mark it broken. I don't like to disable objtool, unless there is no better solution. And it seems there has already been some "large fix" in objtool's history. Huacai > > > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University