Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gold or bfd linker?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Cuong Nguyen
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jan 2018
Posts: 148

PostPosted: Tue Oct 23, 2018 8:28 am    Post subject: gold or bfd linker? Reply with quote

Googling around about gold vs bfd linker, still cant get clear answer which linker to use globally? Almost all other distros I know like Arch, Ubuntu opted bfd linker as a safe choice. I use gold linker globally with
LDFLAGS="${LDFLAGS} -Wl,-fuse-ld=gold"
and
# binutils-config --linker ld.gold

There are few (less than 5) pkgs dont accept gold linker, like glibc. Then I switch linker at compiling time using +Wl,-fuse-ld* -Wl,-fuse-ld=bfd.

Some other old packages only linked with bfd linker, require "binutils-config --linker ld.bfd".

Kernel compiling doesnt like gold linker either, and require a small patch that put hardcoded -fuse-ld=bfd in Makefile. This patch dont work anymore with 4.19.0.

I need recommendations from the gurus: "Should I stay with BFD linker globally?"

Thank you
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7467

PostPosted: Tue Oct 23, 2018 10:14 am    Post subject: Reply with quote

I'm French and for us, prove something is good and we will accept it, until then it's bad.
New tech always came with great promise (well, logic else nobody would care about it), and they get implemented early (the "show the code" effect), then they mature and endup finally better (like promise) or drop (total failure, because many good thing on paper endup crap in reality, or crap by implementation).

I would say, it would be more logic to use bfd globally, and activate gold on packages you know it would do great (google packages should, as they must be their test bed)
I'm just using bfd globally, and this until gold manage to kill bfd or gold die (but french are so conservative).
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1066

PostPosted: Tue Oct 23, 2018 11:55 am    Post subject: Reply with quote

I use gold for a couple of years, no problems so far.
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1064

PostPosted: Tue Oct 23, 2018 12:00 pm    Post subject: Reply with quote

My experience is that gold works for say 95% of the stuff on my machine.
The only two ebuilds that I don't use gold for are gcc and libunwind.
(Not sure I count as a guru though. Just persistent.)

In case you've not spotted, you can set up /etc/portage/env/bfd
and add entries to /etc/portage/package.env for your ones that need it.
_________________
Greybeard
Back to top
View user's profile Send private message
Cuong Nguyen
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jan 2018
Posts: 148

PostPosted: Tue Oct 23, 2018 2:09 pm    Post subject: Reply with quote

Thank you for your recommendations.

I have been using GOLD linker since knowing Gentoo in last 2 years. Now I will set BFD as my default linker that helps kernel compiling going smoothly without google for patches.
Code:
binutils-config --linker ld.bfd


From my @world of 1,200++ packages, there are only 6 pkgs need forced BFD
Code:
sys-libs/db +Wl,-fuse-ld=gold LDFLAGS+=-Wl,-fuse-ld=bfd
sys-libs/glibc +Wl,-fuse-ld=gold LDFLAGS+=-Wl,-fuse-ld=bfd
media-libs/libdv +Wl,-fuse-ld=gold LDFLAGS+=-Wl,-fuse-ld=bfd
media-gfx/splashutils +Wl,-fuse-ld=gold LDFLAGS+=-Wl,-fuse-ld=bfd
sys-apps/attr +Wl,-fuse-ld=gold LDFLAGS+=-Wl,-fuse-ld=bfd
sys-libs/libunwind +Wl,-fuse-ld=gold LDFLAGS+=-Wl,-fuse-ld=bfd


I am using portage-bashrc-mv from Martin Vath https://github.com/vaeth/portage-env-mv
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7798
Location: Saint Amant, Acadiana

PostPosted: Tue Oct 23, 2018 2:31 pm    Post subject: Reply with quote

There are some ebuilds which force BFD in case you haven't noticed. I think glibc is one of them.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6921

PostPosted: Tue Oct 23, 2018 6:02 pm    Post subject: Reply with quote

gold will silently produce broken binaries in some cases (e.g. zsh). That to me is completely unacceptable.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6433

