aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cgcc
diff options
Diffstat (limited to 'cgcc')
-rwxr-xr-xcgcc25
1 files changed, 20 insertions, 5 deletions
diff --git a/cgcc b/cgcc
index 4aeb2da6..1f7b625c 100755
--- a/cgcc
+++ b/cgcc
@@ -236,9 +236,18 @@ sub add_specs {
} elsif ($spec eq 'linux') {
return &add_specs ('unix') .
' -D__linux__=1 -D__linux=1 -Dlinux=linux';
+ } elsif ($spec eq 'gnu/kfreebsd') {
+ return &add_specs ('unix') .
+ ' -D__FreeBSD_kernel__=1';
} elsif ($spec eq 'openbsd') {
return &add_specs ('unix') .
' -D__OpenBSD__=1';
+ } elsif ($spec eq 'freebsd') {
+ return &add_specs ('unix') .
+ ' -D__FreeBSD__=1';
+ } elsif ($spec eq 'netbsd') {
+ return &add_specs ('unix') .
+ ' -D__NetBSD__=1';
} elsif ($spec eq 'darwin') {
return
' -D__APPLE__=1 -D__MACH__=1';
@@ -287,7 +296,6 @@ sub add_specs {
} elsif ($spec eq 'ppc64') {
return (' -D__powerpc__=1 -D__PPC__=1 -D_STRING_ARCH_unaligned=1' .
' -D__powerpc64__=1 -D__PPC64__=1' .
- ' -D_CALL_ELF=2' .
' -m64' .
&float_types (1, 1, 21, [24,8], [53,11], [113,15]));
} elsif ($spec eq 's390x') {
@@ -297,7 +305,14 @@ sub add_specs {
&define_size_t ("long unsigned int") .
' -D__SIZEOF_POINTER__=' . ($m64 ? '8' : '4'));
} elsif ($spec eq 'arm') {
- return (' -D__arm__=1 -m32' .
+ chomp (my $gccmachine = `$cc -dumpmachine`);
+ my $cppsymbols = ' -D__arm__=1 -m32';
+
+ if ($gccmachine eq 'arm-linux-gnueabihf') {
+ $cppsymbols .= ' -D__ARM_PCS_VFP=1';
+ }
+
+ return ($cppsymbols .
&float_types (1, 1, 36, [24,8], [53,11], [53, 11]));
} elsif ($spec eq 'aarch64') {
return (' -D__aarch64__=1 -m64' .
@@ -318,14 +333,14 @@ sub add_specs {
} elsif ($arch =~ /^(ppc)$/i) {
return &add_specs ('ppc');
} elsif ($arch =~ /^(ppc64)$/i) {
- return &add_specs ('ppc64') . ' -mbig-endian';
+ return &add_specs ('ppc64') . ' -mbig-endian -D_CALL_ELF=1';
} elsif ($arch =~ /^(ppc64le)$/i) {
- return &add_specs ('ppc64') . ' -mlittle-endian';
+ return &add_specs ('ppc64') . ' -mlittle-endian -D_CALL_ELF=2';
} elsif ($arch =~ /^(s390x)$/i) {
return &add_specs ('s390x');
} elsif ($arch =~ /^(sparc64)$/i) {
return &add_specs ('sparc64');
- } elsif ($arch =~ /^(arm)$/i) {
+ } elsif ($arch =~ /^arm(?:v[78]l)?$/i) {
return &add_specs ('arm');
} elsif ($arch =~ /^(aarch64)$/i) {
return &add_specs ('aarch64');