[fpc-pascal] ARM Linux crosscompiler: compiles but... executable gives segmentation fault

Pierre Free Pascal pierre at freepascal.org
Fri Jan 10 14:29:48 CET 2014



> -----Message d'origine-----
> De : fpc-pascal-bounces at lists.freepascal.org [mailto:fpc-pascal-
> bounces at lists.freepascal.org] De la part de Michael Ring
> Envoyé : vendredi 10 janvier 2014 13:40
> À : FPC-Pascal users discussions
> Objet : Re: [fpc-pascal] ARM Linux crosscompiler: compiles but...
> executable gives segmentation fault
> 
> I think this is an ARMV6 specific Problem, I also realized while
> debugging on embedded target that it does not work anymore, same code
> compiled for ARMV7 debugs (and runs) just fine...
> 
> Until now I did not find the time to search for the revision that broke
> armv6m.
> 
> Michael
> 
> Am 10.01.14 13:27, schrieb Reinier Olislagers:
> > Hi all,
> >
> > For the Dutch among us: de dag die je wist dat zou komen...
> >
> > Thanks to earlier help I got to build an ARM Linux cross compiler
> module
> > in fpcup which even compiles fpcup itself (both using trunk and
> stable
> > starting compiler):
> > opt="-fPIC -dFPC_ARMHF"
> > crossopt="-CpARMV6 -CaEABIHF -CfVFPV2"
> >
> > fpc -g -gl -Tlinux -Parm simple.lpr
> >
> > Question: should I have compiled with -fPIC?
> >
> > Uploaded resulting executable
> > http://ubuntuone.com/0y3yXGcU8fEXR6OTMyvfGN
> >
> > The program:
> > program simple;
> >
> > begin
> >    writeln('hello');
> > end.
> >
> > Relevant fpc.cfg snippet:
> > #IFDEF CPUARM
> > #IFDEF LINUX
> > -CpARMV6
> > -CaEABIHF
> > -CfVFPV2
> > -FDC:\development\cross\bin\arm-linux\
> > -XParm-linux-
> > -Xd
> > -FlC:\development\cross\lib\arm-linux\
> > -Xr/usr/lib
> > #ENDIF
> > #ENDIF
> >
> > However, running the resulting binary on my virtual Raspbian fails
> with
> > a segmentation fault. Running under gdb gives
> > (gdb) run
> > Starting program: /root/simple
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x0002b6e4 in
> > SYSTEM_$$_ARRAYSTRINGTOPPCHAR$array_of_ANSISTRING$LONGINT$$PPCHAR ()

  Maybe it is just using an unsupported instruction?

what does "x /10i $pc" return?

Pierre Muller



More information about the fpc-pascal mailing list