On powerpc64, using the "Dl" unit breaks ParamCount
Original Reporter info from Mantis: Michalis @michaliskambi
-
Reporter name: Michalis Kamburelis
Original Reporter info from Mantis: Michalis @michaliskambi
- Reporter name: Michalis Kamburelis
Description:
If I use in my program the "Dl" unit on powerpc64, then ParamCount is always -1. And ArgC is always 0. Effectively, you cannot process command-line arguments using the standard ParamCount/ParamStr utilities, or even using the ArgC/ArgV C-like variables.
This is reproducible using the simplest ParamCount example program on http://www.freepascal.org/docs-html/rtl/system/paramcount.html , just add "uses Dl;" at the beginning. Attaching.
The issue has come up when trying to build Castle Game Engine package on Debian Linux running powerpc64, and logs indicate that the issue affects both powerpc64 and powerpc architectures (but not any other architecture). I tested this using Debian-provided FPC version (3.0.0+dfsg-2), I did not test using pristine FPC version from freepascal.org --- I report it here assuming that problem is probably upstream, sorry in advance if I'm mistaken.
Example session:
$ uname -a
Linux pizzetti 3.16.0-4-powerpc64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) ppc64 GNU/Linux
$ fpc testpars.lpr
Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for powerpc64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for PowerPC64
Compiling testpars.lpr
Assembling program
Linking testpars
/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
7 lines compiled, 0.1 sec
$ ./testpars 1 2 3
/home/michalis/testpars : Got -1 command-line parameters:
# after commenting out "uses Dl;" and recompiling, result is Ok:
$ ./testpars 1 2 3
/home/michalis/testpars : Got 3 command-line parameters:
1
2
3
Mantis conversion info:
- Mantis ID: 29587
- OS: Debian GNU/Linux
- OS Build: stretch(testing)
- Platform: powerpc64
- Version: 3.0.0
- Fixed in version: 3.0.1
- Fixed in revision: 33046 (#fcc86b7b)
- Monitored by: » paul.gevers (Paul Gevers)