Fix compile failure with non modular builds

Commit deac93df26b20cf8438339b5935b5f5643bc30c9 ("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>

authored by James Bottomley and committed by Paul Mackerras 2d291e90 32dde0f9

+18 -20
+7
arch/powerpc/include/asm/elf.h
··· 409 /* Keep this the last entry. */ 410 #define R_PPC64_NUM 107 411 412 #ifdef __KERNEL__ 413 414 #ifdef CONFIG_SPU_BASE
··· 409 /* Keep this the last entry. */ 410 #define R_PPC64_NUM 107 411 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 + 419 #ifdef __KERNEL__ 420 421 #ifdef CONFIG_SPU_BASE
+11 -1
arch/powerpc/include/asm/sections.h
··· 2 #define _ASM_POWERPC_SECTIONS_H 3 #ifdef __KERNEL__ 4 5 #include <asm-generic/sections.h> 6 7 #ifdef __powerpc64__ ··· 19 } 20 21 #undef dereference_function_descriptor 22 - void *dereference_function_descriptor(void *); 23 24 #endif 25
··· 2 #define _ASM_POWERPC_SECTIONS_H 3 #ifdef __KERNEL__ 4 5 + #include <linux/elf.h> 6 + #include <linux/uaccess.h> 7 #include <asm-generic/sections.h> 8 9 #ifdef __powerpc64__ ··· 17 } 18 19 #undef dereference_function_descriptor 20 + static inline void *dereference_function_descriptor(void *ptr) 21 + { 22 + struct ppc64_opd_entry *desc = ptr; 23 + void *p; 24 + 25 + if (!probe_kernel_address(&desc->funcaddr, p)) 26 + ptr = p; 27 + return ptr; 28 + } 29 30 #endif 31
-19
arch/powerpc/kernel/module_64.c
··· 21 #include <linux/err.h> 22 #include <linux/vmalloc.h> 23 #include <linux/bug.h> 24 - #include <linux/uaccess.h> 25 #include <asm/module.h> 26 - #include <asm/sections.h> 27 #include <asm/firmware.h> 28 #include <asm/code-patching.h> 29 #include <linux/sort.h> ··· 40 #else 41 #define DEBUGP(fmt , ...) 42 #endif 43 - 44 - /* There's actually a third entry here, but it's unused */ 45 - struct ppc64_opd_entry 46 - { 47 - unsigned long funcaddr; 48 - unsigned long r2; 49 - }; 50 51 /* Like PPC32, we need little trampolines to do > 24-bit jumps (into 52 the kernel itself). But on PPC64, these need to be used for every ··· 442 } 443 444 return 0; 445 - } 446 - 447 - void *dereference_function_descriptor(void *ptr) 448 - { 449 - struct ppc64_opd_entry *desc = ptr; 450 - void *p; 451 - 452 - if (!probe_kernel_address(&desc->funcaddr, p)) 453 - ptr = p; 454 - return ptr; 455 }
··· 21 #include <linux/err.h> 22 #include <linux/vmalloc.h> 23 #include <linux/bug.h> 24 #include <asm/module.h> 25 #include <asm/firmware.h> 26 #include <asm/code-patching.h> 27 #include <linux/sort.h> ··· 42 #else 43 #define DEBUGP(fmt , ...) 44 #endif 45 46 /* Like PPC32, we need little trampolines to do > 24-bit jumps (into 47 the kernel itself). But on PPC64, these need to be used for every ··· 451 } 452 453 return 0; 454 }