dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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