Be less untruthful about the prototypes of external functions
Be less untruthful about the prototypes of external functions

GHC's generated C code uses dummy prototypes for foreign imports.  At the
moment these all claim to be (void), i.e. functions of zero arguments.  On
most platforms this doesn't matter very much: calls to these functions put
the parameters in the usual places anyway, and (with the exception of
varargs) things just work.

However, the ELFv2 ABI on ppc64 optimises stack allocation
(http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html): a call to a
function that has a prototype, is not varargs, and receives all parameters
in registers rather than on the stack does not require the caller to
allocate an argument save area.  The incorrect prototypes cause GCC to
believe that all functions declared this way can be called without an
argument save area, but if the callee has sufficiently many arguments then
it will expect that area to be present, and will thus corrupt the caller's
stack.  This happens in particular with calls to runInteractiveProcess in
libraries/process/cbits/runProcess.c.

The simplest fix appears to be to declare these external functions with an
unspecified argument list rather than a void argument list.  This is no
worse for platforms that don't care either way, and allows a successful
bootstrap of GHC 7.8 on little-endian Linux ppc64 (which uses the ELFv2
ABI).

Fixes #8965

Signed-off-by: Colin Watson <d514d28a659d5ed85d53ff6b16a4aec48491bf35@debian.org>
Signed-off-by: Austin Seipp <7ea35d812706d9213868749011af1ed4fa2f6aa0@well-typed.com>

