Dear All, On Mon, 2016-02-22 at 00:32 +0100, Abou Al Montacir wrote: > Hi Paul, > > On Wed, 2016-02-17 at 22:26 +0100, Paul Gevers wrote: > > Hmm, I was a tiny little bit wrong earlier. > > > > I modified hedgewars a tiny bit (patch attached) and build in on > > debomatic¹. You can see that the failing line reads: > > "Lua test file specified: /<<PKGBUILDDIR>>/tests/lua/hellfire_burns.lua" > ... > > Anyways, it now fails for an access violation. I don't like this at all, > > but it is hard to say if this is a fpc error or hedgewars'. > I've tried some simpler code and it looks like the compilation options used by > hedgewars cause the issue. I don't know if this is normal or not but at least > we know now that it is not an issue in the code itself but rather in the > compilation flags. > > I'm copying FPC core in case some one can help with the impact of the used > compilation flags. > > Here are my experimentation: > I first created very small programs: > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ cat test1.pas > program test; > begin > WriteLn('Hello'); > end. > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ cat test2.pas > program test; > begin > WriteLn(stdout, 'Hello'); > end. > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ > > I first compile using no special flags and both programs execute well: > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ fpc test1 > Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for arm > Copyright (c) 1993-2015 by Florian Klaempfl and others > Target OS: Linux for ARMEL > Compiling test1.pas > Assembling test > Linking test1 > /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget > -T? > 4 lines compiled, 0.3 sec > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ ./test1 > Hello > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ fpc test2 > Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for arm > Copyright (c) 1993-2015 by Florian Klaempfl and others > Target OS: Linux for ARMEL > Compiling test2.pas > Assembling test > Linking test2 > /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget > -T? > 4 lines compiled, 0.3 sec > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ ./test2 > Hello > > Now, we use a subset of compilation flags from hedgewars and we can just > reproduce the issue on second program but not the first one: > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ fpc -FU/home/abou/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars/CMakeFiles/hwengine.dir -k-rpath > -k'\$ORIGIN/../lib/:\$ORIGIN/:/usr/lib/hedgewars/lib/' -FD/usr/bin -Cs2000000 > -fPIC -Fl/home/abou/hedgewars-0.9.22-dfsg/obj-arm-linux-gnueabi/bin -k- > L/usr/lib/arm-linux-gnueabi -Fl/usr/lib/arm-linux-gnueabi -Fl/usr/lib/arm- > linux-gnueabi -XLAlua=lua5.1 -Fl/usr/lib/arm-linux-gnueabi/libphysfs.so -O2 -g > -gl -gp -dUSE_VIDEO_RECORDING -dPNG_SCREENSHOTS -dSDL_MIXER_NEWER > -dSDL_IMAGE_NEWER -dDEBUGFILE test1 > Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for arm > Copyright (c) 1993-2015 by Florian Klaempfl and others > Target OS: Linux for ARMEL > Compiling test1.pas > Assembling test > Linking test1 > /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget > -T? > 4 lines compiled, 0.3 sec > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ ./test1 > Hello > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ fpc -FU/home/abou/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars/CMakeFiles/hwengine.dir -k-rpath > -k'\$ORIGIN/../lib/:\$ORIGIN/:/usr/lib/hedgewars/lib/' -FD/usr/bin -Cs2000000 > -fPIC -Fl/home/abou/hedgewars-0.9.22-dfsg/obj-arm-linux-gnueabi/bin -k- > L/usr/lib/arm-linux-gnueabi -Fl/usr/lib/arm-linux-gnueabi -Fl/usr/lib/arm- > linux-gnueabi -XLAlua=lua5.1 -Fl/usr/lib/arm-linux-gnueabi/libphysfs.so -O2 -g > -gl -gp -dUSE_VIDEO_RECORDING -dPNG_SCREENSHOTS -dSDL_MIXER_NEWER > -dSDL_IMAGE_NEWER -dDEBUGFILE test2 > Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for arm > Copyright (c) 1993-2015 by Florian Klaempfl and others > Target OS: Linux for ARMEL > Compiling test2.pas > Assembling test > Linking test2 > /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget > -T? > 4 lines compiled, 0.3 sec > (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux- > gnueabi/hedgewars$ ./test2 > Runtime error 103 at $000101C8 > $000101C8 $main, line 3 of test2.pas > > It is not clear for me why RTE 103 is thrown, in the second case but not in > the first one. I'd expect either both work or neither. Also I don't see what > is the impact of the compilation flags that are used. Maybe I should perform > more experimentations in order to find a smaller subset. but that will be > enough for tonight!I finally managed to find the wrong option! It is -fPIC. Below are tests with only -fPIC and with only -O2. (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux-gnueabi/hedgewars$ fpc -fPIC test2 && ./test2 Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for arm Copyright (c) 1993-2015 by Florian Klaempfl and others Target OS: Linux for ARMEL Compiling test2.pas Assembling test Linking test2 /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T? 4 lines compiled, 0.3 sec Runtime error 103 at $000101D8 $000101D8 $00010124 (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux-gnueabi/hedgewars$ fpc -O2 test2 && ./test2 Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for arm Copyright (c) 1993-2015 by Florian Klaempfl and others Target OS: Linux for ARMEL Compiling test2.pas Assembling test Linking test2 /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T? 4 lines compiled, 0.3 sec Hello (sid_armel-dchroot)abou@abel:~/hedgewars-0.9.22-dfsg/obj-arm-linux-gnueabi/hedgewars$
Looks like PIC code was broken in 3.0. Is there anyone aware of that? How can we fix that? -- Cheers, Abou Al Montacir
signature.asc
Description: This is a digitally signed message part