* INSTALL: Document cross-compilation.
* acinclude.m4: Determine whether nm support -P and --defined-only. * configure.ac: Add TARGET_ to all variables pertaining to target that don't have it yet. * gentpl.py: Likewise. * grub-core/Makefile.am: Likewise. * grub-core/genmod.sh.in: Likewise. * grub-core/gensyminfo.sh.in: Handle OpenBSD and other non-GNU nm as well.
This commit is contained in:
parent
ca1fb56345
commit
fc97214f7e
8 changed files with 187 additions and 37 deletions
|
@ -264,11 +264,11 @@ 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 $(NM) > $@
|
||||
rm -f $@; echo $(MOD_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 $(NM) > $@
|
||||
rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
|
||||
CLEANFILES += grub_emu_init.c
|
||||
endif
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ rm -f $tmpfile $outfile
|
|||
|
||||
if test x@TARGET_APPLE_CC@ != x1; then
|
||||
# stripout .modname and .moddeps sections from input module
|
||||
@OBJCOPY@ -R .modname -R .moddeps $infile $tmpfile
|
||||
@TARGET_OBJCOPY@ -R .modname -R .moddeps $infile $tmpfile
|
||||
|
||||
# Attach .modname and .moddeps sections
|
||||
t1=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
|
@ -47,9 +47,9 @@ if test x@TARGET_APPLE_CC@ != x1; then
|
|||
for dep in $deps; do printf "$dep\0" >> $t2; done
|
||||
|
||||
if test -n "$deps"; then
|
||||
@OBJCOPY@ --add-section .modname=$t1 --add-section .moddeps=$t2 $tmpfile
|
||||
@TARGET_OBJCOPY@ --add-section .modname=$t1 --add-section .moddeps=$t2 $tmpfile
|
||||
else
|
||||
@OBJCOPY@ --add-section .modname=$t1 $tmpfile
|
||||
@TARGET_OBJCOPY@ --add-section .modname=$t1 $tmpfile
|
||||
fi
|
||||
rm -f $t1 $t2
|
||||
|
||||
|
@ -57,7 +57,7 @@ if test x@TARGET_APPLE_CC@ != x1; then
|
|||
./${TARGET_OBJ2ELF} $tmpfile || exit 1
|
||||
fi
|
||||
if test x@platform@ != xemu; then
|
||||
@STRIP@ --strip-unneeded \
|
||||
@TARGET_STRIP@ --strip-unneeded \
|
||||
-K grub_mod_init -K grub_mod_fini \
|
||||
-K _grub_mod_init -K _grub_mod_fini \
|
||||
-R .note.gnu.gold-version -R .note.GNU-stack \
|
||||
|
@ -87,7 +87,7 @@ else
|
|||
mv $tmpfile2 $tmpfile
|
||||
|
||||
cp $tmpfile $tmpfile.bin
|
||||
@OBJCONV@ -f@TARGET_MODULE_FORMAT@ \
|
||||
@TARGET_OBJCONV@ -f@TARGET_MODULE_FORMAT@ \
|
||||
-nr:_grub_mod_init:grub_mod_init \
|
||||
-nr:_grub_mod_fini:grub_mod_fini \
|
||||
-wd1106 -nu -nd $tmpfile.bin $tmpfile || exit 1
|
||||
|
|
|
@ -22,14 +22,13 @@ module=$1
|
|||
modname=`echo $module | sed -e 's@\.module.*$@@'`
|
||||
|
||||
# Print all symbols defined by module
|
||||
if test x@TARGET_APPLE_CC@ = x1; then
|
||||
@NM@ -g -P -p $module | \
|
||||
grep -E '^[a-zA-Z0-9_]* [TDS]' | \
|
||||
sed "s@^\([^ ]*\).*@defined $modname \1@g"
|
||||
if test x"@TARGET_NMFLAGS_DEFINED_ONLY@" = x; then
|
||||
@TARGET_NM@ -g @TARGET_NMFLAGS_MINUS_P@ -p $module | \
|
||||
sed -n "s@^\([0-9a-fA-F]*\) *[TBRDS] *\([^ ]*\).*@defined $modname \2@p"
|
||||
else
|
||||
@NM@ -g --defined-only -P -p $module | \
|
||||
@TARGET_NM@ -g --defined-only @TARGET_NMFLAGS_MINUS_P@ -p $module | \
|
||||
sed "s@^\([^ ]*\).*@defined $modname \1@g"
|
||||
fi
|
||||
|
||||
# Print all undefined symbols used by module
|
||||
@NM@ -u -P -p $module | sed "s@^\([^ ]*\).*@undefined $modname \1@g"
|
||||
@TARGET_NM@ -u @TARGET_NMFLAGS_MINUS_P@ -p $module | sed "s@^\([^ ]*\).*@undefined $modname \1@g"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue