From owner-svn-src-all@FreeBSD.ORG Thu May 9 10:05:40 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 60BCA15B; Thu, 9 May 2013 10:05:40 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ea0-x22a.google.com (mail-ea0-x22a.google.com [IPv6:2a00:1450:4013:c01::22a]) by mx1.freebsd.org (Postfix) with ESMTP id 6FBD7D4E; Thu, 9 May 2013 10:05:39 +0000 (UTC) Received: by mail-ea0-f170.google.com with SMTP id q16so932865ead.15 for ; Thu, 09 May 2013 03:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=dBsiSY3T30su1j56XNAmbuZUGbvEov3+RMRTkstB8QA=; b=0Qid2Thhsbph8LtaOEn7TsPTaklTuwv7bLwua5wnnMI7YeHgU6VBFE28X4KFMWeCUf dEIftQZouwwdwuGmEuIcDiim/Y6dFDNJsUFTZ9HMrTIIl3mGRIfbG8jnyQ5wu7Wtum4I nqt5ItyNFGEsI/AS+vkei5XyHNXCr/QdCJUfCDXUU5gTrCykojMMjlPio3Cl27+yCmtq DdRcM9uZIx53CE52/6hZ5tQ5EFhSS2v3DSlSQSJZMTvJ1rLLe5qtllUxUeL/86Cd2eAj V7REzvcneSmGCSh+PGFQsZaGY20XKYcRsu9aCc8zmzGZrZMEXAcvjCUni7b+5KrNyiIK Nf4A== X-Received: by 10.14.111.5 with SMTP id v5mr27602964eeg.27.1368093938467; Thu, 09 May 2013 03:05:38 -0700 (PDT) Received: from localhost ([178.150.115.244]) by mx.google.com with ESMTPSA id w43sm3094861eeg.14.2013.05.09.03.05.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 09 May 2013 03:05:37 -0700 (PDT) Sender: Mikolaj Golub Date: Thu, 9 May 2013 13:05:35 +0300 From: Mikolaj Golub To: Konstantin Belousov Subject: Re: svn commit: r250379 - in head/usr.sbin/bsnmpd/modules: . snmp_hast Message-ID: <20130509100533.GC94250@gmail.com> References: <201305082003.r48K3cYv062256@svn.freebsd.org> <20130509071412.GA94250@gmail.com> <20130509082243.GP3047@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: <20130509082243.GP3047@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek , Peter Wemm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 May 2013 10:05:40 -0000 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 09, 2013 at 11:22:43AM +0300, Konstantin Belousov wrote: > On Thu, May 09, 2013 at 10:14:14AM +0300, Mikolaj Golub wrote: > > On Wed, May 08, 2013 at 04:44:54PM -0700, Peter Wemm wrote: > > > On Wed, May 8, 2013 at 4:25 PM, Peter Wemm wrote: > > > > On Wed, May 8, 2013 at 1:03 PM, Mikolaj Golub wrote: > > > >> Author: trociny > > > >> Date: Wed May 8 20:03:37 2013 > > > >> New Revision: 250379 > > > >> URL: http://svnweb.freebsd.org/changeset/base/250379 > > > >> > > > >> Log: > > > >> HAST module for bsnmpd(1). > > > >> > > > >> Reviewed by: harti, pjd > > > >> MFC after: 2 weeks > > > > > > > > This breaks world on just about everything other than i386, and it is > > > > technically broken there too but doesn't actually cause a build > > > > failure. > > > > > > > > You cannot link a .so file against a non-pic library, libl.a in this case. > > > > > > > > ===> usr.sbin/bsnmpd/modules/snmp_hast (all)^M > > > > /usr/obj/usr/src/tmp/usr/bin/ld: /usr/obj/usr/src/tmp/usr/lib/libl.a(libyywrap.o > > > > ): relocation R_X86_64_32 against `a local symbol' can not be used when making a > > > > shared object; recompile with -fPIC^M > > > > /usr/obj/usr/src/tmp/usr/lib/libl.a: could not read symbols: Bad value^M > > > > *** [snmp_hast.so.6] Error code 1^M > > > > > > > > > Hmm. It seems clang optimizes something away that gcc doesn't. When > > > building with clang the problem doesn't show up. > > > > Sorry for breaking build. I am always running tinderbox before commits > > like this, which did not help this time. Now I will run it twice, with > > both clang and gcc. > > > > Thank you for r250394. I will investigate how to fix this. Any > > suggestions are highly appreciated. > > Why do you need libl.a ? If only for yywrap(), then re-implementing > it for the module seems to be trivial. Yes, it is like so. Thanks! I am now considering two possible solutions: 1) As it is suggested above, add trivial yywrap() and link without -ll. 2) Add '%option noyywrap' to hastd/token.l, and link hastd, hastctl and snmp_hast without -ll (it looks like yywrap is needed only when parsing more than one file). See the patches below. It looks both solutions work for me and I personally prefer the second one. -- Mikolaj Golub --a8Wt8u1KmwUX3Y2C Content-Type: text/x-diff; charset=us-ascii Content-Disposition: inline; filename="snmp_hast.ll.1.patch" Index: usr.sbin/bsnmpd/modules/snmp_hast/yywrap.c =================================================================== --- usr.sbin/bsnmpd/modules/snmp_hast/yywrap.c (revision 0) +++ usr.sbin/bsnmpd/modules/snmp_hast/yywrap.c (working copy) @@ -0,0 +1,8 @@ +int yywrap(void); + +int +yywrap(void) +{ + + return (1); +} Index: usr.sbin/bsnmpd/modules/snmp_hast/Makefile =================================================================== --- usr.sbin/bsnmpd/modules/snmp_hast/Makefile (revision 250379) +++ usr.sbin/bsnmpd/modules/snmp_hast/Makefile (working copy) @@ -12,7 +12,7 @@ SRCS+= nv.c SRCS+= parse.y pjdlog.c SRCS+= proto.c proto_common.c proto_uds.c SRCS+= token.l -SRCS+= y.tab.h +SRCS+= y.tab.h yywrap.c MAN= snmp_hast.8 NO_WFORMAT= @@ -30,7 +30,7 @@ CFLAGS+=-DYY_NO_INPUT CFLAGS+= -DSNMPTREE_TYPES DPADD= ${LIBL} ${LIBUTIL} -LDADD= -ll -lutil +LDADD= -lutil XSYM= begemotHast DEFS= ${MOD}_tree.def --a8Wt8u1KmwUX3Y2C Content-Type: text/x-diff; charset=us-ascii Content-Disposition: inline; filename="hast.ll.1.patch" Index: sbin/hastd/Makefile =================================================================== --- sbin/hastd/Makefile (revision 250377) +++ sbin/hastd/Makefile (working copy) @@ -31,7 +31,7 @@ CFLAGS+=-DINET6 .endif DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL} -LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil +LDADD= -lgeom -lbsdxml -lsbuf -lpthread -lutil .if ${MK_OPENSSL} != "no" DPADD+= ${LIBCRYPTO} LDADD+= -lcrypto Index: sbin/hastd/token.l =================================================================== --- sbin/hastd/token.l (revision 250377) +++ sbin/hastd/token.l (working copy) @@ -46,6 +46,7 @@ int lineno; %option noinput %option nounput +%option noyywrap %% control { DP; return CONTROL; } Index: sbin/hastctl/Makefile =================================================================== --- sbin/hastctl/Makefile (revision 250377) +++ sbin/hastctl/Makefile (working copy) @@ -32,8 +32,8 @@ CFLAGS+=-DINET6 CFLAGS+=-DYY_NO_UNPUT CFLAGS+=-DYY_NO_INPUT -DPADD= ${LIBL} ${LIBUTIL} -LDADD= -ll -lutil +DPADD= ${LIBUTIL} +LDADD= -lutil .if ${MK_OPENSSL} != "no" DPADD+= ${LIBCRYPTO} LDADD+= -lcrypto Index: usr.sbin/bsnmpd/modules/snmp_hast/Makefile =================================================================== --- usr.sbin/bsnmpd/modules/snmp_hast/Makefile (revision 250379) +++ usr.sbin/bsnmpd/modules/snmp_hast/Makefile (working copy) @@ -29,8 +29,8 @@ CFLAGS+=-DYY_NO_UNPUT CFLAGS+=-DYY_NO_INPUT CFLAGS+= -DSNMPTREE_TYPES -DPADD= ${LIBL} ${LIBUTIL} -LDADD= -ll -lutil +DPADD= ${LIBUTIL} +LDADD= -lutil XSYM= begemotHast DEFS= ${MOD}_tree.def --a8Wt8u1KmwUX3Y2C--