Use a hash to avoid duplicate canonical symbol entries in the label map.
[ksplice.git] / ksplice-cc.pl
blob7cdac920817d0b89dea50fc4dec965eb4416d942
1 #!/usr/bin/perl
3 # Copyright (C) 2008 Anders Kaseorg <andersk@mit.edu>,
4 # Jeffrey Brian Arnold <jbarnold@mit.edu>,
5 # Tim Abbott <tabbott@mit.edu>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License, version 2.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
18 # 02110-1301, USA.
20 use strict;
21 use warnings;
22 use IPC::Open3;
24 my @cmd;
25 foreach (@ARGV) {
26 if (/^-ksplice-cflags-api=1$/) {
27 push @cmd, qw(-D__DATE__="<{DATE...}>" -D__TIME__="<{TIME}>");
28 } else {
29 push @cmd, $_;
33 my $pid = open3('<&STDIN', '>&STDOUT', \*ERROR, @cmd);
34 while (<ERROR>) {
35 next if /^<command[- ]line>(?::\d+:\d+)?: warning: "(?:__DATE__|__TIME__)" redefined$/;
36 print STDERR;
38 close ERROR;
39 waitpid($pid, 0) == $pid and ($? & 127) == 0 or die;
40 exit($? >> 8);