aboutsummaryrefslogtreecommitdiff
path: root/cgcc
diff options
context:
space:
mode:
authorAlberto Bertogli <albertito@gmail.com>2007-03-30 01:41:46 -0300
committerJosh Triplett <josh@freedesktop.org>2007-05-01 22:06:11 -0700
commit0fcbcbf4cf2e41fcfcd3361a8698d887f73058d0 (patch)
tree5b43d852737946c233bc8849743e1c2f50dcb3d2 /cgcc
parentTeach cgcc about -ventry and -vdead (diff)
downloadsparse-0fcbcbf4cf2e41fcfcd3361a8698d887f73058d0.tar.gz
sparse-0fcbcbf4cf2e41fcfcd3361a8698d887f73058d0.tar.bz2
sparse-0fcbcbf4cf2e41fcfcd3361a8698d887f73058d0.zip
Implement x86-64 support in cgcc.
This patch makes cgcc run on x86-64 machines by extending add_specs(). [original patch] Signed-off-by: Alberto Bertogli <albertito@gmail.com> [integer and size_t size fixes, -m32 support] Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'cgcc')
-rwxr-xr-xcgcc9
1 files changed, 9 insertions, 0 deletions
diff --git a/cgcc b/cgcc
index 1fba10b..e56226e 100755
--- a/cgcc
+++ b/cgcc
@@ -4,6 +4,7 @@
my $cc = $ENV{'REAL_CC'} || 'cc';
my $check = $ENV{'CHECK'} || 'sparse';
+my $m32 = 0;
my $m64 = 0;
my $has_specs = 0;
my $do_check = 0;
@@ -19,6 +20,7 @@ foreach (@ARGV) {
# Ditto for stdin.
$do_check = 1 if $_ eq '-';
+ $m32 = 1 if /^-m32$/;
$m64 = 1 if /^-m64$/;
if (/^-specs=(.*)$/) {
@@ -222,6 +224,11 @@ sub add_specs {
&integer_types (8, 16, 32, $m64 ? 64 : 32, 64) .
&float_types (1, 1, 33, [24,8], [53,11], [113,15]) .
&define_size_t ($m64 ? "long unsigned int" : "unsigned int"));
+ } elsif ($spec eq 'x86_64') {
+ return (' -Dx86_64=1 -D__x86_64=1 -D__x86_64__=1' .
+ &integer_types (8, 16, 32, $m32 ? 32 : 64, 64) .
+ &float_types (1, 1, 33, [24,8], [53,11], [113,15]) .
+ &define_size_t ($m32 ? "unsigned int" : "long unsigned int"));
} elsif ($spec eq 'host_os_specs') {
my $os = `uname -s`;
chomp $os;
@@ -233,6 +240,8 @@ sub add_specs {
return &add_specs ('i86');
} elsif ($arch =~ /^(sun4u)$/i) {
return &add_specs ('sparc');
+ } elsif ($arch =~ /^(x86_64)$/i) {
+ return &add_specs ('x86_64');
}
} else {
die "$0: invalid specs: $spec\n";