Commit 8edf764f authored by Arnaud Ysmal's avatar Arnaud Ysmal Committed by Brad Fitzpatrick

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
parent 736cb08b
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment