foft
Certified Guru
I am getting a crash when some of my code is not optimised. At -O1 it works, but at -O0 it gives me a "Prefetch abort". It fails on an fprintf and I'm trying to work out why! It never reaches the _write in my syscall.c... Note that this is with Gcc 3.4.
Anyway I'm trying to work out which optimisation flag causes it to start working. I thought it might give me a clue what is going on.
The flags I use to build an optimised build are: ->works
CFLAGS = -Wall -O1 -march=armv4t -marm -mthumb-interwork -msoft-float -ffast-math -fshort-enums -nostdlib -fno-common -fno-builtin -fno-exceptions -mstructure-size-boundary=8 -fomit-frame-pointer $(INCLUDE)
For a non-optimised build: -> crashes
CFLAGS = -Wall -O0 -march=armv4t -marm -mthumb-interwork -msoft-float -ffast-math -fshort-enums -nostdlib -fno-common -fno-builtin -fno-exceptions -mstructure-size-boundary=8 -fomit-frame-pointer $(INCLUDE)
Then I tried adding the flags one at a time to do an equivalent of -O1. Even with all the flags it crashes! I believe it should be identical to -O1 (which works)? Did I miss anything?
CFLAGS = -Wall \
-fdefer-pop \
-fmerge-constants \
-fthread-jumps \
-floop-optimize \
-fif-conversion \
-fif-conversion2 \
-fdelayed-branch \
-fguess-branch-probability \
-fcprop-registers \
-march=armv4t -marm -mthumb-interwork -msoft-float -ffast-math -fshort-enums -nostdlib -fno-common -fno-builtin -fno-exceptions -mstructure-size-boundary=8 -fomit-frame-pointer $(INCLUDE)
Does anyone have any ideas? Am I passing gcc obviously wrong options here? I'll post my syscall.c and gpmain.c if it helps.
Thanks,
Mark
Anyway I'm trying to work out which optimisation flag causes it to start working. I thought it might give me a clue what is going on.
The flags I use to build an optimised build are: ->works
CFLAGS = -Wall -O1 -march=armv4t -marm -mthumb-interwork -msoft-float -ffast-math -fshort-enums -nostdlib -fno-common -fno-builtin -fno-exceptions -mstructure-size-boundary=8 -fomit-frame-pointer $(INCLUDE)
For a non-optimised build: -> crashes
CFLAGS = -Wall -O0 -march=armv4t -marm -mthumb-interwork -msoft-float -ffast-math -fshort-enums -nostdlib -fno-common -fno-builtin -fno-exceptions -mstructure-size-boundary=8 -fomit-frame-pointer $(INCLUDE)
Then I tried adding the flags one at a time to do an equivalent of -O1. Even with all the flags it crashes! I believe it should be identical to -O1 (which works)? Did I miss anything?
CFLAGS = -Wall \
-fdefer-pop \
-fmerge-constants \
-fthread-jumps \
-floop-optimize \
-fif-conversion \
-fif-conversion2 \
-fdelayed-branch \
-fguess-branch-probability \
-fcprop-registers \
-march=armv4t -marm -mthumb-interwork -msoft-float -ffast-math -fshort-enums -nostdlib -fno-common -fno-builtin -fno-exceptions -mstructure-size-boundary=8 -fomit-frame-pointer $(INCLUDE)
Does anyone have any ideas? Am I passing gcc obviously wrong options here? I'll post my syscall.c and gpmain.c if it helps.
Thanks,
Mark