![Linus Torvalds](/assets/img/avatar_default.png)
This reverts commit8ab2ae655b
. I loved that commit because of how it explained what the problem with newer versions of binutils were, but the actual patch itself turns out to not work very well. It has two problems: - a zero CRC value isn't actually right. It happens to work for the case where both sides of the equation fail at giving the symbol a crc, but there are cases where the users of the exported symbol get the right crc (due to seeing the C declarations), but the actual exporting itself does not (due to the whole weak asm symbol issue). So then the module load fails after all - we did have a crc for the symbol, but we couldn't match it with the loaded module. - it seems that the alpha assembler has special semantics for the '.set' directive, and on alpha it doesn't actually set the value of the specified symbol at all, it is instead used to set various assembly modes (eg ".set noat" and ".set noreorder"). So using ".set" to set the symbol value would just cause build failures on alpha. I'm sure we'll find some other workaround for these issues (hopefully that involves getting rid of modversions entirely some day, but people are also talking about just using smarter tools). But for now we'll just fall back on commitfaaae2a581
("Re-enable CONFIG_MODVERSIONS in a slightly weaker form") that just let's a missing crc through. Reported-by: Jan Stancek <jstancek@redhat.com> Reported-by: Philip Müller <philm@manjaro.org> Reported-by: Guenter Roeck <linux@roeck-us.net> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
95 lines
2.2 KiB
C
95 lines
2.2 KiB
C
#ifndef __ASM_GENERIC_EXPORT_H
|
|
#define __ASM_GENERIC_EXPORT_H
|
|
|
|
#ifndef KSYM_FUNC
|
|
#define KSYM_FUNC(x) x
|
|
#endif
|
|
#ifdef CONFIG_64BIT
|
|
#define __put .quad
|
|
#ifndef KSYM_ALIGN
|
|
#define KSYM_ALIGN 8
|
|
#endif
|
|
#ifndef KCRC_ALIGN
|
|
#define KCRC_ALIGN 8
|
|
#endif
|
|
#else
|
|
#define __put .long
|
|
#ifndef KSYM_ALIGN
|
|
#define KSYM_ALIGN 4
|
|
#endif
|
|
#ifndef KCRC_ALIGN
|
|
#define KCRC_ALIGN 4
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
|
|
#define KSYM(name) _##name
|
|
#else
|
|
#define KSYM(name) name
|
|
#endif
|
|
|
|
/*
|
|
* note on .section use: @progbits vs %progbits nastiness doesn't matter,
|
|
* since we immediately emit into those sections anyway.
|
|
*/
|
|
.macro ___EXPORT_SYMBOL name,val,sec
|
|
#ifdef CONFIG_MODULES
|
|
.globl KSYM(__ksymtab_\name)
|
|
.section ___ksymtab\sec+\name,"a"
|
|
.balign KSYM_ALIGN
|
|
KSYM(__ksymtab_\name):
|
|
__put \val, KSYM(__kstrtab_\name)
|
|
.previous
|
|
.section __ksymtab_strings,"a"
|
|
KSYM(__kstrtab_\name):
|
|
#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
|
|
.asciz "_\name"
|
|
#else
|
|
.asciz "\name"
|
|
#endif
|
|
.previous
|
|
#ifdef CONFIG_MODVERSIONS
|
|
.section ___kcrctab\sec+\name,"a"
|
|
.balign KCRC_ALIGN
|
|
KSYM(__kcrctab_\name):
|
|
__put KSYM(__crc_\name)
|
|
.weak KSYM(__crc_\name)
|
|
.previous
|
|
#endif
|
|
#endif
|
|
.endm
|
|
#undef __put
|
|
|
|
#if defined(__KSYM_DEPS__)
|
|
|
|
#define __EXPORT_SYMBOL(sym, val, sec) === __KSYM_##sym ===
|
|
|
|
#elif defined(CONFIG_TRIM_UNUSED_KSYMS)
|
|
|
|
#include <linux/kconfig.h>
|
|
#include <generated/autoksyms.h>
|
|
|
|
#define __EXPORT_SYMBOL(sym, val, sec) \
|
|
__cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
|
|
#define __cond_export_sym(sym, val, sec, conf) \
|
|
___cond_export_sym(sym, val, sec, conf)
|
|
#define ___cond_export_sym(sym, val, sec, enabled) \
|
|
__cond_export_sym_##enabled(sym, val, sec)
|
|
#define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
|
|
#define __cond_export_sym_0(sym, val, sec) /* nothing */
|
|
|
|
#else
|
|
#define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
|
|
#endif
|
|
|
|
#define EXPORT_SYMBOL(name) \
|
|
__EXPORT_SYMBOL(name, KSYM_FUNC(KSYM(name)),)
|
|
#define EXPORT_SYMBOL_GPL(name) \
|
|
__EXPORT_SYMBOL(name, KSYM_FUNC(KSYM(name)), _gpl)
|
|
#define EXPORT_DATA_SYMBOL(name) \
|
|
__EXPORT_SYMBOL(name, KSYM(name),)
|
|
#define EXPORT_DATA_SYMBOL_GPL(name) \
|
|
__EXPORT_SYMBOL(name, KSYM(name),_gpl)
|
|
|
|
#endif
|