lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200808111618.08206.arnd@arndb.de>
Date:	Mon, 11 Aug 2008 16:18:07 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	"linux-kernel" <linux-kernel@...r.kernel.org>
Cc:	linux-arch@...r.kernel.org, Matthew Wilcox <matthew@....cx>,
	David Woodhouse <dwmw2@...radead.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	Rusty Russell <rusty@...tcorp.com.au>, linuxppc-dev@...abs.org
Subject: [RFC 1/3] add support for exporting symbols from .S files

This makes it possible to export symbols from assembly files, instead
of having to export them through an extra ksyms.c file.

I found this nicer to implement using a gas macro than a cpp macro.

Signed-off-by: Arnd Bergmann <arnd@...db.de>

--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -1,5 +1,7 @@
 #ifndef _LINUX_MODULE_H
 #define _LINUX_MODULE_H
+
+#ifndef __ASSEMBLY__
 /*
  * Dynamic loading of modules into the kernel.
  *
@@ -605,4 +607,54 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
 
 #define __MODULE_STRING(x) __stringify(x)
 
+#else /* __ASSEMBLY__ */
+#include <asm/types.h>
+
+#ifdef CONFIG_MODULES
+.macro __EXPORT_SYMBOL sym section symtab strtab
+	.section \section,"a",@progbits
+	.type \symtab, @object
+	.ifeq BITS_PER_LONG-32
+	.align 3
+\symtab:
+	.long \sym
+	.long \strtab
+	.else
+	.align 4
+\symtab:
+	.quad \sym
+	.quad \strtab
+	.endif
+	.size \symtab,.-\symtab
+	.previous
+
+	.section __ksymtab_strings,"a",@progbits
+	.type \strtab, @object
+\strtab:
+	.string "\sym"
+	.size \strtab,.-\strtab
+	.previous
+	.endm
+
+#define EXPORT_SYMBOL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_SYMBOL_GPL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_gpl,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_gpl_future,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_UNUSED_SYMBOL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_unused,__ksymtab_ ## sym,__kstrtab_ ## sym
+#define EXPORT_UNUSED_SYMBOL_GPL(sym) \
+	 __EXPORT_SYMBOL sym,__ksymtab_unused_gpl,__ksymtab_ ## sym,__kstrtab_ ## sym
+
+#else /* CONFIG_MODULES... */
+#define EXPORT_SYMBOL(sym)
+#define EXPORT_SYMBOL_GPL(sym)
+#define EXPORT_SYMBOL_GPL_FUTURE(sym)
+#define EXPORT_UNUSED_SYMBOL(sym)
+#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+#endif /* !CONFIG_MODULES... */
+
+#endif /* __ASSEMBLY__ */
+
 #endif /* _LINUX_MODULE_H */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