Date: Thu, 15 Dec 2016 07:51:24 +0900 (JST) From: Hiroki Sato <hrs@FreeBSD.org> To: freebsd-dtrace@FreeBSD.org Subject: malformed symbol Message-ID: <20161215.075124.1459885758696268380.hrs@allbsd.org>
next in thread | raw e-mail | index | archive | help
----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 <sys/param.h> | #include <stdlib.h> | #include <unistd.h> | | #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 <bsd.prog.mk> 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)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161215.075124.1459885758696268380.hrs>