From: Tzu-Ching Yang <shingekinocore@gmail.com>
To: Brian Cain <bcain@kernel.org>
Cc: linux-hexagon@vger.kernel.org,
Nathan Chancellor <nathan@kernel.org>,
llvm@lists.linux.dev, linux-kernel@vger.kernel.org,
Brian Cain <brian.cain@oss.qualcomm.com>
Subject: [PATCH] hexagon: constant-extend head.S calls to out-of-file symbols
Date: Sat, 21 Nov 2026 12:36:36 +0800 [thread overview]
Message-ID: <20261121043636.1296130-1-shingekinocore@gmail.com> (raw)
From: Brian Cain <brian.cain@oss.qualcomm.com>
Every call in head.S before this point targets a symbol defined
elsewhere: __vmnewmap and __vmsetvec in vm_ops.S, memset in lib/, and
start_kernel in init/main.c. The distance to each is whatever the
linker happens to lay out, not something the assembler can bound at
compile time.
The ld.lld versions used during this port have had bugs in exactly this
area -- miscalculating a compact PC-relative call's relocation range,
and not always synthesizing a trampoline when a call genuinely didn't
reach -- so a call that link-checks fine today is not a guarantee it
still will after the next relayout or the next linker. Constant-extend
all five so the encoding carries the full address and neither of those
failure modes is reachable, independent of link layout or which lld is
in use.
Without this, allmodconfig does not link with LLVM 17 and 18, as
ld.lld before 19.1.5 checks R_HEX_B22_PCREL against 2 MiB instead of
8 MiB [1] and the first four calls span 2.14 to 2.15 MiB in v7.4-rc1
with LLVM 17.0.1:
ld.lld: error: vmlinux.a(arch/hexagon/kernel/head.o):
(.init.text+0xd4): relocation R_HEX_B22_PCREL out of range: 2242552
is not in [-2097152, 2097151]; references '__vmnewmap'
Link: https://github.com/llvm/llvm-project/commit/64e3466fd09e [1]
Link: https://lore.kernel.org/all/20261119054908.2988120-1-shingekinocore@gmail.com/
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
[tzuching: rebase onto hexagon-fixes, describe the allmodconfig failure]
Tested-by: Tzu-Ching Yang <shingekinocore@gmail.com>
Signed-off-by: Tzu-Ching Yang <shingekinocore@gmail.com>
---
Brian, as you agreed in your reply to my report, this is 09df35bd9d9f
from your hexagon-qemu-virt branch rebased onto hexagon-fixes
(0304683b4c43). The five changed lines are the same as yours; only the
context differs. I added the allmodconfig paragraph with the error
message and the two Link tags; please edit or drop them as you see
fit.
I did not add a stable tag; you may want to add one, as v7.3.4 fails
in the same way and v6.18.63 with LLVM 17.0.1 only. The patch applies
to both, and to v7.4-rc1 and next-20261113.
On each of these trees and on hexagon-fixes, the patch gives the
head.S I tested for the report linked in the changelog.
arch/hexagon/kernel/head.S | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/hexagon/kernel/head.S b/arch/hexagon/kernel/head.S
index 908ffece9132..cdd14403491b 100644
--- a/arch/hexagon/kernel/head.S
+++ b/arch/hexagon/kernel/head.S
@@ -119,7 +119,7 @@ ENTRY(stext)
* vm_ops.S
*/
r1 = #VM_TRANS_TYPE_TABLE
- call __vmnewmap;
+ call ##__vmnewmap;
/* Jump into virtual address range. */
@@ -155,12 +155,12 @@ __head_s_vaddr_target:
r0 = r24
r1 = #VM_TRANS_TYPE_TABLE
- call __vmnewmap
+ call ##__vmnewmap
/* Go ahead and install the trap0 return so angel calls work */
r0.h = #hi(_K_provisional_vec)
r0.l = #lo(_K_provisional_vec)
- call __vmsetvec
+ call ##__vmsetvec
/*
* OK, at this point we should start to be much more careful,
@@ -195,7 +195,7 @@ __head_s_vaddr_target:
{ r0.H = #HI(__bss_start); r2.h = #HI(__bss_stop); }
r2 = sub(r2,r0);
- call memset;
+ call ##memset;
/* Set PHYS_OFFSET; should be in R25 */
#ifdef CONFIG_HEXAGON_PHYS_OFFSET
@@ -205,7 +205,7 @@ __head_s_vaddr_target:
#endif
/* Time to make the doughnuts. */
- call start_kernel
+ call ##start_kernel
/*
* Should not reach here.
base-commit: 0304683b4c43048082483e9445fdd0691d088431
--
2.34.1
reply other threads:[~2026-11-21 4:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261121043636.1296130-1-shingekinocore@gmail.com \
--to=shingekinocore@gmail.com \
--cc=bcain@kernel.org \
--cc=brian.cain@oss.qualcomm.com \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
/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
all inboxes | Powered by JetHome®