From owner-freebsd-toolchain@freebsd.org Fri Jan 4 15:19:17 2019 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8680142EF30 for ; Fri, 4 Jan 2019 15:19:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 5049C6D6FC for ; Fri, 4 Jan 2019 15:19:17 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 13AE9142EF2E; Fri, 4 Jan 2019 15:19:17 +0000 (UTC) Delivered-To: toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2D7E142EF2C for ; Fri, 4 Jan 2019 15:19:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D1576D6F9 for ; Fri, 4 Jan 2019 15:19:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 9025DEE8D for ; Fri, 4 Jan 2019 15:19:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x04FJFop047249 for ; Fri, 4 Jan 2019 15:19:15 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x04FJFFq047241 for toolchain@FreeBSD.org; Fri, 4 Jan 2019 15:19:15 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f 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) Date: Fri, 04 Jan 2019 15:19:14 +0000 X-Bugzilla-Reason: AssignedTo CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: needs-qa X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: mmel@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: toolchain@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2019 15:19:18 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D220103 --- Comment #21 from Michal Meloun --- 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.=