ml9951/ghc,urbanslug/ghc,mfine/ghc,vTurbine/ghc,nathyong/microghc-ghc,lukexi/ghc,mcschroeder/ghc,spacekitteh/smcghc,holzensp/ghc,snoyberg/ghc,sdiehl/ghc,holzensp/ghc,GaloisInc/halvm-ghc,sgillespie/ghc,nkaretnikov/ghc,lukexi/ghc,forked-upstream-packages-for-ghcjs/ghc,snoyberg/ghc,oldmanmike/ghc,ghc-android/ghc,oldmanmike/ghc,gcampax/ghc,snoyberg/ghc,vTurbine/ghc,nushio3/ghc,nkaretnikov/ghc,holzensp/ghc,tibbe/ghc,oldmanmike/ghc,shlevy/ghc,mfine/ghc,ezyang/ghc,acowley/ghc,wxwxwwxxx/ghc,acowley/ghc,anton-dessiatov/ghc,GaloisInc/halvm-ghc,vikraman/ghc,wxwxwwxxx/ghc,wxwxwwxxx/ghc,sdiehl/ghc,nushio3/ghc,fmthoma/ghc,vTurbine/ghc,olsner/ghc,olsner/ghc,AlexanderPankiv/ghc,nushio3/ghc,siddhanathan/ghc,tjakway/ghcjvm,jstolarek/ghc,nkaretnikov/ghc,mfine/ghc,fmthoma/ghc,vikraman/ghc,acowley/ghc,da-x/ghc,urbanslug/ghc,ezyang/ghc,olsner/ghc,AlexanderPankiv/ghc,forked-upstream-packages-for-ghcjs/ghc,ml9951/ghc,olsner/ghc,spacekitteh/smcghc,bitemyapp/ghc,nushio3/ghc,vTurbine/ghc,mcschroeder/ghc,siddhanathan/ghc,bitemyapp/ghc,jstolarek/ghc,shlevy/ghc,vikraman/ghc,elieux/ghc,sgillespie/ghc,sdiehl/ghc,mettekou/ghc,ml9951/ghc,frantisekfarka/ghc-dsi,mfine/ghc,mettekou/ghc,gridaphobe/ghc,olsner/ghc,sdiehl/ghc,anton-dessiatov/ghc,ml9951/ghc,TomMD/ghc,mfine/ghc,christiaanb/ghc,nkaretnikov/ghc,TomMD/ghc,sgillespie/ghc,nathyong/microghc-ghc,sgillespie/ghc,anton-dessiatov/ghc,wxwxwwxxx/ghc,forked-upstream-packages-for-ghcjs/ghc,da-x/ghc,TomMD/ghc,ghc-android/ghc,GaloisInc/halvm-ghc,wxwxwwxxx/ghc,nathyong/microghc-ghc,ml9951/ghc,nkaretnikov/ghc,nushio3/ghc,nkaretnikov/ghc,wxwxwwxxx/ghc,ryantm/ghc,gridaphobe/ghc,urbanslug/ghc,siddhanathan/ghc,GaloisInc/halvm-ghc,tibbe/ghc,tjakway/ghcjvm,ml9951/ghc,mcschroeder/ghc,mcschroeder/ghc,shlevy/ghc,AlexanderPankiv/ghc,ghc-android/ghc,mcschroeder/ghc,green-haskell/ghc,christiaanb/ghc,anton-dessiatov/ghc,lukexi/ghc,mettekou/ghc,shlevy/ghc,gcampax/ghc,elieux/ghc,siddhanathan/ghc,mcschroeder/ghc,sdiehl/ghc,olsner/ghc,siddhanathan/ghc,tibbe/ghc,vTurbine/ghc,ghc-android/ghc,bitemyapp/ghc,acowley/ghc,forked-upstream-packages-for-ghcjs/ghc,tjakway/ghcjvm,acowley/ghc,tjakway/ghcjvm,snoyberg/ghc,gridaphobe/ghc,da-x/ghc,frantisekfarka/ghc-dsi,green-haskell/ghc,anton-dessiatov/ghc,anton-dessiatov/ghc,olsner/ghc,vikraman/ghc,GaloisInc/halvm-ghc,ryantm/ghc,sgillespie/ghc,jstolarek/ghc,wxwxwwxxx/ghc,vTurbine/ghc,mettekou/ghc,oldmanmike/ghc,urbanslug/ghc,ryantm/ghc,elieux/ghc,TomMD/ghc,da-x/ghc,nkaretnikov/ghc,sdiehl/ghc,nathyong/microghc-ghc,jstolarek/ghc,ezyang/ghc,TomMD/ghc,lukexi/ghc,nushio3/ghc,nushio3/ghc,christiaanb/ghc,elieux/ghc,TomMD/ghc,oldmanmike/ghc,gcampax/ghc,elieux/ghc,snoyberg/ghc,TomMD/ghc,fmthoma/ghc,ghc-android/ghc,fmthoma/ghc,green-haskell/ghc,gcampax/ghc,oldmanmike/ghc,spacekitteh/smcghc,urbanslug/ghc,vikraman/ghc,da-x/ghc,ml9951/ghc,frantisekfarka/ghc-dsi,sgillespie/ghc,AlexanderPankiv/ghc,ryantm/ghc,GaloisInc/halvm-ghc,christiaanb/ghc,frantisekfarka/ghc-dsi,tibbe/ghc,anton-dessiatov/ghc,elieux/ghc,gridaphobe/ghc,nathyong/microghc-ghc,shlevy/ghc,elieux/ghc,ezyang/ghc,snoyberg/ghc,ezyang/ghc,gcampax/ghc,bitemyapp/ghc,GaloisInc/halvm-ghc,lukexi/ghc,nathyong/microghc-ghc,ghc-android/ghc,vikraman/ghc,urbanslug/ghc,forked-upstream-packages-for-ghcjs/ghc,sdiehl/ghc,frantisekfarka/ghc-dsi,tjakway/ghcjvm,tjakway/ghcjvm,ezyang/ghc,gcampax/ghc,green-haskell/ghc,gcampax/ghc,acowley/ghc,shlevy/ghc,forked-upstream-packages-for-ghcjs/ghc,spacekitteh/smcghc,da-x/ghc,gridaphobe/ghc,gridaphobe/ghc,ghc-android/ghc,fmthoma/ghc,mfine/ghc,sgillespie/ghc,da-x/ghc,mcschroeder/ghc,acowley/ghc,AlexanderPankiv/ghc,jstolarek/ghc,AlexanderPankiv/ghc,shlevy/ghc,vTurbine/ghc,mfine/ghc,fmthoma/ghc,tjakway/ghcjvm,christiaanb/ghc,gridaphobe/ghc,AlexanderPankiv/ghc,holzensp/ghc,nathyong/microghc-ghc,oldmanmike/ghc,vikraman/ghc,christiaanb/ghc,spacekitteh/smcghc,mettekou/ghc,bitemyapp/ghc,mettekou/ghc,siddhanathan/ghc,holzensp/ghc,snoyberg/ghc,ryantm/ghc,ezyang/ghc,tibbe/ghc,siddhanathan/ghc,forked-upstream-packages-for-ghcjs/ghc,mettekou/ghc,christiaanb/ghc,green-haskell/ghc,urbanslug/ghc,ml9951/ghc,fmthoma/ghc