Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 37a4351

Browse files
committed
[[ VersionScript ]] Generate version script from stubs
This patch allows the stubs file to be output as a version script that can be used with the `-Wl,--version-script=<file>` linker option.
1 parent 93a1601 commit 37a4351

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

util/list_stub_symbols.pl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ sub trim
1515

1616
my ($exportDefArg, $exportDefModule) = split(/=/, $exportDefOpt);
1717
my $isWindows = $exportDefArg eq "--exportdef";
18+
my $isLinux = $exportDefArg eq "--version-script";
1819

1920
# Read all of the input data
2021
open INPUT, "<$inputFile"
@@ -39,6 +40,11 @@ sub trim
3940
print OUTPUT "LIBRARY $exportDefModule\n";
4041
print OUTPUT "EXPORTS\n";
4142
}
43+
elsif ($isLinux)
44+
{
45+
print OUTPUT "$exportDefModule {\n";
46+
print OUTPUT " global:\n";
47+
}
4248

4349
# Symbol index counter
4450
my $symbolIndex = 1;
@@ -87,10 +93,20 @@ sub trim
8793
{
8894
print OUTPUT " $prefix$symbol \@$symbolIndex\n";
8995
}
96+
elsif ($isLinux)
97+
{
98+
print OUTPUT " $prefix$symbol;\n";
99+
}
90100
else
91101
{
92102
print OUTPUT "$prefix$symbol\n";
93103
}
94104

95105
$symbolIndex += 1;
96106
}
107+
108+
if ($isLinux)
109+
{
110+
print OUTPUT " local: *;\n";
111+
print OUTPUT "};\n";
112+
}

0 commit comments

Comments
 (0)