Blame SOURCES/0151-Don-t-attempt-to-export-the-start-and-_start-symbols.patch

d9d99f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d9d99f
From: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
Date: Sat, 12 May 2018 11:29:07 +0200
d9d99f
Subject: [PATCH] Don't attempt to export the start and _start symbols for
d9d99f
 grub-emu
d9d99f
d9d99f
Commit 318ee04aadc ("make better backtraces") reworked the backtrace logic
d9d99f
but the changes lead to the following build error on the grub-emu platform:
d9d99f
d9d99f
grub_emu_lite-symlist.o:(.data+0xf08): undefined reference to `start'
d9d99f
collect2: error: ld returned 1 exit status
d9d99f
make[3]: *** [Makefile:25959: grub-emu-lite] Error 1
d9d99f
make[3]: *** Waiting for unfinished jobs....
d9d99f
cat kernel_syms.input | grep -v '^#' | sed -n \
d9d99f
  -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined kernel '""'\1/;p;}' \
d9d99f
  -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined kernel '""'\1/;p;}' \
d9d99f
  | sort -u >kernel_syms.lst
d9d99f
d9d99f
The problem is that start and _start symbols are exported unconditionally,
d9d99f
but these aren't defined for grub-emu since is an emultaed platform so it
d9d99f
doesn't have a startup logic. Don't attempt to export those for grub-emu.
d9d99f
d9d99f
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
d9d99f
---
d9d99f
 include/grub/kernel.h | 2 ++
d9d99f
 1 file changed, 2 insertions(+)
d9d99f
d9d99f
diff --git a/include/grub/kernel.h b/include/grub/kernel.h
d9d99f
index ae69218af20..9548d552aad 100644
d9d99f
--- a/include/grub/kernel.h
d9d99f
+++ b/include/grub/kernel.h
d9d99f
@@ -108,8 +108,10 @@ grub_addr_t grub_modules_get_end (void);
d9d99f
 
d9d99f
 #endif
d9d99f
 
d9d99f
+#if !defined(GRUB_MACHINE_EMU)
d9d99f
 void EXPORT_FUNC(start) (void);
d9d99f
 void EXPORT_FUNC(_start) (void);
d9d99f
+#endif
d9d99f
 
d9d99f
 /* The start point of the C code.  */
d9d99f
 void grub_main (void) __attribute__ ((noreturn));