dpkg (1.18.25) stretch; urgency=medium
[dpkg] / scripts / t / Dpkg_Shlibs / spacesyms-o-map.pl
CommitLineData
1479465f
GJ
1#!/usr/bin/perl
2#
3# spacesyms-o-map.pl INPUT OUTPUT
4#
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.
7
8use strict;
9use warnings;
10
11my ($input, $output) = @ARGV;
12my @cmds = ('objcopy');
13
14open my $nm, '-|', 'nm', $input or die "cannot run nm: $!";
15while (<$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";
21}
22close $nm;
23
24push @cmds, $input, $output;
25exec @cmds;