Bug 20762 - using ld(1) from binutils 2.24 causes 'local symbol is reference by DSO' on freebsd (at least)
Summary: using ld(1) from binutils 2.24 causes 'local symbol is reference by DSO' on f...
Status: RESOLVED NORESPONSE
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 3.4.0
Hardware: All Other
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL: https://bugs.freebsd.org/bugzilla/sho...
Depends on:
Blocks:
 
Reported: 2014-06-20 13:34 UTC by John Hein
Modified: 2018-04-05 19:45 UTC (History)
3 users (show)

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


Attachments
disable local symbol wildcarding for linking executables (vs. libs) (1.29 KB, patch)
2014-06-20 13:37 UTC, John Hein
Details


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:
Status:
RESOLVED NORESPONSE

Description John Hein 2014-06-20 13:34:28 UTC
When linking the executables (not libs) in mono/mini, using binutils 2.24's ld(1), you get the following error on freebsd:

====================
 .
 .
  CCLD   mono-sgen
/usr/local/bin/ld: mono-boehm: local symbol `__progname' in /usr/lib/crt1.o is referenced by DSO
/usr/local/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[4]: *** [mono-boehm] Error 1
gmake[4]: *** Waiting for unfinished jobs....
/usr/local/bin/ld: mono-sgen: local symbol `__progname' in /usr/lib/crt1.o is referenced by DSO
/usr/local/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[4]: *** [mono-sgen] Error 1
 .
 .
====================


See comment 3 in the referenced bug URL for a more detailed explanation why this happens.
Comment 1 John Hein 2014-06-20 13:37:37 UTC
Created attachment 7132 [details]
disable local symbol wildcarding for linking executables (vs. libs)

I think that avoiding marking all symbols as local when linking executables (as opposed to libs) is reasonable.  This patch does that.  ldscripts.mono is only used when linking executables right now (see Makefile.am).
Comment 2 John Hein 2014-06-20 13:43:32 UTC
Alternately, you could just avoid using the linker script altogether for executables.  Right now it is only used to explicitly mark a few symbols as globals.  Correct me if I'm wrong, but I don't think this is an important distinction for executables.  Makes sense to limit which symbols are marked as globals for linking shared libraries, of course.

So maybe just removing ldscripts.mono (and the ref to it in Makefile.am) is the right way to go.

I may be overlooking some subtlety regarding symbol versioning and backward compatibility with older libmono* shared lib versions.
Comment 3 John Hein 2014-06-20 13:46:34 UTC
Here's the reference to the freebsd bug:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190851

(It's slightly easier to click on a URL in a comment than the bugzilla URL field).
Comment 4 Ludovic Henry 2018-02-28 21:37:11 UTC
Can you still reproduce with latest version of Mono? The `mono/mini/ldscript.mono` file has been removed since 2015 so your issue might have been fixed.
Comment 5 Ludovic Henry 2018-04-05 19:45:59 UTC
Please reopen if you can still reproduce. Thank you