]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
MODSIGN: Avoid using .incbin in C source
authorTakashi Iwai <tiwai@suse.de>
Tue, 11 Dec 2012 01:07:13 +0000 (11:37 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 14 Dec 2012 02:36:44 +0000 (13:06 +1030)
Using the asm .incbin statement in C sources breaks any gcc wrapper which
assumes that preprocessed C source is self-contained. Use a separate .S
file to include the siging key and certificate.

[ This means we no longer need SYMBOL_PREFIX which is defined in kernel.h
  from cbdbf2abb7844548a7d7a6a2ae7af6b6fbcea401, so I removed it -- RR ]

Tested-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: James Hogan <james.hogan@imgtec.com>
kernel/Makefile
kernel/modsign_certificate.S [new file with mode: 0644]
kernel/modsign_pubkey.c

index 86e3285ae7e5b48fd9b123291da2d8dbfe0d7460..0bd9d436341ef475aeb45ddaf0a44011ef32715e 100644 (file)
@@ -54,7 +54,7 @@ obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
 obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
 obj-$(CONFIG_UID16) += uid16.o
 obj-$(CONFIG_MODULES) += module.o
-obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o
+obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o modsign_certificate.o
 obj-$(CONFIG_KALLSYMS) += kallsyms.o
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
 obj-$(CONFIG_KEXEC) += kexec.o
@@ -139,7 +139,7 @@ ifeq ($(CONFIG_MODULE_SIG),y)
 extra_certificates:
        touch $@
 
-kernel/modsign_pubkey.o: signing_key.x509 extra_certificates
+kernel/modsign_certificate.o: signing_key.x509 extra_certificates
 
 ###############################################################################
 #
diff --git a/kernel/modsign_certificate.S b/kernel/modsign_certificate.S
new file mode 100644 (file)
index 0000000..246b4c6
--- /dev/null
@@ -0,0 +1,19 @@
+/* SYMBOL_PREFIX defined on commandline from CONFIG_SYMBOL_PREFIX */
+#ifndef SYMBOL_PREFIX
+#define ASM_SYMBOL(sym) sym
+#else
+#define PASTE2(x,y) x##y
+#define PASTE(x,y) PASTE2(x,y)
+#define ASM_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym)
+#endif
+
+#define GLOBAL(name)   \
+       .globl ASM_SYMBOL(name);        \
+       ASM_SYMBOL(name):
+
+       .section ".init.data","aw"
+
+GLOBAL(modsign_certificate_list)
+       .incbin "signing_key.x509"
+       .incbin "extra_certificates"
+GLOBAL(modsign_certificate_list_end)
index 767e559dfb10e697d207cdc1dedca0b00d5b5bdf..045504fffbb2657bd81f9c1165941edc19a8dce1 100644 (file)
@@ -20,12 +20,6 @@ struct key *modsign_keyring;
 
 extern __initdata const u8 modsign_certificate_list[];
 extern __initdata const u8 modsign_certificate_list_end[];
-asm(".section .init.data,\"aw\"\n"
-    SYMBOL_PREFIX "modsign_certificate_list:\n"
-    ".incbin \"signing_key.x509\"\n"
-    ".incbin \"extra_certificates\"\n"
-    SYMBOL_PREFIX "modsign_certificate_list_end:"
-    );
 
 /*
  * We need to make sure ccache doesn't cache the .o file as it doesn't notice