Gentoo Archives: gentoo-dev

From: Rich Freeman <rich0@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] Developers, please work on underlinking issues!
Date: Thu, 18 Aug 2016 12:12:35
In Reply to: Re: [gentoo-dev] Developers, please work on underlinking issues! by Daniel Campbell
1 On Thu, Aug 18, 2016 at 1:39 AM, Daniel Campbell <zlg@g.o> wrote:
2 >
3 > Is it as simple as switching the linker and re-merging packages that one
4 > maintains? Is gold supposed to be a big deal? Does it do the job of
5 > linking better? I read the blog post and all but nobody's explaining
6 > what gold does better than standard ld.
7 >
9 There are a bunch of reasons why people prefer it for the long term.
10 However, one of the biggest drives to get devs to use it is that it
11 serves as a good canary for underlinking.
13 If you underlink with the bfd linker the package will build and run
14 fine typically, at least initially. However, down the road as
15 libraries are updated you can run into problems. Since you didn't
16 specify all your dependencies portage won't do rebuilds when they're
17 necessary. My understanding is that if the needed libraries aren't
18 even linked then even preserve-rebuild will fail. The package is
19 basically relying on unspecified behavior to work. If you need a
20 symbol you're supposed to link to the providing library, not just
21 assume that it will happen to be around because some other library
22 you're linked to happens to pull it in.
24 The gold linker generates errors if you attempt to underlink, which
25 turns this into a build-time error, and not a
26 maybe-you-see-it-maybe-you-don't runtime issue for random users in six
27 months.
29 Correctly specifying dependencies and ensuring they're linked is of
30 benefit to all users, and it will prevent subtle problems for users of
31 the default bfd linker.
33 At least, that is my understanding of the issue. It is entirely
34 possible I missed something; I don't profess to be an ELF expert. :)
36 --
37 Rich