lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <750c907d-cc95-5116-4507-52dd48927cec@loongson.cn>
Date: Sat, 20 Sep 2025 20:52:47 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Huacai Chen <chenhuacai@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
 WANG Rui <wangrui@...ngson.cn>, rust-for-linux@...r.kernel.org,
 loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v1 1/2] LoongArch: Make LTO case independent in Makefile

On 9/20/25 19:41, Huacai Chen wrote:
...

>>> We need to handle the other case to use -fno-jump-tables if llvm does
>>> not support -loongarch-annotate-tablejump.
>>>
>>> So, it is better to update the minimal version of llvm to 20, which
>>> includes the following two important commits:
>>>
>>> [LoongArch] Add options for annotate tablejump
>>> https://github.com/llvm/llvm-project/commit/4c2c17756739
>>>
>>> [LoongArch] Avoid indirect branch jumps using the ra register
>>> https://github.com/llvm/llvm-project/commit/21ef17c62645
>>>
>>> If you are OK, I will send a patch to modify the following file:
>>>
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/min-tool-version.sh#n29
>>>
>>>
>>> and keep arch/loongarch/Makefile as is.
>>
>> The other way is to keep scripts/min-tool-version.sh as is, and only
>> modify arch/loongarch/Makefile, something like this (not tested):
>>
>> config LLD_HAS_ANNOTATE_TABLEJUMP
>>          def_bool LLD_VERSION >= 200000
>>
>> ifdef CONFIG_LTO_CLANG
>> ifdef CONFIG_LLD_HAS_ANNOTATE_TABLEJUMP
>> KBUILD_LDFLAGS                  += -mllvm --loongarch-annotate-tablejump
>> else
>> KBUILD_LDFLAGS                  += -mllvm --no-jump-tables
>> endif
> So complicated?
> 
> I think below is enough, no?
> ifdef CONFIG_LTO_CLANG
> # The annotate-tablejump option can not be passed to LLVM backend when
> LTO is enabled.
> # Ensure it is aware of linker with LTO,
> '--loongarch-annotate-tablejump' also needs to
> # be passed via '-mllvm' to ld.lld.
> KBUILD_LDFLAGS                  += $(call ld-option,-mllvm
> --loongarch-annotate-tablejump,-mllvm --no-jump-tables)
> endif

I do not know whether this is valid, you can test it with llvm 18
and llvm 20 if you think it is a proper way.

But IIRC, there is objtool warning with llvm 18, I reported to llvm
developer Wang Lei and he fixed it as the following commit:

[LoongArch] Avoid indirect branch jumps using the ra register
https://github.com/llvm/llvm-project/commit/21ef17c62645

Actually, the above commit solved a performance issue of llvm compiler,
so I prefer to update the minimal llvm version to 20 for LoongArch.

Thanks,
Tiezhu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