From owner-freebsd-dtrace@freebsd.org Wed Dec 14 22:53:42 2016 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FAD8C77428 for ; Wed, 14 Dec 2016 22:53:42 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.allbsd.org", Issuer "RapidSSL SHA256 CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 125E6D70 for ; Wed, 14 Dec 2016 22:53:38 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail-d.allbsd.org (p2027-ipbf1605funabasi.chiba.ocn.ne.jp [123.225.191.27]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id uBEMrDEh010660 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) (Client CN "/OU=GT07882699/OU=See+20www.rapidssl.com/resources/cps+20+28c+2915/OU=Domain+20Control+20Validated+20-+20RapidSSL+28R+29/CN=*.allbsd.org", Issuer "/C=US/O=GeoTrust+20Inc./CN=RapidSSL+20SHA256+20CA+20-+20G3") for ; Thu, 15 Dec 2016 07:53:33 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from alph.allbsd.org (alph.allbsd.org [192.168.0.10]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id uBEMpwcq033205 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 15 Dec 2016 07:51:58 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.15.2/8.15.2) with ESMTPA id uBEMpuUH033202 for ; Thu, 15 Dec 2016 07:51:57 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Thu, 15 Dec 2016 07:51:24 +0900 (JST) Message-Id: <20161215.075124.1459885758696268380.hrs@allbsd.org> To: freebsd-dtrace@FreeBSD.org Subject: malformed symbol From: Hiroki Sato X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Thu_Dec_15_07_51_24_2016_391)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.4.3 (mail.allbsd.org [133.31.130.32]); Thu, 15 Dec 2016 07:53:34 +0900 (JST) X-Spam-Status: No, score=-99.7 required=13.0 tests=CONTENT_TYPE_PRESENT, QENCPTR1,QENCPTR2,USER_IN_WHITELIST autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on gatekeeper.allbsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2016 22:53:42 -0000 ----Security_Multipart0(Thu_Dec_15_07_51_24_2016_391)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Thu_Dec_15_07_51_24_2016_877)--" Content-Transfer-Encoding: 7bit ----Next_Part(Thu_Dec_15_07_51_24_2016_877)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I noticed that a simple USDT definition caused an odd error. The source files in question are as follows (a complete tarball is attached to this email): sample.c: | #include | #include | #include | | #include "sample_probes.h" | | int | main(void) | { | ssize_t i; | char buf[80]; | | i = read(STDIN_FILENO, buf, sizeof(buf)); | SAMPLE_FIRST_READ(i, buf); | | return (0); | } sample_probes.d: | provider sample { | probe first__read(ssize_t, char *); | }; Makefile: | PROG= sample | MAN= | SRCS= sample.c sample_probes.d | |.include Note that the program itself is useless because this is a minimal working example to reproduce the symptom. It causes the following error: | dtrace -C -x nolibs -h -s sample_probes.d | rm -f .depend | echo sample.full: /usr/lib/libc.a >> .depend | cc -O2 -pipe -g -I/var/home/hrs/sample -MD -MF.depend.sample.o -MTsample.o -std=gnu99 -fstack-protector-strong -Qunused-arguments -c sample.c -o sample.o | dtrace -C -x nolibs -G -o sample_probes.o -s sample_probes.d sample.o | cc -O2 -pipe -g -I/var/home/hrs/sample -std=gnu99 -fstack-protector-strong -Qunused-arguments -o sample.full sample.o sample_probes.o | sample.o: In function `main': | /var/home/hrs/sample/sample.c:13: undefined reference to `ead' | cc: error: linker command failed with exit code 1 (use -v to see invocation) | *** Error code 1 A symbol "read" in sample.o seems to be rewritten in the "dtrace -G" line. Sample.o just after compilation of sample.c had the correct symbol name like the following: % nm sample.o U __dtrace_sample___first__read U __stack_chk_fail U __stack_chk_guard 0000000000000000 T main U read % dtrace -C -x nolibs -G -o sample_probes.o -s sample_probes.d sample.o % nm sample.o 0000000000000000 A __dtrace_sample___first-read U __stack_chk_fail U __stack_chk_guard U ead 0000000000000000 T main And it worked when I changed the probe name with "first__readx". This was reproducible on 11.x and 12.x, not on 10.x. Could anyone try this and let me know if this is reproducible on your 11.x or 12.x box? I guess this is a regression of symbol rewrite routine such as s/__/-/ in the dtrace utility while I have not investigated the details yet. Or am I missing something here? -- Hiroki ----Next_Part(Thu_Dec_15_07_51_24_2016_877)-- Content-Type: Application/Octet-Stream Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="sample-20161215-1.tar.gz" H4sIAPnHUVgAA+2VW2vCMBSA+9r8iuBe2iE1vdmBU5DphuAN69sYpdo4g1olaQfb2H9fqvUKW2Gs Dlm+l6anSZP05Dtl/mI1xyUpTxBCjmNDCVkOsvSD6x6om8iwTMt0bBMi3UDIlqCd66pSYhb5lC9l Stm3/bKep/vYXS8Etsl/x5/hCZnjXObg36Nctr7Ov64b+/xbFs9/0pAgymU1J/zz/PcHvYeqvDkF oFPvVmXgDu7cbUgbw03DW9HlCDMtAEAj4XgeBxjejlig8fiztpjVwF/vRPATUv+32c5ljiz/Teug /pvOxn9d+H8OrnYys1dWWvnUX2jTGjgIR8GcjI5jcUh4OIntg4XjOjEtAEDCCCx8EiovSxKo4B3I jJE37EWQVIA8nvoUjuLJ4w16qgAgE1iFFPuB4g4bra5332o3u71i0qMIk2HLicLbqsqHuvVOv93k XQbu0Bs06w2FrDuqyXsojmIaQgXxuw9RlTI48n9X5H93jiz/kWOc+G/zEcL/c8Az/kICTNPfPOSS rg8BnBDKIs9bG5lqW4RrZ68TsSrCLIFAILhoPgGJ7BmNABIAAA== ----Next_Part(Thu_Dec_15_07_51_24_2016_877)---- ----Security_Multipart0(Thu_Dec_15_07_51_24_2016_391)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlhRzOwACgkQTyzT2CeTzy2XtQCcDwMUh4c/6mH1PKeikadIGmE/ yE4AnRHx+4kh1/jFsxvigfS2wDRkAQd/ =i9jC -----END PGP SIGNATURE----- ----Security_Multipart0(Thu_Dec_15_07_51_24_2016_391)----