summaryrefslogtreecommitdiffstats
path: root/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:40:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:40:31 +0000
commitb86570f63e533abcbcb97c2572e0e5732a96307b (patch)
treecabc83be691530ae685c45a8bc7620ccc0e1ebdf /scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl
parentInitial commit. (diff)
downloaddpkg-b86570f63e533abcbcb97c2572e0e5732a96307b.tar.xz
dpkg-b86570f63e533abcbcb97c2572e0e5732a96307b.zip
Adding upstream version 1.20.13.upstream/1.20.13upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl')
-rwxr-xr-xscripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl b/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl
new file mode 100755
index 0000000..48434f4
--- /dev/null
+++ b/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+#
+# spacesyms-c-gen.pl
+#
+# Output a C file that contains symbols matching the shell glob
+# sym{defaultver,longver,shortver}{nospace,SPACE}{default,hidden,protected,internal}
+# with symbol visibility matching the final element and at least one relocation
+# against each symbol.
+#
+# When used together with spacesyms-o-map.pl and spacesyms.map, makes a shared
+# object that contains symbols that covers all cases of:
+#
+# 1) has a short, long or Base version,
+# 2) has or does not have a space in the symbol name,
+# 3) default, hidden, protected or internal visibility.
+
+use strict;
+use warnings;
+
+my @symbols;
+
+foreach my $version (qw(defaultver longver shortver)) {
+ foreach my $space (qw(nospace SPACE)) {
+ foreach my $visibility (qw(default hidden protected internal)) {
+ my $symbol = "sym$version$space$visibility";
+ push @symbols, $symbol;
+ print "void $symbol(void) __attribute__((visibility(\"$visibility\")));\n";
+ print "void $symbol(void) {}\n";
+ }
+ }
+}
+
+print "void (*funcs[])(void) = {\n";
+foreach my $symbol (@symbols) {
+ print "$symbol,\n";
+}
+print "};\n";