Skip to content

Commit 86ed430

Browse files
arndbIngo Molnar
authored andcommitted
x86/alternatives: Move apply_relocation() out of init section
This function is now called from a few places that are no __init_or_module, resulting a link time warning: WARNING: modpost: vmlinux: section mismatch in reference: patch_dest+0x8a (section: .text) -> apply_relocation (section: .init.text) Remove the annotation here. [ mingo: Also sync up add_nop() with these changes. ] Fixes: 17bce3b ("x86/callthunks: Handle %rip-relative relocations in call thunk template") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Uros Bizjak <ubizjak@gmail.com> Link: https://lore.kernel.org/r/20231204072856.1033621-1-arnd@kernel.org
1 parent 3a1d382 commit 86ed430

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/x86/kernel/alternative.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ EXPORT_SYMBOL_GPL(alternatives_patched);
4444
#define DA_ENDBR 0x08
4545
#define DA_SMP 0x10
4646

47-
static unsigned int __initdata_or_module debug_alternative;
47+
static unsigned int debug_alternative;
4848

4949
static int __init debug_alt(char *str)
5050
{
@@ -132,7 +132,7 @@ const unsigned char * const x86_nops[ASM_NOP_MAX+1] =
132132
* each single-byte NOPs). If @len to fill out is > ASM_NOP_MAX, pad with INT3 and
133133
* *jump* over instead of executing long and daft NOPs.
134134
*/
135-
static void __init_or_module add_nop(u8 *instr, unsigned int len)
135+
static void add_nop(u8 *instr, unsigned int len)
136136
{
137137
u8 *target = instr + len;
138138

@@ -206,7 +206,7 @@ static int skip_nops(u8 *instr, int offset, int len)
206206
* Optimize a sequence of NOPs, possibly preceded by an unconditional jump
207207
* to the end of the NOP sequence into a single NOP.
208208
*/
209-
static bool __init_or_module
209+
static bool
210210
__optimize_nops(u8 *instr, size_t len, struct insn *insn, int *next, int *prev, int *target)
211211
{
212212
int i = *next - insn->length;
@@ -325,7 +325,7 @@ bool need_reloc(unsigned long offset, u8 *src, size_t src_len)
325325
return (target < src || target > src + src_len);
326326
}
327327

328-
void __init_or_module apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
328+
void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
329329
{
330330
int prev, target = 0;
331331

0 commit comments

Comments
 (0)