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: NEW
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: 2014-06-20 13:46 UTC (History)
2 users (show)

See Also:
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 | Diff

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).

Note You need to log in before you can comment on or make changes to this bug.