Bug 25821 - Generic symbol names exported from libmono
Summary: Generic symbol names exported from libmono
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-01-08 06:30 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2018-03-19 13:37 UTC (History)
4 users (show)

Tags: bugpool-archived
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rolf Bjarne Kvinge [MSFT] 2015-01-08 06:30:49 UTC
Mono exports several symbols with fairly generic names, which sometimes causes conflicts with third-party libraries defining the same symbols.

Here is a current list: https://gist.github.com/rolfbjarne/36e50db43d3d29eed8e8 (usually it's some of the Win32 symbols which cause problems).

We need a way to rename these symbols for iOS in order to be a good citizen. My guess is that this may affect Android as well, so a generic solution would be preferable.

I've tried hiding the non-prefixed symbols by merging the object files in the static mono library using ld (ld -r -exported_symbols_list <fileOfPublicSymbols> *.o), and while the resulting library works at least for a simple test case, the debug symbols are removed, and I could not find a way to prevent that (or add them back).

So I've come to the conclusion that the only solution is to fix the static mono library during the build, by either:

* Make consumers able to specify a custom mono-remap.h to remap any symbol.
* Make it a policy to only export symbols with a fixed set of prefixes.

I'm willing to implement the solution, once we've decided what to do.
Comment 1 Zoltan Varga 2015-01-15 15:08:34 UTC
Fixed the io-layer symbols at least, those usually are the ones causing the most problems.
Comment 2 Zoltan Varga 2015-01-15 15:10:05 UTC
In mono master 508417264359e6df50c9f9d86adad19b9535cc1b.
Comment 3 Ludovic Henry 2018-02-28 23:01:19 UTC
Updated list at https://gist.github.com/luhenry/37eb32f32a6a3d821f2e1ee832dfbb92 with Mono (master/798c5efa52a)

Some of these symbols are global variables that could (should?) be prefixed with  `mono_`.
Comment 4 Ludovic Henry 2018-03-15 15:52:22 UTC
Fixed in master with https://github.com/mono/mono/commit/34b4d35fb7882632d8da48ea8b47c3f9c98bf069