forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 917133acc701dbc4636165d3b08d15dc5829a06f Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Wed, 17 Aug 2016 04:06:34 -0400
Subject: [PATCH] grub module explicitly keeps symbole .module_license
 
While using oe-core toolchain to strip grub module 'all_video.mod',
it stripped symbol table:
 
---------------
root@localhost:~# objdump -t all_video.mod
 
all_video.mod:     file format elf64-x86-64
 
SYMBOL TABLE:
no symbols
--------------
 
It caused grub to load module all_video failed.
--------------
grub> insmod all_video
error: no symbol table.
--------------
 
Tweak strip option to keep symbol .module_license could workaround
the issue.
--------------
root@localhost:~# objdump -t all_video.mod
 
all_video.mod:     file format elf64-x86-64
 
SYMBOL TABLE:
0000000000000000 l    d  .text  0000000000000000 .text
0000000000000000 l    d  .data  0000000000000000 .data
0000000000000000 l    d  .module_license        0000000000000000 .module_license
0000000000000000 l    d  .bss   0000000000000000 .bss
0000000000000000 l    d  .moddeps       0000000000000000 .moddeps
0000000000000000 l    d  .modname       0000000000000000 .modname
--------------
 
Upstream-Status: Pending
 
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 grub-core/genmod.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in
index 1250589..dd14308 100644
--- a/grub-core/genmod.sh.in
+++ b/grub-core/genmod.sh.in
@@ -56,7 +56,7 @@ if test x@TARGET_APPLE_LINKER@ != x1; then
     if test x@platform@ != xemu; then
         @TARGET_STRIP@ --strip-unneeded \
         -K grub_mod_init -K grub_mod_fini \
-        -K _grub_mod_init -K _grub_mod_fini \
+        -K _grub_mod_init -K _grub_mod_fini -K .module_license \
         -R .note.gnu.gold-version -R .note.GNU-stack \
         -R .gnu.build.attributes \
         -R .rel.gnu.build.attributes \