Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix a typo
[simgrid.git] / tools / stack-cleaner / compiler-wrapper
1 #!/usr/bin/perl -w
2 # Compiler wrapper with stack-cleaner support (enabled by default).
3 # Usage: ./compiler-wrapper target-compiler args [-f[no-]stack-cleaner]
4
5 use File::Basename;
6
7 my $compiler = shift(@ARGV);
8
9 my $enable = 1;
10
11 my @args;
12 my $arg;
13 while($arg=shift(@ARGV)) {
14   if ($arg eq "-fno-stack-cleaner") {
15     $enable = 0;    
16   } elsif ($arg eq "-fstack-cleaner") {
17     $enable = 1;
18   }
19   else {
20     push @args, $arg;
21   }
22 }
23
24 if ($enable) {
25   if (basename($0) =~ /^clang/) {
26     unshift @args, "-no-integrated-as"
27   }
28   unshift @args, dirname($0);
29   unshift @args, "-B";
30 }
31
32 exec $compiler, @args