nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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