public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch]  pe-i386: Fix --subsystem windows option
@ 2003-08-07  0:38 Danny Smith
  2003-08-07  1:18 ` Christopher Faylor
  0 siblings, 1 reply; 2+ messages in thread
From: Danny Smith @ 2003-08-07  0:38 UTC (permalink / raw)
  To: binutils; +Cc: Christopher Faylor

The --subsystem windows switch is currently not setting
the correct entry point for GUI apps on mingw32 and cygwin,
but is leaving it at the default for console apps.

Here is a simple testcase submitted to mingw list:

/* gui_assert.c */
#include <windows.h>
#include <assert.h>

int __stdcall WinMain( HINSTANCE hInst, HINSTANCE hPreInst,
		       LPSTR lpszCmdLine, int nCmdShow)
{
  assert(0);
  return 0;
}


When compiled as gcc -mwindows gui_assert.c, the resulting app should
pop up a window's dialog box with a message from _assert and a choice to
abort, retry, or ignore.  Currently it opens a console box with
standard assert diagnostics. 

Changing emultempl/pe.em:set_pe_subsystem() to pass the entry name
determined by the command line switch --subsystem  with the cmdline arg set
to TRUE (compare beos.em) fixes by preventing the entry name from being
overriden by the default set in emulparams/i386_pe.sh.

I also think that the default set by  gld_${EMULATION_NAME}_before_parse
should have the cmdline arg set to FALSE, since this is not
determined by the command line, but by target defaults.


Danny

ChangeLog

2003-08-07  Danny Smith  <dannysmith@users.sourceforge.net>

	* emultempl/pe.em (gld_${EMULATION_NAME}_before_parse):
	Change second (cmdline) arg to lang_add_entry to FALSE.
	(set_pe_subsystem): Change second arg to lang_add_entry to TRUE.


Index: emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.80
diff -c -3 -p -r1.80 pe.em
*** emultempl/pe.em	27 Jun 2003 00:38:25 -0000	1.80
--- emultempl/pe.em	6 Aug 2003 23:53:08 -0000
*************** gld_${EMULATION_NAME}_before_parse (void
*** 141,149 ****
  
  #if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
  #if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
!   lang_add_entry ("WinMainCRTStartup", 1);
  #else
!   lang_add_entry ("_WinMainCRTStartup", 1);
  #endif
  #endif
  #endif
--- 141,149 ----
  
  #if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
  #if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
!   lang_add_entry ("WinMainCRTStartup", FALSE);
  #else
!   lang_add_entry ("_WinMainCRTStartup", FALSE);
  #endif
  #endif
  #endif
*************** set_pe_subsystem (void)
*** 439,445 ****
  	      entry = alc_entry;
  	    }
  
! 	  lang_add_entry (entry, 0);
  
  	  return;
  	}
--- 439,445 ----
  	      entry = alc_entry;
  	    }
  
! 	  lang_add_entry (entry, TRUE);
  
  	  return;
  	}

http://personals.yahoo.com.au - Yahoo! Personals
-  New people, new possibilities! Try Yahoo! Personals, FREE for a limited period!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch]  pe-i386: Fix --subsystem windows option
  2003-08-07  0:38 [Patch] pe-i386: Fix --subsystem windows option Danny Smith
@ 2003-08-07  1:18 ` Christopher Faylor
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Faylor @ 2003-08-07  1:18 UTC (permalink / raw)
  To: Danny Smith; +Cc: binutils

On Thu, Aug 07, 2003 at 10:38:11AM +1000, Danny Smith wrote:
>2003-08-07  Danny Smith  <dannysmith@users.sourceforge.net>
>
>	* emultempl/pe.em (gld_${EMULATION_NAME}_before_parse):
>	Change second (cmdline) arg to lang_add_entry to FALSE.
>	(set_pe_subsystem): Change second arg to lang_add_entry to TRUE.

Looks right.  It seems like this has been broken for a long time.
Hard to believe.

Ok to apply.

cgf

>Index: emultempl/pe.em
>===================================================================
>RCS file: /cvs/src/src/ld/emultempl/pe.em,v
>retrieving revision 1.80
>diff -c -3 -p -r1.80 pe.em
>*** emultempl/pe.em	27 Jun 2003 00:38:25 -0000	1.80
>--- emultempl/pe.em	6 Aug 2003 23:53:08 -0000
>*************** gld_${EMULATION_NAME}_before_parse (void
>*** 141,149 ****
>  
>  #if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
>  #if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
>!   lang_add_entry ("WinMainCRTStartup", 1);
>  #else
>!   lang_add_entry ("_WinMainCRTStartup", 1);
>  #endif
>  #endif
>  #endif
>--- 141,149 ----
>  
>  #if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
>  #if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
>!   lang_add_entry ("WinMainCRTStartup", FALSE);
>  #else
>!   lang_add_entry ("_WinMainCRTStartup", FALSE);
>  #endif
>  #endif
>  #endif
>*************** set_pe_subsystem (void)
>*** 439,445 ****
>  	      entry = alc_entry;
>  	    }
>  
>! 	  lang_add_entry (entry, 0);
>  
>  	  return;
>  	}
>--- 439,445 ----
>  	      entry = alc_entry;
>  	    }
>  
>! 	  lang_add_entry (entry, TRUE);
>  
>  	  return;
>  	}
>
>http://personals.yahoo.com.au - Yahoo! Personals
>-  New people, new possibilities! Try Yahoo! Personals, FREE for a limited period!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-07  1:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-07  0:38 [Patch] pe-i386: Fix --subsystem windows option Danny Smith
2003-08-07  1:18 ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).