Open dmik opened 8 years ago
It needs to be pointed out though that the problem in configure
happens only for those projects that try to detect the executable extension themselves bypassing the autotools-provided definition $ac_cv_exeext
(which is always correctly set to .exe
on OS/2). A solution for such projects is to fix their configure.ac
accordingly.
As well as, some make files have the same problem. Anyway, this is a problem of ld. See http://trac.netlabs.org/libc/ticket/350.
@komh Thank you for the hint. It makes sense. Though as I mention it's not only about the extension itself but also about the format of the executable. It seems that if you specify .exe
or .dll
(and there is no '-Zomf`), gcc (ld) also appends the EMX stub to the A.OUT binary it generates making a valid LX exe or dll. It should do regardless of the extension I think. I will leave it open here until it gets fully cleared up.
The -Zexe was introduced to work around this issue and since pggc2.95 will also create an executable stub to load the binary, eg foo loads foo.exe, which will make makefiles without $EXEEXT happy. Of course the correct way on OS/2 is to specify the .exe extension to create an executable program I'll also note that here, I haven't had to use -Zexe in many years.
Dave, please check LIBC #350, I've put my findings there. You seem to be right about -Zexe
. I guess we should remove this switch at all.
Currently, GCC will generate an A.OUT executable (or DLL) if it is given the
-o
option w/o specifying the extension of the output file and there is also no-Zomf
option on the GCC command line. Can be easily reproduced with this:First, it is a bit weird that changing the output file extension changes the binary format. Second, there is no point in generating A.OUT binaries at all on OS/2 (at least until we fix the A.OUT loader for the OS/2 kernel which frozen in its deep alpha stage). We should make GCC always generate LX binaries, regardless of the extension or
-Zomf
presence.This bug affects all
configure
-based projects that compileconftest.c
files not only to check for compiler errors but also to run them afterwards: an attempt to run an A.OUTconftest
executable will end up insh
interpreting it as a shell script with a subsequent weird execution failure and configure abortion.