$OpenBSD$
--- cgcc.orig	Mon Feb 17 09:44:57 2014
+++ cgcc	Mon Apr 14 18:44:40 2014
@@ -255,7 +255,7 @@ sub add_specs {
 		&define_size_t ("long unsigned int") .
 		' -D__SIZEOF_POINTER__=8');
     } elsif ($spec eq 'x86_64') {
-	return (' -Dx86_64=1 -D__x86_64=1 -D__x86_64__=1' . ($m32 ? '' : ' -D__LP64__=1') .
+	return (' -D__amd64__ -D__amd64 -Dx86_64=1 -D__x86_64=1 -D__x86_64__=1' . ($m32 ? '' : ' -D__LP64__=1') .
 		&integer_types (8, 16, 32, $m32 ? 32 : 64, 64, 128) .
 		&float_types (1, 1, 33, [24,8], [53,11], [113,15]) .
 		&define_size_t ($m32 ? "unsigned int" : "long unsigned int") .
@@ -278,6 +278,8 @@ sub add_specs {
 	} elsif ($arch =~ /^(sun4u)$/i) {
 	    return &add_specs ('sparc');
 	} elsif ($arch =~ /^(x86_64)$/i) {
+	    return &add_specs ('x86_64');
+	} elsif ($arch =~ /^(amd64)$/i) {
 	    return &add_specs ('x86_64');
 	} elsif ($arch =~ /^(ppc)$/i) {
 	    return &add_specs ('ppc');
