From owner-freebsd-ppc@freebsd.org Wed Jan 23 06:54:01 2019 Return-Path: Delivered-To: freebsd-ppc@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 83FD914BD7DD for ; Wed, 23 Jan 2019 06:54:01 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic314-22.consmr.mail.ne1.yahoo.com (sonic314-22.consmr.mail.ne1.yahoo.com [66.163.189.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7A7C8D681 for ; Wed, 23 Jan 2019 06:54:00 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: ZMB6MzcVM1kMbribkCI3IhYNH1P6nAkfEVBH1eriHCcLYLChg.p1Q.Zf3syIS14 XUdtH2KMBkMg7tEe4t89GPAdxRwJj1dtNXRZBh00K4svSpwn1bVWOvA9N1zoaidvvWPWDLwMl220 qv.7sFxMnK_uocaVAFxG7MBIUPZyz8JzwLl7jQOxx7ocr7LbBP8poQ0GrfUotGDl5r4c1.X1hraq NEcExjxI6ZsMVa6G5WhcJn6gIgVWRvy2alVz4LTSYRPLACyVD.SgjwZDv0maQxUM8FZRMNjjHhUU X.8fMPnLPnlla__AqV4gHI_.jRZA.9dF3l1hp8hSS7tiYEuDOEW3rFGQ.ggu2aju7AmaiU9owV76 JwdHSi.7w.Ul5uNywcS0xXVmQTapAF_YXIZCG6Q81BrMTL_cXdalrfJ59PCanJJi228wTNImp8hW JXhXNQK4hdanaZS8iCpyHMCkXy20R.JO2omD6HkkOfuiqZ.dHxE2gjjubqhiHyt7RC_5yMMmnQCh ANAq6gfE3XD2A2jGN7o66S6AhFdF8dl4ih7724aPbkU1TDX_bsnfQs02JtP2wIBF1LcngyuW5d1q 5FgHp5_2oUxhMHxf8RUocKIgT5V.zo7oBdbdkQvU_7vpS3a2KXd0nXXxbeSxtGYbLGr1poC5vs6B qoWsmqfX8Z9HDu.RZieM1Jz_46_WDbyvruonmKE9.bHccHWgvG4XJJ29g3Lhuk7pou4asRjUTcRF 5SLNjvHz5_qMeVoSc7li9Ogwv4DPdXKGJppyQu4X83_0E8mSvw.5GcpBmo8jRWjhXV4Pr1b3YvCX cdR8CGdnSRK_J7MGOlyylbTVPSbY0TyQEgSWrIVW7BWPkGPwW0YIxWZ0xyHueKcx0_Br9J_nWE6C YoOkmKZcACCq9TwSWXLe1cOwp9btfMAJ4CvsD2fr0o60dTXqyEyIirwav5C2anwkLmdMQL4pfdkU fUMwN.CBOZJNPla6n6mt_q8wtUH9iC9hi.g2nbHmj0xmzI3QVEr2rPWcdHwkCEtNuXhx_iJpffY3 uJ3.wP8v1Sk476SkPlk7.BNSpbEsbpzHw8AfAQSznoi0grt_IhWouDYeKzt7.qMGTI28c Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ne1.yahoo.com with HTTP; Wed, 23 Jan 2019 06:53:59 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.102]) ([67.170.167.181]) by smtp411.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID e4b4293c3d9c8c8b92041dadf6e627bc; Wed, 23 Jan 2019 06:53:57 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: GDB TLS testing [actually running some tests finally but these tests fail] From: Mark Millard In-Reply-To: <493AC0BE-3EC6-42B7-B027-FFB6454761B5@yahoo.com> Date: Tue, 22 Jan 2019 22:53:55 -0800 Cc: "freebsd-ppc@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <19343397-859C-4629-A4A5-B0DCDE25957B@yahoo.com> <5AA68ED2-2615-438B-A6AE-406CBD8E49F7@yahoo.com> <20027C29-0093-4001-A135-23783F8B87F3@yahoo.com> <4048D2A4-7E14-481C-9B5D-00567BCF4463@yahoo.com> <2AAC9738-73BD-475A-888A-252EE853A5C6@yahoo.com> <493AC0BE-3EC6-42B7-B027-FFB6454761B5@yahoo.com> To: John Baldwin X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: B7A7C8D681 X-Spamd-Bar: + X-Spamd-Result: default: False [1.93 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.23)[-0.228,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.89)[0.892,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.48)[ip: (5.49), ipnet: 66.163.184.0/21(1.10), asn: 36646(0.88), country: US(-0.08)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.30)[0.297,0]; RCVD_IN_DNSWL_NONE(0.00)[148.189.163.66.list.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2019 06:54:01 -0000 On 2019-Jan-22, at 19:19, Mark Millard wrote: > On 2019-Jan-22, at 18:32, Mark Millard wrote: >=20 >=20 >=20 >> On 2019-Jan-22, at 17:06, Mark Millard wrote: >>=20 >>=20 >>=20 >> . . . >> So I'm trying: >>=20 >> # git clean -f >> # rm */config.cache */*/config.cache >> # env CPATH=3D/usr/local/include ./configure >> . . . >> # env CPATH=3D/usr/local/include gmake >> . . . >>=20 >> in order to try to add paths after the command line -I paths. >>=20 >> . . . This looks like it built. I've not used the build yet. >>=20 >=20 > Looking at a *.core did not go well for my context: >=20 > # cc -g -O2 tls_gdb_test.c=20 > tls_gdb_test.c:16:2: warning: indirection of non-volatile null pointer = will be deleted, not trap [-Wnull-dereference] > *(char *)NULL =3D 1; > ^~~~~~~~~~~~~ > tls_gdb_test.c:16:2: note: consider using __builtin_trap() or = qualifying pointer with 'volatile' > 1 warning generated. > FBSDG5L# ./a.out > main: PID 70304 > id =3D 70304 (0x810054020) >=20 > Trace/BPT trap (core dumped) >=20 > # ppc64_tls_git/gdb/gdb a.out a.out.70304.core=20 > GNU gdb (GDB) 8.2.50.20190115-git > Copyright (C) 2019 Free Software Foundation, Inc. > . . . > Reading symbols from a.out... > [New LWP 100166] > Core was generated by `./a.out'. > Program terminated with signal SIGTRAP, Trace/breakpoint trap. > #0 main (ac=3D, av=3D) at = tls_gdb_test.c:16 > 16 *(char *)NULL =3D 1; > (gdb) bt > #0 main (ac=3D, av=3D) at = tls_gdb_test.c:16 > (gdb) p id > Cannot find thread-local storage for LWP 100166, executable file = /root/c_tests/a.out: > Cannot fetch runtime linker structure offsets > (gdb) p &id > Cannot find thread-local storage for LWP 100166, executable file = /root/c_tests/a.out: > Cannot fetch runtime linker structure offsets > (gdb)=20 >=20 >=20 > Trying running under the gdb variant got stuck with gdb looping = indefinately: >=20 > 70322 root 1 103 0 30M 20M 0 CPU2 2 3:12 = 101.06% ppc64_tls_git/gdb/gdb a.out >=20 > That was for: >=20 > # ppc64_tls_git/gdb/gdb a.out > GNU gdb (GDB) 8.2.50.20190115-git > Copyright (C) 2019 Free Software Foundation, Inc. > . . . >=20 > But I was able to ^C to get back to a (gdb) prompt and: >=20 > (gdb) p id > Cannot find thread-local storage for LWP 100111 of process 70323, = executable file /root/c_tests/a.out: > Cannot fetch runtime linker structure offsets > (gdb) p &id > Cannot find thread-local storage for LWP 100111 of process 70323, = executable file /root/c_tests/a.out: > Cannot fetch runtime linker structure offsets > (gdb) info threads > Id Target Id Frame=20 > * 1 LWP 100111 of process 70323 main (ac=3D, = av=3D) at tls_gdb_test.c:16 >=20 > So it looks to me to not be working with system-clang based compiles = of the example > test from the original E-mail. >=20 > But, looking around and using stepi ( with display/i $pc ) the code is = trying a trap instruction > over and over: >=20 > (gdb) disass > Dump of assembler code for function main: > 0x0000000010000adc <+0>: mflr r0 > 0x0000000010000ae0 <+4>: std r31,-8(r1) > 0x0000000010000ae4 <+8>: std r0,16(r1) > 0x0000000010000ae8 <+12>: stdu r1,-128(r1) > 0x0000000010000aec <+16>: mr r31,r1 > 0x0000000010000af0 <+20>: std r30,112(r31) > 0x0000000010000af4 <+24>: bl 0x10000600 = <00000017.plt_call.getpid@@FBSD_1.0> > 0x0000000010000af8 <+28>: ld r2,40(r1) > 0x0000000010000afc <+32>: mr r4,r3 > 0x0000000010000b00 <+36>: addis r3,r2,-2 > 0x0000000010000b04 <+40>: addi r3,r3,31952 > 0x0000000010000b08 <+44>: bl 0x100005e0 = <00000017.plt_call.printf@@FBSD_1.0> > 0x0000000010000b0c <+48>: ld r2,40(r1) > 0x0000000010000b10 <+52>: bl 0x10000600 = <00000017.plt_call.getpid@@FBSD_1.0> > 0x0000000010000b14 <+56>: ld r2,40(r1) > 0x0000000010000b18 <+60>: mr r30,r3 > 0x0000000010000b1c <+64>: nop > 0x0000000010000b20 <+68>: nop > 0x0000000010000b24 <+72>: addi r3,r13,4096 > 0x0000000010000b28 <+76>: nop > 0x0000000010000b2c <+80>: addis r3,r3,0 > 0x0000000010000b30 <+84>: mr r4,r30 > 0x0000000010000b34 <+88>: stw r30,-32768(r3) > 0x0000000010000b38 <+92>: addi r5,r3,-32768 > 0x0000000010000b3c <+96>: addis r3,r2,-2 > 0x0000000010000b40 <+100>: addi r3,r3,31966 > 0x0000000010000b44 <+104>: bl 0x100005e0 = <00000017.plt_call.printf@@FBSD_1.0> > 0x0000000010000b48 <+108>: ld r2,40(r1) > 0x0000000010000b4c <+112>: nop > 0x0000000010000b50 <+116>: nop > 0x0000000010000b54 <+120>: ld r3,-32728(r2) > 0x0000000010000b58 <+124>: ld r4,-32720(r2) > 0x0000000010000b5c <+128>: lwz r3,0(r3) > 0x0000000010000b60 <+132>: cmplwi r3,0 > 0x0000000010000b64 <+136>: ld r3,0(r4) > 0x0000000010000b68 <+140>: bne 0x10000b8c > 0x0000000010000b6c <+144>: lwz r4,8(r3) > 0x0000000010000b70 <+148>: addi r5,r4,-1 > 0x0000000010000b74 <+152>: cmpwi r4,0 > 0x0000000010000b78 <+156>: stw r5,8(r3) > 0x0000000010000b7c <+160>: bgt 0x10000b98 > 0x0000000010000b80 <+164>: bl 0x10000620 = <00000017.plt_call.__srget@@FBSD_1.0> > 0x0000000010000b84 <+168>: ld r2,40(r1) > =3D> 0x0000000010000b88 <+172>: trap > 0x0000000010000b8c <+176>: bl 0x10000640 = <00000017.plt_call.getc@@FBSD_1.0> > 0x0000000010000b90 <+180>: ld r2,40(r1) > 0x0000000010000b94 <+184>: trap > 0x0000000010000b98 <+188>: ld r4,0(r3) > 0x0000000010000b9c <+192>: addi r4,r4,1 > 0x0000000010000ba0 <+196>: std r4,0(r3) > 0x0000000010000ba4 <+200>: trap > 0x0000000010000ba8 <+204>: .long 0x0 > 0x0000000010000bac <+208>: .long 0x0 > 0x0000000010000bb0 <+212>: .long 0x0 > End of assembler dump. >=20 >=20 > I do not know if my context being a head -r341836 variant might = contribute > (too old?). >=20 > I may try some fairly modern gcc* variant(s) instead to see if that = makes a difference. >=20 > For reference: the compile of the test was based on using -g -O2 . So far all tried-combinations of using gcc versions for build the test program and/or building the gdb used do not work for "p id" and "p &id" in doing the test. clang is not essential to the behavior observed. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)