mirror of
https://github.com/golang/go
synced 2024-11-20 05:14:41 -07:00
8l/6l: new -Hwindowsgui flag allows to build windows gui pe
Fixes #1516. R=rsc, mattn CC=golang-dev https://golang.org/cl/4214041
This commit is contained in:
parent
a1d95deaaa
commit
75fb2f6c82
@ -51,6 +51,7 @@ Header headers[] = {
|
||||
"linux", Hlinux,
|
||||
"freebsd", Hfreebsd,
|
||||
"windows", Hwindows,
|
||||
"windowsgui", Hwindows,
|
||||
0, 0
|
||||
};
|
||||
|
||||
|
@ -57,6 +57,7 @@ Header headers[] = {
|
||||
"nacl", Hnacl,
|
||||
"freebsd", Hfreebsd,
|
||||
"windows", Hwindows,
|
||||
"windowsgui", Hwindows,
|
||||
"tiny", Htiny,
|
||||
0, 0
|
||||
};
|
||||
|
@ -1271,8 +1271,10 @@ headtype(char *name)
|
||||
int i;
|
||||
|
||||
for(i=0; headers[i].name; i++)
|
||||
if(strcmp(name, headers[i].name) == 0)
|
||||
if(strcmp(name, headers[i].name) == 0) {
|
||||
headstring = headers[i].name;
|
||||
return headers[i].val;
|
||||
}
|
||||
fprint(2, "unknown header type -H %s\n", name);
|
||||
errorexit();
|
||||
return -1; // not reached
|
||||
|
@ -211,31 +211,33 @@ enum {
|
||||
|
||||
/* executable header types */
|
||||
enum {
|
||||
Hgarbunix = 0, // garbage unix
|
||||
Hnoheader, // no header
|
||||
Hunixcoff, // unix coff
|
||||
Hrisc, // aif for risc os
|
||||
Hplan9x32, // plan 9 32-bit format
|
||||
Hplan9x64, // plan 9 64-bit format
|
||||
Hmsdoscom, // MS-DOS .COM
|
||||
Hnetbsd, // NetBSD
|
||||
Hmsdosexe, // fake MS-DOS .EXE
|
||||
Hixp1200, // IXP1200 (raw)
|
||||
Helf, // ELF32
|
||||
Hipaq, // ipaq
|
||||
Hdarwin, // Apple Mach-O
|
||||
Hlinux, // Linux ELF
|
||||
Hnacl, // Google Native Client
|
||||
Hfreebsd, // FreeBSD ELF
|
||||
Hwindows, // MS Windows PE
|
||||
Htiny // tiny (os image)
|
||||
Hgarbunix = 0, // garbage unix
|
||||
Hnoheader, // no header
|
||||
Hunixcoff, // unix coff
|
||||
Hrisc, // aif for risc os
|
||||
Hplan9x32, // plan 9 32-bit format
|
||||
Hplan9x64, // plan 9 64-bit format
|
||||
Hmsdoscom, // MS-DOS .COM
|
||||
Hnetbsd, // NetBSD
|
||||
Hmsdosexe, // fake MS-DOS .EXE
|
||||
Hixp1200, // IXP1200 (raw)
|
||||
Helf, // ELF32
|
||||
Hipaq, // ipaq
|
||||
Hdarwin, // Apple Mach-O
|
||||
Hlinux, // Linux ELF
|
||||
Hnacl, // Google Native Client
|
||||
Hfreebsd, // FreeBSD ELF
|
||||
Hwindows, // MS Windows PE
|
||||
Htiny // tiny (os image)
|
||||
};
|
||||
|
||||
typedef struct Header Header;
|
||||
struct Header {
|
||||
char *name;
|
||||
int val;
|
||||
char *name;
|
||||
int val;
|
||||
};
|
||||
|
||||
extern Header headers[];
|
||||
int headtype(char*);
|
||||
EXTERN char* headstring;
|
||||
extern Header headers[];
|
||||
|
||||
int headtype(char*);
|
||||
|
@ -526,7 +526,10 @@ asmbpe(void)
|
||||
set(MinorSubsystemVersion, 0);
|
||||
set(SizeOfImage, nextsectoff);
|
||||
set(SizeOfHeaders, PEFILEHEADR);
|
||||
set(Subsystem, 3); // WINDOWS_CUI
|
||||
if(strcmp(headstring, "windowsgui") == 0)
|
||||
set(Subsystem, IMAGE_SUBSYSTEM_WINDOWS_GUI);
|
||||
else
|
||||
set(Subsystem, IMAGE_SUBSYSTEM_WINDOWS_CUI);
|
||||
set(SizeOfStackReserve, 0x0040000);
|
||||
set(SizeOfStackCommit, 0x00001000);
|
||||
set(SizeOfHeapReserve, 0x00100000);
|
||||
|
@ -131,6 +131,9 @@ enum {
|
||||
IMAGE_DIRECTORY_ENTRY_IAT = 12,
|
||||
IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13,
|
||||
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14,
|
||||
|
||||
IMAGE_SUBSYSTEM_WINDOWS_GUI = 2,
|
||||
IMAGE_SUBSYSTEM_WINDOWS_CUI = 3,
|
||||
};
|
||||
|
||||
void peinit(void);
|
||||
|
@ -6,6 +6,8 @@ GOOS=windows
|
||||
|
||||
include ../../../Make.inc
|
||||
|
||||
LD:=$(LD) -Hwindowsgui
|
||||
|
||||
TARG=wingui
|
||||
|
||||
GOFILES=\
|
||||
|
Loading…
Reference in New Issue
Block a user