[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Weird behavior of nested functions
From: |
Marco Gerards |
Subject: |
Re: Weird behavior of nested functions |
Date: |
10 Nov 2003 00:11:40 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Hi,
Thanks for your quick reply!
"Yoshinori K. Okuji" <address@hidden> writes:
> On Sunday 09 November 2003 23:16, Marco Gerards wrote:
> > This only happens if do_foo has 3 or more arguments and as I said this
> > does not happen when running from GNU/Linux, etc.
>
> It sounds like it is due to mixing up objects compiled differently. As the
> i386 version of PUPA is compiled with -mrtd and -mregparm, you can corrupt
> the stack space if you compile some of your code without the options.
This doesn't seem to be the problem. This is the relevant part of the
build output:
gcc -I. -Iinclude -I./include -Wall -W -Wall -W -Wshadow -Wpointer-arith
-Wmissing-prototypes
-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 -falign-loops=1
-falign-functions=1 -fno-
builtin -mrtd -mregparm=3 -c -o mod-test.o mod-test.c
And I haven't modified anything else, I've only added this module.
For completeness I have included the complete diff against CVS this
time so you can see how it is built.
Is it possible that some object files for the utils and pupa mix up?
Thanks,
Marco
Index: conf/i386-pc.mk
===================================================================
RCS file: /cvsroot/pupa/pupa/conf/i386-pc.mk,v
retrieving revision 1.9
diff -u -p -r1.9 i386-pc.mk
--- conf/i386-pc.mk 29 Oct 2003 18:44:26 -0000 1.9
+++ conf/i386-pc.mk 9 Nov 2003 22:58:49 -0000
@@ -402,7 +402,7 @@ genmoddep-util_genmoddep.d: util/genmodd
# Modules.
-pkgdata_MODULES = _chain.mod _linux.mod fat.mod ext2.mod normal.mod hello.mod \
+pkgdata_MODULES = _chain.mod _linux.mod fat.mod ext2.mod normal.mod hello.mod
test.mod \
vga.mod font.mod
# For _chain.mod.
@@ -672,6 +672,45 @@ hello_mod-hello_hello.d: hello/hello.c
-include hello_mod-hello_hello.d
hello_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For test.mod.
+test_mod_SOURCES = test/test.c
+CLEANFILES += test.mod mod-test.o mod-test.c pre-test.o test_mod-test_test.o
def-test.lst und-test.lst
+MOSTLYCLEANFILES += test_mod-test_test.d
+DEFSYMFILES += def-test.lst
+UNDSYMFILES += und-test.lst
+
+test.mod: pre-test.o mod-test.o
+ -rm -f $@
+ $(LD) -r -o $@ $^
+ $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R
.comment $@
+
+pre-test.o: test_mod-test_test.o
+ -rm -f $@
+ $(LD) -r -o $@ $^
+
+mod-test.o: mod-test.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(test_mod_CFLAGS) -c -o $@ $<
+
+mod-test.c: moddep.lst genmodsrc.sh
+ sh $(srcdir)/genmodsrc.sh 'test' $< > $@ || (rm -f $@; exit 1)
+
+def-test.lst: pre-test.o
+ $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 test/' > $@
+
+und-test.lst: pre-test.o
+ echo 'test' > $@
+ $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+test_mod-test_test.o: test/test.c
+ $(CC) -Itest -I$(srcdir)/test $(CPPFLAGS) $(CFLAGS) $(test_mod_CFLAGS)
-c -o $@ $<
+
+test_mod-test_test.d: test/test.c
+ set -e; $(CC) -Itest -I$(srcdir)/test $(CPPFLAGS) $(CFLAGS)
$(test_mod_CFLAGS) -M $< | sed 's,test\.o[ :]*,test_mod-test_test.o $@ : ,g'
> $@; [ -s $@ ] || rm -f $@
+
+-include test_mod-test_test.d
+
+test_mod_CFLAGS = $(COMMON_CFLAGS)
# For vga.mod.
vga_mod_SOURCES = term/i386/pc/vga.c
Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/pupa/pupa/conf/i386-pc.rmk,v
retrieving revision 1.9
diff -u -p -r1.9 i386-pc.rmk
--- conf/i386-pc.rmk 29 Oct 2003 18:44:27 -0000 1.9
+++ conf/i386-pc.rmk 9 Nov 2003 22:58:49 -0000
@@ -61,7 +61,7 @@ pupa_setup_SOURCES = util/i386/pc/pupa-s
genmoddep_SOURCES = util/genmoddep.c
# Modules.
-pkgdata_MODULES = _chain.mod _linux.mod fat.mod ext2.mod normal.mod hello.mod \
+pkgdata_MODULES = _chain.mod _linux.mod fat.mod ext2.mod normal.mod hello.mod
test.mod \
vga.mod font.mod
# For _chain.mod.
@@ -89,6 +89,10 @@ normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For hello.mod.
hello_mod_SOURCES = hello/hello.c
hello_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For test.mod.
+test_mod_SOURCES = test/test.c
+test_mod_CFLAGS = $(COMMON_CFLAGS)
# For vga.mod.
vga_mod_SOURCES = term/i386/pc/vga.c