doc: Move Perl version baseline as the first perl coding style subsection
[dpkg.git] / scripts / t / Dpkg_Shlibs / spacesyms-o-map.pl
blob89a1caf71debf47d8425295d8b7c9cca53905696
1 #!/usr/bin/perl
3 # spacesyms-o-map.pl INPUT OUTPUT
5 # Copy the object file INPUT to OUTPUT, redefining any symbol in INPUT that
6 # contains "SPACE" in its name to contain "SPA CE" instead.
8 use strict;
9 use warnings;
11 my ($input, $output) = @ARGV;
12 my @cmds = ('objcopy');
14 open my $nm, '-|', 'nm', $input or die "cannot run nm: $!";
15 while (<$nm>) {
16 next if not m/SPACE/;
17 chomp;
18 my $x = (split / /, $_, 3)[2];
19 my $y = $x =~ s/SPACE/SPA CE/r;
20 push @cmds, "--redefine-sym=$x=$y";
22 close $nm;
24 push @cmds, $input, $output;
25 exec @cmds;