llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	 Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Youling Tang <tangyouling@kylinos.cn>,
	Jinyang He <hejinyang@loongson.cn>,
	 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 <yujie.liu@intel.com>,
	Heng Qi <hengqi@linux.alibaba.com>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH] loongarch: Only select HAVE_OBJTOOL and allow ORC unwinder if the inline assembler supports R_LARCH_{32,64}_PCREL
Date: Wed, 05 Jun 2024 13:25:10 +0800	[thread overview]
Message-ID: <f72abf3b624107361ec4de0fe72be3bf4a3da539.camel@xry111.site> (raw)
In-Reply-To: <CAAhV-H74=aQqMe3Bh5xn1VQCrcK7eHk1baKj1L+74=o=-8V_6g@mail.gmail.com>

On Wed, 2024-06-05 at 13:21 +0800, Huacai Chen wrote:
> On Wed, Jun 5, 2024 at 12:38 PM Xi Ruoyao <xry111@xry111.site> wrote:
> > 
> > On Wed, 2024-06-05 at 09:52 +0800, Huacai Chen wrote:
> > > Hi, Ruoyao,
> > > 
> > > On Tue, Jun 4, 2024 at 11:08 PM Xi Ruoyao <xry111@xry111.site> wrote:
> > > > 
> > > > GAS <= 2.41 does not support generating R_LARCH_{32,64}_PCREL for
> > > > "label - ." and it generates R_LARCH_{ADD,SUB}{32,64} pairs instead.
> > > > objtool cannot handle R_LARCH_{ADD,SUB}{32,64} pair in __jump_table
> > > > (static key implementation) and etc. so it will produce some warnings.
> > > > This is causing the kernel CI systems to complain everywhere.
> > > > 
> > > > For GAS we can check if -mthin-add-sub option is available to know if
> > > > R_LARCH_{32,64}_PCREL are supported.
> > > I think we should give a chance to toolchains without the
> > > -mthin-add-sub option, so I hope Tiezhu can resubmit this patch to
> > > solve this problem.
> > > https://lore.kernel.org/loongarch/1690272910-11869-6-git-send-email-yangtiezhu@loongson.cn/
> > 
> > It only handles .discard.{un,}reachable but not __jump_table.
> > __jump_table is our main issue here.  And I don't see a quick way to
> > make -mno-thin-add-sub work for __jump_table because we really need to
> > resolve the relocation for __jump_table instead of simply skipping it.
>  __jump_table is disabled now, so we can only solve  -mno-thin-add-sub
> at present, and the next step is __jump_table.

No, -fno-jump-table does not disable __jump_table.  __jump_table is from
static key implementation in arch/loongarch/include/asm/jump_label.h,
not generated by the compiler.

And the problem of __jump_table is exact with -mno-thin-add-sub.  It
reads:

#define JUMP_TABLE_ENTRY                \
     ".pushsection  __jump_table, \"aw\"    \n\t"   \
     ".align    3           \n\t"   \
     ".long     1b - ., %l[l_yes] - .   \n\t"   \
     ".quad     %0 - .          \n\t"   \
     ".popsection               \n\t"

The "1b - ." and "%0 - ." things produce different relocs with -mno-
thin-add-sub and -mthin-add-sub.  The objtool can only handle the relocs
from -mthin-add-sub here.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2024-06-05  5:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 15:07 [PATCH] loongarch: Only select HAVE_OBJTOOL and allow ORC unwinder if the inline assembler supports R_LARCH_{32,64}_PCREL Xi Ruoyao
2024-06-05  1:52 ` Huacai Chen
2024-06-05  4:38   ` Xi Ruoyao
2024-06-05  5:21     ` Huacai Chen
2024-06-05  5:25       ` Xi Ruoyao [this message]
2024-06-05  2:04 ` Heng Qi
2024-06-05  5:43 ` Nathan Chancellor
2024-06-05  5:54   ` Xi Ruoyao
2024-06-05  6:25     ` Nathan Chancellor
2024-06-05 10:57       ` Xi Ruoyao
2024-06-05 13:18         ` Xi Ruoyao
2024-06-05 15:13           ` Xi Ruoyao
2024-06-05 15:47             ` Jinyang He
2024-06-05 19:05               ` Xi Ruoyao
2024-06-06  2:10                 ` Jinyang He
2024-06-07  5:42                   ` Xi Ruoyao
2024-06-07  7:14                     ` Jinyang He
2024-06-07  8:29                       ` Xi Ruoyao
2024-06-15  8:45                         ` Huacai Chen
2024-06-15  8:53                           ` Xi Ruoyao
2024-06-15  9:33                             ` Huacai Chen
2024-06-15 10:22                               ` Xi Ruoyao
2024-06-17 13:11                                 ` Huacai Chen
2024-06-17 13:38                                   ` Xi Ruoyao
2024-06-17 13:47                                     ` Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f72abf3b624107361ec4de0fe72be3bf4a3da539.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=cailulu@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=hejinyang@loongson.cn \
    --cc=hengqi@linux.alibaba.com \
    --cc=justinstitt@google.com \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=loongarch@lists.linux.dev \
    --cc=luweining@loongson.cn \
    --cc=mengqinggang@loongson.cn \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=tangyouling@kylinos.cn \
    --cc=tj@kernel.org \
    --cc=wanglei@loongson.cn \
    --cc=yangtiezhu@loongson.cn \
    --cc=yujie.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).