NetBSD Problem Report #52674

From www@NetBSD.org  Mon Oct 30 02:47:15 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7B41B7A1AE
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 30 Oct 2017 02:47:15 +0000 (UTC)
Message-Id: <20171030024714.706FD7A1F1@mollari.NetBSD.org>
Date: Mon, 30 Oct 2017 02:47:14 +0000 (UTC)
From: n54@gmx.com
Reply-To: n54@gmx.com
To: gnats-bugs@NetBSD.org
Subject: liblto_plugin.so missing symbol xstrerror
X-Send-Pr-Version: www-1.0

>Number:         52674
>Category:       lib
>Synopsis:       liblto_plugin.so missing symbol xstrerror
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 30 02:50:00 +0000 2017
>Closed-Date:    Wed Jun 20 08:38:45 +0000 2018
>Last-Modified:  Wed Jun 20 08:38:45 +0000 2018
>Originator:     Kamil Rytarowski
>Release:        NetBSD 8.99.5 amd64
>Organization:
TNF
>Environment:
NetBSD chieftec 8.99.5 NetBSD 8.99.5 (GENERIC) #1: Fri Oct 27 18:16:18 CEST 2017  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
GCC passes liblto_plugin.so in the linker invocation (part of "gcc -v file.c"):

 ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper -plugin-opt=-fresolution=/var/tmp//ccxda9Ar.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -dc -dp -e _start -dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o /var/tmp//cc7A7mOK.o --as-needed -lgcc_s --no-as-needed -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o /usr/lib/crtn.o

When attempting to use GNU GOLD, liblto_plugin.so cannot be used because it has missing symbol xstrerror:

ld: error: /usr/libexec/liblto_plugin.so: could not load plugin library: /usr/libexec/liblto_plugin.so: Undefined PLT symbol "xstrerror" (symnum = 38)

From code and sources inspection, liblto_plugin.so shall be linked with libiberty (-liberty), a utility GNU library for internal usage with helping functions.


liberty.a is already linked with liblto_plugin.so for tools.:

$ nm /public/netbsd-root/tooldir.NetBSD-8.99.4-amd64/libexec/gcc/x86_64--netbsd/5.4.0/liblto_plugin.so|grep xstr
000000000000c8e7 T xstrdup
000000000000c921 T xstrerror
0000000000210960 b xstrerror_buf

>How-To-Repeat:
$ nm /usr/libexec/liblto_plugin.so|grep xstr
                 U xstrerror


>Fix:
Verified to work:

Index: Makefile
===================================================================
RCS file: /cvsroot/src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- Makefile    23 Jul 2017 01:12:06 -0000      1.3
+++ Makefile    30 Oct 2017 02:38:19 -0000
@@ -31,6 +31,10 @@
 SHLIB_MAJOR=   0
 SHLIB_MINOR=   0

+LIBIBERTYDIR!= cd ${.CURDIR}/../../lib/libiberty && ${PRINTOBJDIR}
+LDADD+=                -L${LIBIBERTYDIR} -liberty
+DPADD+=                ${LIBIBERTYDIR}/libiberty.a
+
 # Yuck, we have to run configure to generate this one...
 CLEANFILES+=   config.h
 HOST_CFLAGS+= -I${.OBJDIR}



If this is the proper solution, it should be backported to -8 and to gcc/ (HEAD uses gcc.old/ on NetBSD/amd64).

>Release-Note:

>Audit-Trail:
From: Kamil Rytarowski <n54@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/52674: liblto_plugin.so missing symbol xstrerror
Date: Fri, 3 Nov 2017 20:07:14 +0100

 This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
 --jDVRPjXMqSTfF5E273IpwFX5DRoAVL9sf
 Content-Type: multipart/mixed; boundary="T6OFwHm1O3GmKw9RUDQmHPdJIDq2CtAqJ";
  protected-headers="v1"
 From: Kamil Rytarowski <n54@gmx.com>
 To: gnats-bugs@NetBSD.org
 Message-ID: <35119666-933b-fe30-c63a-c4de5135d112@gmx.com>
 Subject: Re: lib/52674: liblto_plugin.so missing symbol xstrerror
 References: <pr-lib-52674@gnats.netbsd.org>
  <20171030024714.706FD7A1F1@mollari.NetBSD.org>
  <20171030025000.7B1587A1AE@mollari.NetBSD.org>
 In-Reply-To: <20171030025000.7B1587A1AE@mollari.NetBSD.org>

 --T6OFwHm1O3GmKw9RUDQmHPdJIDq2CtAqJ
 Content-Type: text/plain; charset=utf-8
 Content-Language: en-US
 Content-Transfer-Encoding: quoted-printable

 If there are no objections, I will commit this patch as is and bump
 MINOR for liblto_plugin.so.

 I want to see this fixed in -8 and I will submit a pullup.


 --T6OFwHm1O3GmKw9RUDQmHPdJIDq2CtAqJ--

 --jDVRPjXMqSTfF5E273IpwFX5DRoAVL9sf
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2

 iQIcBAEBCAAGBQJZ/L5nAAoJEEuzCOmwLnZs+i8QAJzGEE8e1GJKgI5iJLADAoeh
 jkA4YRz1P8tC2CgNvqt91dmkUhAbKqhUUS3WZKd34934W5xkndVhfLKr0ylRLvJd
 5Lv8GX1fUU4LAj45O3BcLIBYuFDNAYo6K5rA36JuuKUfJIXcN5sB0+oaScQ+MeAX
 mg+c73Vr5rgJSBUNen+FP8WIsX++TySRt9hg179M0WAneXM+gSqHTxbKGcuwD6wt
 y/EokHwA3d8r/x4SsKGgdiypmoUgXJneKvaudjU3opwN6kA9oyjXbg1NVLMIv+gU
 bkr5a4/p22LmKz2NfbGppU94rPjFFH08f+XBkEZ7iBlOLW1MZSji2FVU3ULOMHFP
 9M+ZKz0sVScXE3qqbHg17LPSB25h5Lac705dcB33CYh/JvFTMyo0Rwdl14p/zS55
 mucVVaqdoC9vHBxYDr/+ZQQBrQkWkntOxSILd3aSm1aOsH4A48nGVPv2j082MyHr
 m/FSplFLYSjQlcE8S82BjagSCWI8zgStXhUo443mwC/0isVDsN/YY5S/fw89b7A4
 mANxW4+hOq2g+AsCCGb55xBVjPVg+gcMuumidgonXQySfXzG8gIu74TDk7XuiXXv
 egK0S0uOQfOthy4SPhiDIt+psAbmtk+TUJnm0mmlZRqpVgF+vg07Eq5s4oC2oE3X
 2N5UZFqtnYTdg7VehIVD
 =NAB8
 -----END PGP SIGNATURE-----

 --jDVRPjXMqSTfF5E273IpwFX5DRoAVL9sf--

