forked from mirrors/linux
		
	 08700ec705
			
		
	
	
		08700ec705
		
	
	
	
	
		
			
			John David Anglin reported parisc has been broken since commitddb5cdbafa("kbuild: generate KSYMTAB entries by modpost"). Like ia64, parisc64 uses a function descriptor. The function references must be prefixed with P%. Also, symbols prefixed $$ from the library have the symbol type STT_LOPROC instead of STT_FUNC. They should be handled as functions too. Fixes:ddb5cdbafa("kbuild: generate KSYMTAB entries by modpost") Reported-by: John David Anglin <dave.anglin@bell.net> Tested-by: John David Anglin <dave.anglin@bell.net> Tested-by: Helge Deller <deller@gmx.de> Closes: https://lore.kernel.org/linux-parisc/1901598a-e11d-f7dd-a5d9-9a69d06e6b6e@bell.net/T/#u Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Helge Deller <deller@gmx.de>
		
			
				
	
	
		
			70 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0-only */
 | |
| /*
 | |
|  * Please do not include this explicitly.
 | |
|  * This is used by C files generated by modpost.
 | |
|  */
 | |
| 
 | |
| #ifndef __LINUX_EXPORT_INTERNAL_H__
 | |
| #define __LINUX_EXPORT_INTERNAL_H__
 | |
| 
 | |
| #include <linux/compiler.h>
 | |
| #include <linux/types.h>
 | |
| 
 | |
| #if defined(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS)
 | |
| /*
 | |
|  * relative reference: this reduces the size by half on 64-bit architectures,
 | |
|  * and eliminates the need for absolute relocations that require runtime
 | |
|  * processing on relocatable kernels.
 | |
|  */
 | |
| #define __KSYM_REF(sym)		".long " #sym "- ."
 | |
| #elif defined(CONFIG_64BIT)
 | |
| #define __KSYM_REF(sym)		".quad " #sym
 | |
| #else
 | |
| #define __KSYM_REF(sym)		".long " #sym
 | |
| #endif
 | |
| 
 | |
| /*
 | |
|  * For every exported symbol, do the following:
 | |
|  *
 | |
|  * - Put the name of the symbol and namespace (empty string "" for none) in
 | |
|  *   __ksymtab_strings.
 | |
|  * - Place a struct kernel_symbol entry in the __ksymtab section.
 | |
|  *
 | |
|  * Note on .section use: we specify progbits since usage of the "M" (SHF_MERGE)
 | |
|  * section flag requires it. Use '%progbits' instead of '@progbits' since the
 | |
|  * former apparently works on all arches according to the binutils source.
 | |
|  */
 | |
| #define __KSYMTAB(name, sym, sec, ns)						\
 | |
| 	asm("	.section \"__ksymtab_strings\",\"aMS\",%progbits,1"	"\n"	\
 | |
| 	    "__kstrtab_" #name ":"					"\n"	\
 | |
| 	    "	.asciz \"" #name "\""					"\n"	\
 | |
| 	    "__kstrtabns_" #name ":"					"\n"	\
 | |
| 	    "	.asciz \"" ns "\""					"\n"	\
 | |
| 	    "	.previous"						"\n"	\
 | |
| 	    "	.section \"___ksymtab" sec "+" #name "\", \"a\""	"\n"	\
 | |
| 	    "	.balign	4"						"\n"	\
 | |
| 	    "__ksymtab_" #name ":"					"\n"	\
 | |
| 		__KSYM_REF(sym)						"\n"	\
 | |
| 		__KSYM_REF(__kstrtab_ ##name)				"\n"	\
 | |
| 		__KSYM_REF(__kstrtabns_ ##name)				"\n"	\
 | |
| 	    "	.previous"						"\n"	\
 | |
| 	)
 | |
| 
 | |
| #ifdef CONFIG_IA64
 | |
| #define KSYM_FUNC(name)		@fptr(name)
 | |
| #elif defined(CONFIG_PARISC) && defined(CONFIG_64BIT)
 | |
| #define KSYM_FUNC(name)		P%name
 | |
| #else
 | |
| #define KSYM_FUNC(name)		name
 | |
| #endif
 | |
| 
 | |
| #define KSYMTAB_FUNC(name, sec, ns)	__KSYMTAB(name, KSYM_FUNC(name), sec, ns)
 | |
| #define KSYMTAB_DATA(name, sec, ns)	__KSYMTAB(name, name, sec, ns)
 | |
| 
 | |
| #define SYMBOL_CRC(sym, crc, sec)   \
 | |
| 	asm(".section \"___kcrctab" sec "+" #sym "\",\"a\""	"\n" \
 | |
| 	    "__crc_" #sym ":"					"\n" \
 | |
| 	    ".long " #crc					"\n" \
 | |
| 	    ".previous"						"\n")
 | |
| 
 | |
| #endif /* __LINUX_EXPORT_INTERNAL_H__ */
 |