Skip to contentSkip to conversation

use MODULE_FILES for genemuinit* instead of MOD_FILES

PATCH In review Andrey Borzenkov 2 participants 6 messages Jan 18, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use MODULE_FILES for genemuinit* instead of MOD_FILES

MinGW native nm does not support ELF binaries. While on it, pass detected nm arguments instead of hardcoding them.

---
 grub-core/Makefile.am         | 6 +++---
 grub-core/genemuinit.sh       | 9 +++++----
 grub-core/genemuinitheader.sh | 9 +++++----
 3 files changed, 13 insertions(+), 11 deletions(-)
grub-core/Makefile.am +3 -3
index 13b7979..704ae90 100644
@@ -292,12 +292,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
 kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
 grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
 
-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
+grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) $(TARGET_NMFLAGS_MINUS_P) $(TARGET_NMFLAGS_DEFINED_ONLY) > $@
 CLEANFILES += grub_emu_init.h
 
 grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) $(TARGET_NMFLAGS_MINUS_P) $(TARGET_NMFLAGS_DEFINED_ONLY) > $@
 CLEANFILES += grub_emu_init.c
 endif
 
grub-core/genemuinit.sh +5 -4
index 45c15ec..58fb604 100644
@@ -13,6 +13,7 @@
 
 nm="$1"
 shift
+nmargs="$*"
 
 cat <<EOF
 /* This file is automatically generated by geninit.sh. DO NOT EDIT! */
@@ -46,8 +47,8 @@ EOF
 
 read mods
 for line in $mods; do
-  if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
-      echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_init > /dev/null; then
+      echo "grub_${line%%.*}_init ();"
   fi
 done
 
@@ -62,8 +63,8 @@ grub_fini_all (void)
 EOF
 
 for line in $mods; do
-  if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-      echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_fini > /dev/null; then
+      echo "grub_${line%%.*}_fini ();"
   fi
 done
 
grub-core/genemuinitheader.sh +5 -4
index 6b83f59..8631157 100644
@@ -13,6 +13,7 @@
 
 nm="$1"
 shift
+nmargs="$*"
 
 cat <<EOF
 /* This file is automatically generated by gensymlist.sh. DO NOT EDIT! */
@@ -43,10 +44,10 @@ EOF
 
 read mods
 for line in $mods; do
-  if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
-      echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_init > /dev/null; then
+      echo "void grub_${line%%.*}_init (void);"
   fi
-  if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-      echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
+  if ${nm} ${nmargs} -p ${line} | grep grub_mod_fini > /dev/null; then
+      echo "void grub_${line%%.*}_fini (void);"
   fi
 done
Signature · 1 line
tg: (5ef569d..) u/mingw/use_MODULE_FILES_for_genemu (depends on: master)
#1 lore raw
Quoted 2 lines · Andrey Borzenkov

While on it, pass detected
nm arguments instead of hardcoding them.

please make this part a separate patch. This would indicate that you support non-portable nm output which in this branch isn't the case. Why do you need it in the first place?

#2 lore raw

В Sat, 18 Jan 2014 17:55:38 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 4 lines · Andrey Borzenkov
Quoted 2 lines

While on it, pass detected
nm arguments instead of hardcoding them.

please make this part a separate patch.

is it OK to commit without this part?

Quoted 4 lines

This would indicate that you
support non-portable nm output which in this branch isn't the case. Why do you need it in the first place?

I do not need it for MinGW case; but it just looks incorrect in general case - first we check nm arguments and then ignore it. I agree that mixing two patches was wrong on my side.

#3 lore raw
Quoted 10 lines · Andrey Borzenkov

В Sat, 18 Jan 2014 17:55:38 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 4 lines · Andrey Borzenkov
Quoted 2 lines

While on it, pass detected
nm arguments instead of hardcoding them.

please make this part a separate patch.

is it OK to commit without this part?

could you send the remaining part alone? It's difficult to see throught intermingled patch.

Quoted 7 lines
Quoted 4 lines

This would indicate that you
support non-portable nm output which in this branch isn't the case. Why do you need it in the first place?

I do not need it for MinGW case; but it just looks incorrect in general case - first we check nm arguments and then ignore it.

Because relevant support in scripts isn't available yet.

Quoted 10 lines

I agree that
mixing two patches was wrong on my side.

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#4 lore raw

В Sat, 18 Jan 2014 19:08:35 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 5 lines · Andrey Borzenkov
Quoted 4 lines

В Sat, 18 Jan 2014 17:55:38 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:

Quoted 1 line · Andrey Borzenkov
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

While on it, pass detected
nm arguments instead of hardcoding them.

please make this part a separate patch.

is it OK to commit without this part?

could you send the remaining part alone? It's difficult to see throught intermingled patch.

From: Andrey Borzenkov <[email protected]>
Subject: [PATCH] use MODULE_FILES for genemuinit* instead of MOD_FILES

MinGW native nm does not support ELF binaries.

---
 grub-core/Makefile.am         | 6 +++---
 grub-core/genemuinit.sh       | 4 ++--
 grub-core/genemuinitheader.sh | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
grub-core/Makefile.am +3 -3
index 826b3dd..61aa166 100644
@@ -294,12 +294,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
 kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
 grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
 
-grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
+grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
 CLEANFILES += grub_emu_init.h
 
 grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
-	rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
+	rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
 CLEANFILES += grub_emu_init.c
 endif
 
grub-core/genemuinit.sh +2 -2
index 45c15ec..8c6bb1c 100644
@@ -47,7 +47,7 @@ EOF
 read mods
 for line in $mods; do
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
-      echo "grub_${line}_init ();" | sed 's,\.mod,,g;'
+      echo "grub_${line%%.*}_init ();"
   fi
 done
 
@@ -63,7 +63,7 @@ EOF
 
 for line in $mods; do
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-      echo "grub_${line}_fini ();" | sed 's,\.mod,,g;'
+      echo "grub_${line%%.*}_fini ();"
   fi
 done
 
grub-core/genemuinitheader.sh +2 -2
index 6b83f59..a99a15d 100644
@@ -44,9 +44,9 @@ EOF
 read mods
 for line in $mods; do
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_init > /dev/null; then
-      echo "void grub_${line}_init (void);" | sed 's,\.mod,,g;'
+      echo "void grub_${line%%.*}_init (void);"
   fi
   if ${nm} --defined-only -P -p ${line} | grep grub_mod_fini > /dev/null; then
-      echo "void grub_${line}_fini (void);" | sed 's,\.mod,,g;'
+      echo "void grub_${line%%.*}_fini (void);"
   fi
 done
Signature · 1 line
tg: (6c519b5..) u/mingw/use_MODULE_FILES_for_genemu (depends on: master)