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 409 /* Keep this the last entry. */ 410 410 #define R_PPC64_NUM 107 411 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 + 412 419 #ifdef __KERNEL__ 413 420 414 421 #ifdef CONFIG_SPU_BASE
+11 -1
arch/powerpc/include/asm/sections.h
··· 2 2 #define _ASM_POWERPC_SECTIONS_H 3 3 #ifdef __KERNEL__ 4 4 5 + #include <linux/elf.h> 6 + #include <linux/uaccess.h> 5 7 #include <asm-generic/sections.h> 6 8 7 9 #ifdef __powerpc64__ ··· 19 17 } 20 18 21 19 #undef dereference_function_descriptor 22 - void *dereference_function_descriptor(void *); 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 + } 23 29 24 30 #endif 25 31
-19
arch/powerpc/kernel/module_64.c
··· 21 21 #include <linux/err.h> 22 22 #include <linux/vmalloc.h> 23 23 #include <linux/bug.h> 24 - #include <linux/uaccess.h> 25 24 #include <asm/module.h> 26 - #include <asm/sections.h> 27 25 #include <asm/firmware.h> 28 26 #include <asm/code-patching.h> 29 27 #include <linux/sort.h> ··· 40 42 #else 41 43 #define DEBUGP(fmt , ...) 42 44 #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 45 51 46 /* Like PPC32, we need little trampolines to do > 24-bit jumps (into 52 47 the kernel itself). But on PPC64, these need to be used for every ··· 442 451 } 443 452 444 453 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 454 }