-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: out of range pc-relative fixup value #1551
Comments
Does this help?
|
No, it does not. The error appears to come from this block #elif __LINUX_ARM_ARCH__>=7 || \
(defined(MODULE) && defined(CONFIG_ARM_MODULE_PLTS))
cur = __current;
#else
asm(LOAD_SYM_ARMV6(%0, __current) : "=r"(cur));
#endif not the one above it, as I don't see it in the preprocessed source: static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((__no_instrument_function__)) __attribute__((__const__)) struct task_struct *get_current(void)
{
struct task_struct *cur;
# 54 "./arch/arm/include/asm/current.h"
asm(" ldr " "%0" ", =" "__current" " \n\t" " ldr " "%0" ", [" "%0" "] \n\t" : "=r"(cur));
return cur;
} |
How about this?
|
Yes, that works for me. |
Patch submitted: https://lore.kernel.org/r/20211220225217.458335-1-ardb@kernel.org/ I think we should let this roll through CI as well. |
@ardbiesheuvel I ran that patch through all of the
The preprocessed source if it is helpful: static inline __attribute__((__gnu_inline__)) __attribute__((__unused__)) __attribute__((__no_instrument_function__)) __attribute__((__const__)) struct task_struct *get_current(void)
{
struct task_struct *cur;
# 36 "./arch/arm/include/asm/current.h"
asm("0: mrc p15, 0, %0, c13, c0, 3 \n\t"
"1: \n\t"
" .subsection 1 \n\t"
"2: " " ldr " "%0" ", =" "__current" " \n\t" " ldr " "%0" ", [" "%0" "] \n\t" " \n\t"
" b 1b \n\t"
" .ltorg \n\t"
" .previous \n\t"
" .pushsection \".alt.smp.init\", \"a\" \n\t"
" .long 0b - . \n\t"
" b . + (2b - 0b) \n\t"
" .popsection \n\t"
: "=r"(cur));
return cur;
} Let me know if there is any more information I can provide or patches to test. |
Nathan reports that the new get_current() and per-CPU offset accessors may cause problems at build time due to the use of a literal to hold the address of the respective variables. This is due to the fact that LLD before v14 does not support the PC-relative group relocations that are normally used for this, and the fallback relies on literals but does not emit the literal pools explictly using the .ltorg directive. ./arch/arm/include/asm/current.h:53:6: error: out of range pc-relative fixup value asm(LOAD_SYM_ARMV6(%0, __current) : "=r"(cur)); ^ ./arch/arm/include/asm/insn.h:25:2: note: expanded from macro 'LOAD_SYM_ARMV6' " ldr " #reg ", =" #sym " nt" ^ <inline asm>:1:3: note: instantiated into assembly here ldr r0, =__current ^ Since emitting a literal pool in this particular case is not possible, let's avoid the LOAD_SYM_ARMV6() entirely, and use the ordinary C assigment instead. As it turns out, there are other such cases, and here, using .ltorg to emit the literal pool within range of the LDR instruction would be possible due to the presence of an unconditional branch right after it. Unfortunately, putting .ltorg directives in subsections appears to confuse the Clang inline assembler, resulting in similar errors even though the .ltorg is most definitely within range. So let's fix this by emitting the literal explicitly, and not rely on the assembler to figure this out. This means we have move the fallback out of the LOAD_SYM_ARMV6() macro and into the callers. Link: ClangBuiltLinux#1551 Fixes: 9c46929 ("ARM: implement THREAD_INFO_IN_TASK for uniprocessor systems") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
This was only seen in -next, which now has the patch so closing: https://git.kernel.org/next/linux-next/c/5fe41793bc78d9bb47fea37d1a16984ad6cf294b |
Initially reported by CI:
https://github.com/ClangBuiltLinux/continuous-integration2/runs/4582656058?check_suite_focus=true
https://builds.tuxbuild.com/22Y6TPllfEZ9LfAJ8FuIW7AQLh0/build.log
With LLVM 13, there is a build error with
multi_v5_defconfig
:Introduced by commit 7b9896c35207 ("ARM: percpu: add SMP_ON_UP support"). This is not seen with ToT because the code is
ifdef
'd with newer versions of LLVM due to llvm/llvm-project@da66263.If I turn off the integrated assembler with
LLVM_IAS=0
, I seebut that could be tangential (although these errors are seen with LLVM 11 and LLVM 12)
cc @ardbiesheuvel
The text was updated successfully, but these errors were encountered: