Skip to content

Commit 2d291e9

Browse files
jejbpaulusmack
authored andcommitted
Fix compile failure with non modular builds
Commit deac93d ("lib: Correct printk %pF to work on all architectures") broke the non modular builds by moving an essential function into modules.c. Fix this by moving it out again and into asm/sections.h as an inline. To do this, the definition of struct ppc64_opd_entry has been lifted out of modules.c and put in asm/elf.h where it belongs. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 32dde0f commit 2d291e9

3 files changed

Lines changed: 18 additions & 20 deletions

File tree

‎arch/powerpc/include/asm/elf.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,13 @@ do { \
409409
/* Keep this the last entry. */
410410
#define R_PPC64_NUM 107
411411

412+
/* There's actually a third entry here, but it's unused */
413+
struct ppc64_opd_entry
414+
{
415+
unsigned long funcaddr;
416+
unsigned long r2;
417+
};
418+
412419
#ifdef __KERNEL__
413420

414421
#ifdef CONFIG_SPU_BASE

‎arch/powerpc/include/asm/sections.h‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define _ASM_POWERPC_SECTIONS_H
33
#ifdef __KERNEL__
44

5+
#include <linux/elf.h>
6+
#include <linux/uaccess.h>
57
#include <asm-generic/sections.h>
68

79
#ifdef __powerpc64__
@@ -17,7 +19,15 @@ static inline int in_kernel_text(unsigned long addr)
1719
}
1820

1921
#undef dereference_function_descriptor
20-
void *dereference_function_descriptor(void *);
22+
static inline void *dereference_function_descriptor(void *ptr)
23+
{
24+
struct ppc64_opd_entry *desc = ptr;
25+
void *p;
26+
27+
if (!probe_kernel_address(&desc->funcaddr, p))
28+
ptr = p;
29+
return ptr;
30+
}
2131

2232
#endif
2333

‎arch/powerpc/kernel/module_64.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
#include <linux/err.h>
2222
#include <linux/vmalloc.h>
2323
#include <linux/bug.h>
24-
#include <linux/uaccess.h>
2524
#include <asm/module.h>
26-
#include <asm/sections.h>
2725
#include <asm/firmware.h>
2826
#include <asm/code-patching.h>
2927
#include <linux/sort.h>
@@ -43,13 +41,6 @@
4341
#define DEBUGP(fmt , ...)
4442
#endif
4543

46-
/* There's actually a third entry here, but it's unused */
47-
struct ppc64_opd_entry
48-
{
49-
unsigned long funcaddr;
50-
unsigned long r2;
51-
};
52-
5344
/* Like PPC32, we need little trampolines to do > 24-bit jumps (into
5445
the kernel itself). But on PPC64, these need to be used for every
5546
jump, actually, to reset r2 (TOC+0x8000). */
@@ -452,13 +443,3 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
452443

453444
return 0;
454445
}
455-
456-
void *dereference_function_descriptor(void *ptr)
457-
{
458-
struct ppc64_opd_entry *desc = ptr;
459-
void *p;
460-
461-
if (!probe_kernel_address(&desc->funcaddr, p))
462-
ptr = p;
463-
return ptr;
464-
}

0 commit comments

Comments
 (0)