From: "Kamil Rytarowski" <kamil@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52674 CVS commit: src/external/gpl3/gcc.old/lib/liblto_plugin
Date: Sat, 4 Nov 2017 15:59:16 +0000

 Module Name:	src
 Committed By:	kamil
 Date:		Sat Nov  4 15:59:16 UTC 2017

 Modified Files:
 	src/external/gpl3/gcc.old/lib/liblto_plugin: Makefile

 Log Message:
 Link liblto_plugin with -liberty (gcc.old)

 GCC passes liblto_plugin.so in the linker invocation (part of "gcc -v file.c"):

 ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper \
 -plugin-opt=-fresolution=/var/tmp//ccxda9Ar.res \
 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc \
 -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s \
 -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -dc -dp -e _start \
 -dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crti.o \
 /usr/lib/crtbegin.o /var/tmp//cc7A7mOK.o --as-needed -lgcc_s --no-as-needed \
 -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o \
 /usr/lib/crtn.o

 When attempting to use GNU GOLD, liblto_plugin.so cannot be used because it \
 has missing symbol xstrerror:

 ld: error: /usr/libexec/liblto_plugin.so: could not load plugin library: \
 /usr/libexec/liblto_plugin.so: Undefined PLT symbol "xstrerror" (symnum = 38)

 From Makefiles and sources inspection, liblto_plugin.so shall be linked with \
 libiberty (-liberty), a utility GNU library for internal usage with helping \
 functions.

 PR 52674 by myself


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Kamil Rytarowski" <kamil@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52674 CVS commit: src/external/gpl3/gcc/lib/liblto_plugin
Date: Sat, 4 Nov 2017 16:03:12 +0000

 Module Name:	src
 Committed By:	kamil
 Date:		Sat Nov  4 16:03:12 UTC 2017

 Modified Files:
 	src/external/gpl3/gcc/lib/liblto_plugin: Makefile

 Log Message:
 Link liblto_plugin with -liberty (gcc)

 GCC passes liblto_plugin.so in the linker invocation (part of "gcc -v file.c"):

 ld -plugin /usr/libexec/liblto_plugin.so -plugin-opt=/usr/libexec/lto-wrapper \
 -plugin-opt=-fresolution=/var/tmp//ccxda9Ar.res \
 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc \
 -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s \
 -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -dc -dp -e _start \
 -dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crti.o \
 /usr/lib/crtbegin.o /var/tmp//cc7A7mOK.o --as-needed -lgcc_s --no-as-needed \
 -lgcc -lc --as-needed -lgcc_s --no-as-needed -lgcc /usr/lib/crtend.o \
 /usr/lib/crtn.o

 When attempting to use GNU GOLD, liblto_plugin.so cannot be used because it \
 has missing symbol xstrerror:

 ld: error: /usr/libexec/liblto_plugin.so: could not load plugin library: \
 /usr/libexec/liblto_plugin.so: Undefined PLT symbol "xstrerror" (symnum = 38)

 From Makefiles and sources inspection, liblto_plugin.so shall be linked with \
 libiberty (-liberty), a utility GNU library for internal usage with helping \
 functions.

 PR 52674 by myself


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc/lib/liblto_plugin/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Kamil Rytarowski" <kamil@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52674 CVS commit: src
Date: Sat, 4 Nov 2017 16:21:50 +0000

 Module Name:	src
 Committed By:	kamil
 Date:		Sat Nov  4 16:21:50 UTC 2017

 Modified Files:
 	src/distrib/sets/lists/comp: shl.mi
 	src/distrib/sets/lists/debug: shl.mi
 	src/external/gpl3/gcc.old/lib/liblto_plugin: Makefile
 	src/external/gpl3/gcc/lib/liblto_plugin: Makefile

 Log Message:
 Bump lib minor for liblto_plugin.so link with -liberty

 PR 52674 by myself


 To generate a diff of this commit:
 cvs rdiff -u -r1.308 -r1.309 src/distrib/sets/lists/comp/shl.mi
 cvs rdiff -u -r1.186 -r1.187 src/distrib/sets/lists/debug/shl.mi
 cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc.old/lib/liblto_plugin/Makefile
 cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gcc/lib/liblto_plugin/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Kamil Rytarowski" <kamil@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52674 CVS commit: src/external/gpl3/gcc/lib/liblto_plugin
Date: Sun, 5 Nov 2017 02:36:01 +0000

 Module Name:	src
 Committed By:	kamil
 Date:		Sun Nov  5 02:36:00 UTC 2017

 Modified Files:
 	src/external/gpl3/gcc/lib/liblto_plugin: Makefile

 Log Message:
 Backport patch from gcc.old for liblto_plugin

 Correct resolution of xstrerror(). Switch from -liberty (which has PIC
 problems as a local library) to directly linking xstrerror.c with
 liblto_plugin.

 Fix in gcc.old by <christos>

 PR 52674 by myself


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc/lib/liblto_plugin/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Sun, 05 Nov 2017 08:35:47 +0100
State-Changed-Why:
[pullup-8 #345] lib/52674: liblto_plugin.so missing symbol xstrerror


State-Changed-From-To: pending-pullups->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 19 Jun 2018 01:05:01 +0000
State-Changed-Why:
Looking at pullup-8 #345, it got superseded by pullup-8 #381 which was completed. Can you confirm this solves the problem too?


State-Changed-From-To: feedback->closed
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Wed, 20 Jun 2018 10:38:45 +0200
State-Changed-Why:
Fixed!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.