1
0
mirror of https://github.com/golang/go synced 2024-11-23 08:40:08 -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:
Arnaud Ysmal 2013-09-10 11:50:34 -07:00 committed by Brad Fitzpatrick
parent 736cb08b97
commit 8edf764fa3
2 changed files with 2 additions and 1 deletions

View File

@ -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;
}

View File

@ -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 */