mirror of
https://github.com/golang/go
synced 2024-11-23 06:30:06 -07:00
libmach: accept OS X binary generated by external linker
Fixes cpu subtype check when using external linker which sets the CPU_SUBTYPE_LIB64 bit (1<<31). Fixes #6197. R=golang-dev, minux.ma, rsc CC=golang-dev https://golang.org/cl/13248046
This commit is contained in:
parent
736cb08b97
commit
8edf764fa3
@ -1076,7 +1076,7 @@ machdotout(int fd, Fhdr *fp, ExecHdr *hp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mp->cpusubtype != MACH_CPU_SUBTYPE_X86) {
|
||||
if (mp->cpusubtype != MACH_CPU_SUBTYPE_X86 && mp->cpusubtype != MACH_CPU_SUBTYPE_X86_64) {
|
||||
werrstr("bad MACH cpu subtype - not amd64");
|
||||
return 0;
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ enum {
|
||||
MACH_CPU_TYPE_X86_64 = (1<<24)|7,
|
||||
MACH_CPU_TYPE_X86 = 7,
|
||||
MACH_CPU_SUBTYPE_X86 = 3,
|
||||
MACH_CPU_SUBTYPE_X86_64 = (1<<31)|3,
|
||||
MACH_EXECUTABLE_TYPE = 2,
|
||||
MACH_SEGMENT_32 = 1, /* 32-bit mapped segment */
|
||||
MACH_SEGMENT_64 = 0x19, /* 64-bit mapped segment */
|
||||
|
Loading…
Reference in New Issue
Block a user