Date: Fri, 04 Jan 2019 15:19:14 +0000 From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 220103] devel/glib20: ld-elf.so.1: /usr/local/lib/libglib-2.0.so.0: Undefined symbol "environ" (WITH_LLD_IS_LD) Message-ID: <bug-220103-29464-WoGvI7ZDMb@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-220103-29464@https.bugs.freebsd.org/bugzilla/> References: <bug-220103-29464@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D220103 --- Comment #21 from Michal Meloun <mmel@FreeBSD.org> --- Finally, I think I know what's going on. But I warn, it's a really crazy st= ory. And not, this problen is not related to https://bugs.llvm.org/show_bug.cgi?id=3D40176. FACT: Linker version script of all affected ports is and has always been invalid = (or, at least, incompatible with FreeBSD). On FreeBSD, symbols originated from /lib/crt*.o must stay global. Nothing else. FIX: At least 'environ' and '__progname' should be put into the global section of the linker script. We do it right for other ports (multimedia/mpv, net/asterisk16), there is no reason not to do it for others. Why nobody noticed this until now?=20 The old in base ld.bfd is very buggy in this area. It doesn't reflect local binding requested by linker script and, moreover, it emits given symbols duplicated. Once without version, second time with requested version. FreeBSD 11, in base ld.bfd is used for linking: # readelf -s mplayer | grep environ 935: 000000000056b8e0 8 OBJECT GLOBAL DEFAULT 27 environ@@MPLAYER_1 (2) 5384: 000000000056b8e0 8 OBJECT GLOBAL DEFAULT 27 environ It's very clear that this is invalid result, but it's also clear that this = also negates requested effect of given linker script, so resulting binary is workable. Should be this problem detected on link time? Yes, it should. This is a real (and, in this case, only one) bug in ld.ldd. It should quit with error message instead of producing not load time linkable binary.=20 As quick verification, you can replace default system linker by ld.bfd from binutils.=20 In this case, final linking always fails (on FBSD11, 12, current) with:=20 /usr/bin/ld: mplayer: local symbol '__progname' in /usr/lib/crt1.o is referenced by DSO Dim, please, can you submit this but to llvm bugzila? Michal --=20 You are receiving this mail because: You are the assignee for the bug. You are on the CC list for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-220103-29464-WoGvI7ZDMb>