crosswalk-project/crosswalk — pull request #2642 by rakuco (2014-11-24 15:20:31+00:00)
Title: [Tizen] Start using binutils-gold for linking Crosswalk again.

Using the traditional BFD linker is causing problems with shared_library
builds on Tizen due to the way some parts of the code are built:

* The geolocation support on Tizen is implemented by making the content
layer call NewSystemLocationProvider(), which is then implemented in
another target in xwalk/.
With ld.bfd, this causes issues the linker not to find the
implementation of content::NewSystemLocationProvider() since
libcontent.so does not depend on the Crosswalk code that implements
that function.

* ozone-wayland adds some files to the views target, and requires
symbols from them. However, due to circular dependency issues,
libwayland.so does not depend on libviews.so.
With ld.bfd, this causes linking to fail because libwayland.so cannot
find an implementation for
views::DesktopFactoryWayland::DesktopFactoryWayland() and
views::DesktopFactoryWayland::~DesktopFactoryWayland().

Arguably, these can be considered actual issues with the code; on the
other hand, the gold linker seems to be smarter and finds those
implementations in separate libraries automatically without requiring us
to fiddle around with linker options (I am not even sure there is an
option to make this work with the BFD linker). Additionally, the binaries
generated by the gold linker have fewer DT_NEEDED entries so each binary
only depends on the shared libraries it actually uses.

In addition to depending on the binutils-gold package, the associated
gyp variables have all been set, so that we explicitly use the
system-wide binutils/linker instead of the ones in the Chromium
toolchain, use any additional useful gold flags. While here, we can also
stop setting the "linux_use_gold_binary" variable in the ARM case, as
that did not have any effect since M37.

One caveat is that this makes re-enabling NaCl support on Tizen a bit
more difficult. As explained in XWALK-1904, the way binutils is set up
on Tizen makes the ld_bfd.py not work as expected. In this respect, the
situation has not changed compared to when commit 55c37c0 ("Fix build :
Force ld.gold binary usage") was reverted. The difference here is that
NaCl support is currently disabled on all Tizen profiles and
architectures ever since we moved to Chromium M39, so we can now land
this change without having to worry about NaCl at all.

Related to: XWALK-1904
Related to: XWALK-2571
Related to: XWALK-2679