PostPosted: Wed Oct 24, 2018 10:44 am    Post subject: Reply with quote

Ant P. wrote:
gold will silently produce broken binaries in some cases (e.g. zsh)

-vv please. I use gold since years, and except for some underlinking issue in avidemux (which is actually a bug in avidemux) and a linking problem with ancient scilab, I had never any problems. In particular, I never observed a problem with zsh.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6921

PostPosted: Wed Oct 24, 2018 8:59 pm    Post subject: Reply with quote

There's an ancient bug for it. zsh isn't the only package that breaks in this way, but the ones that do tend to be obscure anyway.
Back to top
View user's profile Send private message
Juippisi
Developer
Developer


Joined: 30 Sep 2005
Posts: 541
Location: /home

PostPosted: Thu Oct 25, 2018 5:46 am    Post subject: Reply with quote

I used gold for a few years, as well. This year went back to BFD. Haven't really noticed any differences anywhere, except not having to patch kernel modules with enabling bfd. (Although I still patch it to enable BFQ).

I dont really see a reason to choose between these two, and personally am sticking with "what works".
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6433

PostPosted: Thu Oct 25, 2018 7:34 am    Post subject: Reply with quote

Ant P. wrote:
There's an ancient bug for it.

Is this really the bug you meant? This is not about producing broken binaries but perhaps about creating a dynamic library when it should create a static one. (One can only guess what is supposed to happen.)
Actually, my guess would be that this is a problem of the build system (e.g. some environment variable being set which causes production of dynamic libs) and not related to gold at all: After all, the build system not only creates the dynamic library but also installs it which is hard to imagine if the cause would really be a linker bug creating an unexpected library type. (Also the first report and log gives no indication that gold was used.)
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6921

PostPosted: Fri Oct 26, 2018 2:18 am    Post subject: Reply with quote

You're right, it's probably down to the build process doing weird tricks that work by accident in bfd.

But even so, gold is usually the common factor in "things that build fine but fail at runtime" problems I see, and for the slim advantages it claims it's not worth the debugging headache, so I gave up on it.
Back to top
View user's profile Send private message
jagdpanther
l33t
l33t


Joined: 22 Nov 2003
Posts: 606

PostPosted: Thu Apr 04, 2019 2:54 pm    Post subject: Reply with quote

I noticed that today's "emerge --sync" brought in a new binutils in a new slot that uses the gold use flag by default. Any idea what type of issues I should look for? (This will be my first use of gold.)

Code:
[ebuild  NS    ] sys-devel/binutils-2.31.1-r4 [2.30-r4] USE="gold%* plugins%* -default-gold%"
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7467

PostPosted: Thu Apr 04, 2019 5:11 pm    Post subject: Reply with quote

I read it differently than you myself: "gold" is there to build gold or not, but "-default-gold" is there to disable it as default.
no?
Back to top
View user's profile Send private message
jagdpanther
l33t
l33t


Joined: 22 Nov 2003
Posts: 606

PostPosted: Fri Apr 05, 2019 2:41 am    Post subject: Reply with quote

Thanks krinn. Yes, I read that wrong.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5225
Location: Dallas area

PostPosted: Fri Apr 05, 2019 10:09 am    Post subject: Reply with quote

jagdpanther wrote:
I noticed that today's "emerge --sync" brought in a new binutils in a new slot that uses the gold use flag by default. Any idea what type of issues I should look for? (This will be my first use of gold.)

Code:
[ebuild  NS    ] sys-devel/binutils-2.31.1-r4 [2.30-r4] USE="gold%* plugins%* -default-gold%"


In looking at what's installed on my system (binutils-2.30-r4) it seems it was already building the gold stuff, it just didn't have a use flag for it. :roll:
Way to sneak crap into your system.
_________________
PRIME x570-pro, 3700x, RX 550 - 5.8 zen kernel
Acer E5-575 (laptop), i3-7100u - i965 - 5.5 zen kernel
---both---
gcc 9.3.0, profile 17.1 (no-pie) amd64-no-multilib, eudev, openrc, openbox

The New OTW
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum