Bug 25821

Summary: Generic symbol names exported from libmono
Product: [Mono] Runtime Reporter: Rolf Bjarne Kvinge [MSFT] <rolf>
Component: GeneralAssignee: Bugzilla <bugzilla>
Severity: normal CC: ludovic, mono-bugs+mono, mono-bugs+runtime, vargaz
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: bugpool-archived Is this bug a regression?: ---
Last known good build:

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