-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcc 6.3.0 internal compiler error when building mkfs.c #19
Comments
Rao reports another vararg related error on gcc 7.3.0 cc -std=c99 /home/rshoaib/nanovm/uniboot/boot/../runtime/contgen.c -g -o /home/rshoaib/nanovm/uniboot/boot/../runtime/contgen |
it might be worthwhile to set expectations for build envs in the readme w/pref for latest/greatest versions |
On Aug 2, 2018, at 1:52PM, convolvatron ***@***.***> wrote:
Rao reports another vararg related error on gcc 7.3.0
cc -std=c99 /home/rshoaib/nanovm/uniboot/boot/../runtime/contgen.c -g -o /home/rshoaib/nanovm/uniboot/boot/../runtime/contgen
/home/rshoaib/nanovm/uniboot/boot/../runtime/contgen 10 10 > /home/rshoaib/nanovm/uniboot/boot/../runtime/closure_templates.h
cc -m32 -O -fno-stack-protector -include def32.h -I/home/rshoaib/nanovm/uniboot/boot/../x86_64 -I/home/rshoaib/nanovm/uniboot/boot/../runtime -I/home/rshoaib/nanovm/
uniboot/boot/../tfs -I. -I../runtime stage2.c -c
In file included from /home/rshoaib/nanovm/uniboot/boot/../runtime/runtime.h:128:0,
from stage2.c:1:
/home/rshoaib/nanovm/uniboot/boot/../runtime/status.h: In function ‘timm_term’:
/home/rshoaib/nanovm/uniboot/boot/../runtime/status.h:11:23: error: first argument to ‘va_arg’ not of type ‘va_list’
char *f = varg(a, char *);
^~~~
FWIW, I have attached the changes I made to the filesystem branch to build with gcc-4.9 on Debian Stretch. Probably better to fix what's broken on 6.0 (or 7.3.0), but I was anxious to get an image...
This isn't a patch for submission, just a quick hack to get a build. Also, the change to rol() is wrong for the 32 bit build. If it's a persistent issue with (whatever gcc version we choose), I'll sort it out. It didn't appear that it would break anything in the short term.
The -std=gnu99 (as opposed to c99) was necessary for the asm inlines. I'm not sure what the state of this is with newer versions.
I can go ahead and clean up the makefiles a bit and add a build.mk to gather defines in one place if there are no objections.
Any thoughts on a gcc version to target?
Will
diff --git a/boot/Makefile b/boot/Makefile
index 3be8535..cb26791 100644
--- a/boot/Makefile
+++ b/boot/Makefile
@@ -27,6 +27,8 @@ OBJ = service32.o stage2.o serial.o page.o elf.o zero_wrap.o kvm_platform.o $(TF
LD = ld
OD = objdump
+CC = gcc-4.9
+CFLAGS = -std=gnu99
stage2.elf: $(OBJ) linker_script
$(LD) -T linker_script -e _start $(OBJ) $(LIBC) -o $@
@@ -38,7 +40,7 @@ service32.o: service32.s
nasm -felf $<
%.o: %.c $(ROOT)/runtime/closure_templates.h
- cc -m32 -O -fno-stack-protector -include def32.h $(INCLUDES) -I. -I../runtime $< -c
+ $(CC) $(CFLAGS) -m32 -O -fno-stack-protector -include def32.h $(INCLUDES) -I. -I../runtime $< -c
clean:
rm -f *.o *~ stage2.elf stage2 bottom.list stage1 stage2.pad boot
diff --git a/examples/Makefile b/examples/Makefile
index 867c4c3..5e6938c 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -1,13 +1,16 @@
-all: hw web hwg webg
+all: hw web hwg webg fst
+
+CC=gcc-4.9
+CFLAGS=-std=gnu99
hwg: hwg.go
go build hwg.go
hw: hw.c
- cc hw.c -o hw
+ $(CC) $(CFLAGS) hw.c -o hw
web: web.c
- cc web.c -g -o web
+ $(CC) $(CFLAGS) web.c -g -o web
webg: webg.go
go build webg.go
diff --git a/mkfs/Makefile b/mkfs/Makefile
index e8384f5..0bc1d95 100644
--- a/mkfs/Makefile
+++ b/mkfs/Makefile
@@ -1,7 +1,8 @@
-
all:mkfs dump
ROOT=$(PWD)/..
+CC=gcc-4.9
+CFLAGS=-std=gnu99 -g
INCLUDES = -include def64.h
include $(ROOT)/runtime/Makefile
@@ -9,13 +10,13 @@ INCLUDES += -I$(ROOT)/x86_64
include $(ROOT)/tfs/Makefile
%.o: %.c $(ROOT)/runtime/closure_templates.h
- cc -g -c $(INCLUDES) $<
+ $(CC) $(CFLAGS) -c $(INCLUDES) $<
mkfs: mkfs.o $(UNIXRUNTIME) $(TFS)
- cc $^ -g -o mkfs
+ $(CC) $(CFLAGS) $^ -o mkfs
dump: dump.o $(UNIXRUNTIME) $(TFS)
- cc $^ -g -o dump
+ $(CC) $(CFLAGS) $^ -o dump
clean:
rm -f *.o mkfs
diff --git a/stage3/Makefile b/stage3/Makefile
index 6d5fe29..9e391ad 100644
--- a/stage3/Makefile
+++ b/stage3/Makefile
@@ -2,6 +2,8 @@ ROOT = ..
all:stage3
INCLUDES = -include def64.h
+CC = gcc-4.9
+CFLAGS = -std=gnu99
include $(ROOT)/runtime/Makefile
include $(ROOT)/x86_64/Makefile
@@ -19,7 +21,7 @@ stage3: $(NETOBJ) stage3.o $(RUNTIME) $(RUNTIME_EXTRA) $(VIRTIO) $(VIRTIO_NET) $
ld -n -e_start -T linker_script -nostdlib $^ -o stage3
.c.o:
- cc $(INCLUDES) -O -nostdinc -fno-stack-protector $< -c
+ $(CC) $(CFLAGS) $(INCLUDES) -O -nostdinc -fno-stack-protector $< -c
# fix the frame nasm clean
clean:
diff --git a/x86_64/x86_64.h b/x86_64/x86_64.h
index 0e0fdab..220ad1b 100644
--- a/x86_64/x86_64.h
+++ b/x86_64/x86_64.h
@@ -61,11 +61,20 @@ static inline void write_barrier()
asm ("sfence");
}
+#ifndef BITS32
#define rol(__x, __b)\
({\
- __asm__("rol %1, %0": "=g"(__x): "i" (__b));\
+ __asm__("rolq %1, %0": "=g"(__x): "i" (__b));\
__x;\
- })\
+ })
+#else
+/* XXX not right, just trying to get -m32 boot to compile */
+#define rol(__x, __b)\
+ ({\
+ __asm__("roll %1, %0": "=g"(__x): "i" (__b));\
+ __x;\
+ })
+#endif
/*static inline u64 msb(u64 x)
{
|
32 bit random() is def not a priority. and yes, the makefiles are a bit of a mess. i think part of it is getting lwip set up properly, if you want ideally we wouldn't be very compiler version sensitive...but, we are using alot of asm and |
fixes checked into master -major issues were some bad varargs types and need to enable see instructions for 32 bit code in stage2 CRs |
In a fresh filesystem branch:
wjhun@tiger:/share/src/uniboot$ cc --version
cc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
wjhun@tiger:/share/src/uniboot$ make
make -f image.mk image
make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
make[1]: Entering directory '/share/src/uniboot'
cd boot ; make
make[2]: Entering directory '/share/src/uniboot/boot'
nasm -felf service32.s
cc -std=c99 /share/src/uniboot/boot/../runtime/contgen.c -g -o /share/src/uniboot/boot/../runtime/contgen
/share/src/uniboot/boot/../runtime/contgen 10 10 > /share/src/uniboot/boot/../runtime/closure_templates.h
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime stage2.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../x86_64/serial.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../x86_64/page.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../x86_64/elf.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/heap/zero_wrap.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../x86_64/kvm_platform.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../tfs/tlog.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../tfs/tfs.c -c
In file included from /share/src/uniboot/boot/../runtime/runtime.h:126:0,
from /share/src/uniboot/boot/../tfs/tfs_internal.h:1,
from /share/src/uniboot/boot/../tfs/tfs.c:1:
/share/src/uniboot/boot/../tfs/tfs.c: In function ‘fs_read_extent’:
/share/src/uniboot/boot/../tfs/tfs.c:28:85: warning: passing argument 5 of ‘fs->r’ from incompatible pointer type [-Wincompatible-pointer-types]
apply(fs->r, buffer_ref(target, i.start), range_span(i), u64_from_pointer(val), f);
^
/share/src/uniboot/boot/../runtime/closure.h:5:40: note: in definition of macro ‘apply’
#define apply(__c, ...) (__c)(__c, ## VA_ARGS)
^~~~~~~~~~~
/share/src/uniboot/boot/../tfs/tfs.c:28:85: note: expected ‘status_length_handler {aka void ()(void *, long long unsigned int, struct table *)}’ but argument is of type ‘status_handler {aka void ()(void *, struct table )}’
apply(fs->r, buffer_ref(target, i.start), range_span(i), u64_from_pointer(val), f);
^
/share/src/uniboot/boot/../runtime/closure.h:5:40: note: in definition of macro ‘apply’
#define apply(__c, ...) (__c)(__c, ## VA_ARGS)
^~~~~~~~~~~
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../tfs/merge.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/table.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/buffer.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/format.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/heap/id.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/symbol.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/heap/rolling.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/tuple.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/random.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/rtrie.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/runtime_init.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/extra_prints.c -c
cc -m32 -O -fno-stack-protector -include def32.h -I/share/src/uniboot/boot/../x86_64 -I/share/src/uniboot/boot/../runtime -I/share/src/uniboot/boot/../tfs -I. -I../runtime /share/src/uniboot/boot/../runtime/heap/debug_heap.c -c
ld -T linker_script -e _start service32.o stage2.o serial.o page.o elf.o zero_wrap.o kvm_platform.o tlog.o tfs.o merge.o table.o buffer.o format.o id.o symbol.o rolling.o tuple.o random.o rtrie.o runtime_init.o extra_prints.o debug_heap.o -o stage2.elf
strip stage2.elf -o stage2.strip
objcopy -S -O binary stage2.strip stage2
dd if=stage2 of=stage2.pad bs=512 conv=sync
81+1 records in
82+0 records out
41984 bytes (42 kB, 41 KiB) copied, 0.000657015 s, 63.9 MB/s
nasm -l stage1.lst -dSTAGE1SIZE=512 -dSTAGE2SIZE=41984 stage1.s -o stage1
cat stage1 stage2.pad > boot
make[2]: Leaving directory '/share/src/uniboot/boot'
cd mkfs ; make
make[2]: Entering directory '/share/src/uniboot/mkfs'
cc -g -c -include def64.h -I/share/src/uniboot/mkfs/../runtime -I/share/src/uniboot/mkfs/../x86_64 -I/share/src/uniboot/mkfs/../tfs mkfs.c
In file included from :32:0:
/share/src/uniboot/mkfs/../x86_64/def64.h: In function ‘format_pointer’:
/share/src/uniboot/mkfs/../x86_64/def64.h:48:5: internal compiler error: in build_va_arg, at c-family/c-common.c:5812
u64 x = varg(a, u64);
^~~
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-6/README.Bugs for instructions.
Makefile:12: recipe for target 'mkfs.o' failed
make[2]: *** [mkfs.o] Error 1
make[2]: Leaving directory '/share/src/uniboot/mkfs'
image.mk:8: recipe for target 'mkfs/mkfs' failed
make[1]: *** [mkfs/mkfs] Error 2
make[1]: Leaving directory '/share/src/uniboot'
Makefile:8: recipe for target 'image' failed
make: *** [image] Error 2
wjhun@tiger:/share/src/uniboot$
The text was updated successfully, but these errors were encountered: