From owner-freebsd-ppc@freebsd.org Mon Mar 18 20:31:28 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 4E1F8154CFE3 for ; Mon, 18 Mar 2019 20:31:28 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic302-3.consmr.mail.bf2.yahoo.com (sonic302-3.consmr.mail.bf2.yahoo.com [74.6.135.42]) (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 612E275261 for ; Mon, 18 Mar 2019 20:31:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: BFz4GnYVM1m6Q1ZLQEape9clE4oF5novl.3VxsZil_uLbpcDWHvmhd8Cr72nwVV gaItPihjnIwE5DLwGP8MK2j41V4A.TTpgQyJBlgg5wrmRyz0knkH1Anf4aLTfY0uae6N7HKr5__N PwtXc_pMd3F8Hn5X59JCTvNsJHoZMYBPIN.GACxRKX8GK7amIosuVDqCiOjkx8FN127RZ1kkKN8v 76oSk9_wTOuu8OjHKojqWh92HNs_z0OyCpHgLiog1PjCqm60Crxs4yGDWgHJQ_dUfalOlioPlCer Z2kfQbDM5ItX2lFE0FM8gHvfJKQ5jB3zhAt6XHnexcRp6_29ZVCDlGQeFSVM7fi.DZ02HcVnC2oc Wrw_qiVx6z4pbWTkI7yYSmlKD5fkRKpuwVBcFwS.7VvoTLBQIh39r76ZR_qk9dHco06JIKG4joT9 EHsykowpzJFlLh.xPIexHXtt53v8wYdIzuoQB5BnGJEFy44NhvsS7nf6C3fetJb0xPdpFw2ktc56 dm.27p5vpX5OIggmDrK0hWslUHBBltdbVxJCzBgFBmpxFfJDeP9oeY.8kI3Lsn.zCyZrUhswHkBl kqshHrtMnwaiJTJeYCKmslxCRTpU.ndzfcwBYNtJVh75SM5qPfUhYOpcZs_DNuJZNK7EVg7cSvWe AGawEjeyWS6GWkYSu9lrOdaYUEassK2aWj3Eqt2vsGmn1L.hH6QfF_eIujdfuvyW4AAUC70cGpv4 Wy1Qba4UCVs6huGf.6UXKgfOzg0TwZ8iaj3PTE7L3UUyTe5pjboJweRxdmtFxP3S0dKtuw3nrmBt gS0FTZb497K_WntH_93LFIY8PVkoWEqw8m8D4u2v.dVBPZXgBeat5l6BhoVXtTKk.0a5V0rGQWO2 .A9q3ycwQKunsQg16WDr.IwqK.wWzO52kEqv0jRSPozicN4k_dC91O_bcXlnZHbRTfWgZJb6SfAO _iFeXkjdXgJR62XOarW8MJCMg7LIkzlkQQm.R4OFo2mGItw6kp4BxFP92VuiCwg.V9z5ORLPplHk eq.7NrLD3K4DRAl5hWQetAegpt.NZnUGTYhpxWla_96mcsEvQv6tWlix5O8iivJkRYFGumDqjCOc KpY9bpiWtTs8- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.bf2.yahoo.com with HTTP; Mon, 18 Mar 2019 20:31:20 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.115]) ([67.170.167.181]) by smtp420.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID d2d3b937956b2e03c6a976538c6597f8; Mon, 18 Mar 2019 20:31:20 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: llvm submittal 41050 created for powerpc64 C++ exception code generation: ld r2,40(r1) missing or skipped before bl __cxa_begin_catch code From: Mark Millard In-Reply-To: <795BBC02-6CE9-401E-8D9F-84FB9FB31364@yahoo.com> Date: Mon, 18 Mar 2019 13:31:18 -0700 Content-Transfer-Encoding: 7bit Message-Id: <16343810-DB93-4B7B-92C7-9985B94E3F22@yahoo.com> References: <0AD5D131-C5E3-424E-A276-D960ABDBDFCD@yahoo.com> <2429D922-3214-4D40-9616-56BC0CB93A15@yahoo.com> <795BBC02-6CE9-401E-8D9F-84FB9FB31364@yahoo.com> To: FreeBSD Toolchain , FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: 612E275261 X-Spamd-Bar: +++ X-Spamd-Result: default: False [3.41 / 15.00]; RCVD_VIA_SMTP_AUTH(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]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DKIM_TRACE(0.00)[yahoo.com:+]; 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:26101, ipnet:74.6.128.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)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.95)[0.949,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(1.51)[ip: (5.08), ipnet: 74.6.128.0/21(1.41), asn: 26101(1.13), country: US(-0.07)]; NEURAL_SPAM_MEDIUM(0.98)[0.975,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.49)[0.485,0]; RCVD_IN_DNSWL_NONE(0.00)[42.135.6.74.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: Mon, 18 Mar 2019 20:31:28 -0000 [Looks like insufficient DW_CFA_* information is output and so insufficient code is executed.] On 2019-Mar-14, at 18:23, Mark Millard wrote: > . . . (dropping history) . . . (As usual, the history shows that I've been figuring things out as I go.) As I've looked into the code, operation, dwarfdump -v -v -v -F output and the like, it seems to come down to: A) Clang is not writing out any DW_CFA_* information for r2 anywhere. It needs to in at least some places and that information needs to be interpreted by the libunwind code. B) Clang may not be writing out various other DW_CFA_* things (and matching instructions in many cases) for some or all of: _Unwind_Resume _Unwind_Resume_or_Rethrow _Unwind_RaiseException _Unwind_FrocedUnwind [I'm sure of (A) but am less sure of what (B)'s details should be.] I did find the DQ_CFA_* related interpreter and its use. Also, using the likes of, # export LIBUNWIND_PRINT_UNWINDING="" # export LIBUNWIND_PRINT_APIS="" # export LIBUNWIND_PRINT_DWARF="" # ./a.out gives a good idea what is being done and in what sequence for the unwind activity. It may be that some of (B) might be because of libunwind not using sufficient built-ins that control part of how the code is generated for the likes of those 4 special routines (including, possibly, some of the DW_CFA_* information). For (A) in some or all the of (B) routines, it may be that some r2 related DF_CFA_* material needs to be written out even absent local code in order to tied things together. An example might be for picking up r2's value as it was before the plt_call code targeting _Unwind_Resume was executed in the a.out code. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-freebsd-ppc@freebsd.org Wed Mar 20 03:16:46 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 05D4C15460A9 for ; Wed, 20 Mar 2019 03:16:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic311-25.consmr.mail.ne1.yahoo.com (sonic311-25.consmr.mail.ne1.yahoo.com [66.163.188.206]) (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 3FD41831FA for ;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eqj3XnB5F16QbxbfjKHCLs.ZYHEH.FWBoN pJvXY.44I92BAer.F.zcyooIcBBjH4zIP4swUgmA9nx97cShv7l.XbhEbVH.mP6FhIyeC6uA11ZD xOtjMIcddOw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Wed, 20 Mar 2019 03:16:42 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.115]) ([67.170.167.181]) by smtp427.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 809d719168aad2d99099b84d94cecba4; Wed, 20 Mar 2019 03:16:38 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: powerpc64: clang/libunwind vs devel/powerpc64-gcc based code for C++ exception handling: incompatible [ignoring r2 handling issue] Message-Id: <1B1A8473-1A53-407B-B96D-D25D91EE9A6B@yahoo.com> Date: Tue, 19 Mar 2019 20:16:36 -0700 To: FreeBSD PowerPC ML , FreeBSD Toolchain X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: 3FD41831FA X-Spamd-Bar: / X-Spamd-Result: default: False [-0.68 / 15.00]; RCVD_VIA_SMTP_AUTH(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]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; 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.48)[-0.479,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.86)[0.862,0]; NEURAL_HAM_LONG(-0.97)[-0.972,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.42)[ipnet: 66.163.184.0/21(1.20), asn: 36646(0.96), country: US(-0.07)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[206.188.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, 20 Mar 2019 03:16:46 -0000 [This note ignores libunwind's r2 (TOC) mishandling issue that has been noted elsewhere.] It appears to me that clang powerpc64 targeted code and devel/powerpc64-gcc generated code are incompatible for C++ exception handling. I show code examples later. clang does in-line setup of register save/restore in a.out but powerpc64-gcc leaves it to the unwind library. libunwind does not do that, expecting the compiler to have dealt with managing the save/restore activity. Thus when code produced by powerpc64-gcc is in use, the save/restore activity would not happen. [This also leads to matching differences in what dwarfdump -v -v -v -F shows in various relevant places, but I'll not show that in this message.] (Is there a detailed powerpc64 ABI definition that, if followed by both compilers, would make use of the two compilers compatible for C++ exceptions?) A question is: is it required to allow the likes of devel/powerpc64-xtoolchain-gcc based buildworld's that target powerpc64 if/when libunwind becomes official? [It appears to me that clang used under a historical libgcc_s.so that built with powerpc-gcc has redundant save/restore activity that, while non-optimal, would work. So: not as strong of a mis-match and I'll ignore that combination below.] Evidence for the problem being reported . . . For code like (causing lots of save/restore context for C++ exceptions to be involved): # more exception_test_regs.cpp=20 #include #include int main(void) { volatile int a[]=3D {0,1,2,3}; int incr=3D rand()%4; #define unit(v,init) \ int v=3D init; \ try { \ if (a[v] < 4) throw std::exception(); \ v=3D (v+incr) % 4; \ } \ catch (std::exception& e) {} unit(b,incr); unit(c,b); unit(d,c); unit(e,d); unit(f,e); unit(g,f); unit(h,g); unit(i,h); unit(j,i); unit(k,j); unit(l,k); unit(m,l); unit(n,m); unit(o,n); unit(p,o); unit(q,p); unit(r,q); unit(s,r); unit(t,s); unit(u,t); unit(v,u); unit(w,v); unit(x,w); unit(y,x); unit(z,y); a[(b+c+d+e+f+g+h+i+j+k+m+n+o+p+q+r+s+t+u+v+w+x+y+z)%4]=3D i; return 0; } clang produces code that is, in part, like: 000000001000110c <.main+0x370> add r3,r24,r29 0000000010001110 <.main+0x374> srawi r4,r3,2 0000000010001114 <.main+0x378> addze r4,r4 0000000010001118 <.main+0x37c> rlwinm r4,r4,2,0,29 000000001000111c <.main+0x380> subf r26,r4,r3 0000000010001120 <.main+0x384> extsw r25,r26 0000000010001124 <.main+0x388> rldicr r3,r25,2,61 0000000010001128 <.main+0x38c> lwzx r3,r30,r3 000000001000112c <.main+0x390> cmpwi r3,3 0000000010001130 <.main+0x394> ble- 00000000100018fc <.main+0xb60> 0000000010001134 <.main+0x398> add r3,r26,r29 . . . 00000000100018fc <.main+0xb60> li r3,8 0000000010001900 <.main+0xb64> stw r0,156(r31) 0000000010001904 <.main+0xb68> mr r14,r8 0000000010001908 <.main+0xb6c> mr r15,r7 000000001000190c <.main+0xb70> mr r16,r6 0000000010001910 <.main+0xb74> stw r12,152(r31) 0000000010001914 <.main+0xb78> mr r28,r5 0000000010001918 <.main+0xb7c> stw r11,148(r31) 000000001000191c <.main+0xb80> stw r10,144(r31) 0000000010001920 <.main+0xb84> stw r9,140(r31) 0000000010001924 <.main+0xb88> bl 0000000010000860 = <00000018.plt_call.__cxa_allocate_exception@@CXXABI_1.3> 0000000010001928 <.main+0xb8c> ld r2,40(r1) 000000001000192c <.main+0xb90> nop 0000000010001930 <.main+0xb94> ld r4,-32728(r2) 0000000010001934 <.main+0xb98> addi r4,r4,16 0000000010001938 <.main+0xb9c> std r4,0(r3) 000000001000193c <.main+0xba0> nop 0000000010001940 <.main+0xba4> nop 0000000010001944 <.main+0xba8> ld r4,-32720(r2) 0000000010001948 <.main+0xbac> ld r5,-32712(r2) 000000001000194c <.main+0xbb0> bl 00000000100008e0 = <00000018.plt_call.__cxa_throw@@CXXABI_1.3> 0000000010001950 <.main+0xbb4> ld r2,40(r1) 0000000010001954 <.main+0xbb8> b 0000000010001b20 <.main+0xd84> . . . 0000000010001b20 <.main+0xd84> cmplwi r4,1 0000000010001b24 <.main+0xd88> bne- 0000000010002104 <.main+0x1368> 0000000010001b28 <.main+0xd8c> bl 0000000010000880 = <00000018.plt_call.__cxa_begin_catch@@CXXABI_1.3> 0000000010001b2c <.main+0xd90> ld r2,40(r1) 0000000010001b30 <.main+0xd94> bl 00000000100008a0 = <00000018.plt_call.__cxa_end_catch@@CXXABI_1.3> 0000000010001b34 <.main+0xd98> ld r2,40(r1) 0000000010001b38 <.main+0xd9c> lwz r7,132(r31) 0000000010001b3c <.main+0xda0> mr r3,r14 0000000010001b40 <.main+0xda4> mr r5,r29 0000000010001b44 <.main+0xda8> mr r6,r25 0000000010001b48 <.main+0xdac> lwz r8,136(r31) 0000000010001b4c <.main+0xdb0> lwz r9,140(r31) 0000000010001b50 <.main+0xdb4> lwz r10,144(r31) 0000000010001b54 <.main+0xdb8> lwz r11,148(r31) 0000000010001b58 <.main+0xdbc> lwz r12,152(r31) 0000000010001b5c <.main+0xdc0> lwz r0,156(r31) 0000000010001b60 <.main+0xdc4> b 0000000010001210 <.main+0x474> Note the explicit stw's before the bl for 00000018.plt_call.__cxa_allocate_exception@@CXXABI_1.3 and the matching lwz's after the bl for 00000018.plt_call.__cxa_end_catch@@CXXABI_1.3, and also the save/restore use of some registers from R14-R31 that are part of the call standard. (I just picked one of the examples so show code for. The detailed save/restore code varies from one to the next.) powerpc64-gcc does not generate such code before 00000018.plt_call.__cxa_allocate_exception@@CXXABI_1.3 or after 00000018.plt_call.__cxa_end_catch@@CXXABI_1.3 . The code looks like (again just picking an example): 0000000010000ad4 <.main+0x1b4> add r9,r21,r30 0000000010000ad8 <.main+0x1b8> srawi r26,r9,2 0000000010000adc <.main+0x1bc> addze r26,r26 0000000010000ae0 <.main+0x1c0> rlwinm r26,r26,2,0,29 0000000010000ae4 <.main+0x1c4> subf r26,r26,r9 0000000010000ae8 <.main+0x1c8> extsw r26,r26 0000000010000aec <.main+0x1cc> rldicr r9,r26,2,61 0000000010000af0 <.main+0x1d0> lwzx r9,r29,r9 0000000010000af4 <.main+0x1d4> cmpwi cr7,r9,3 0000000010000af8 <.main+0x1d8> ble cr7,0000000010001428 = <.main+0xb08> . . . 0000000010001428 <.main+0xb08> li r3,8 000000001000142c <.main+0xb0c> bl 0000000010000860 = <0000004b.plt_call.__cxa_allocate_exception@@CXXABI_1.3> 0000000010001430 <.main+0xb10> ld r2,40(r1) 0000000010001434 <.main+0xb14> nop 0000000010001438 <.main+0xb18> ld r9,-32728(r2) 000000001000143c <.main+0xb1c> nop 0000000010001440 <.main+0xb20> ld r5,-32720(r2) 0000000010001444 <.main+0xb24> nop 0000000010001448 <.main+0xb28> std r9,0(r3) 000000001000144c <.main+0xb2c> ld r4,-32712(r2) 0000000010001450 <.main+0xb30> bl 0000000010000900 = <0000004b.plt_call.__cxa_throw@@CXXABI_1.3> 0000000010001454 <.main+0xb34> ld r2,40(r1) 0000000010001458 <.main+0xb38> cmpdi cr7,r4,1 000000001000145c <.main+0xb3c> bne cr7,0000000010000f5c = <.main+0x63c> 0000000010001460 <.main+0xb40> bl 00000000100008c0 = <0000004b.plt_call.__cxa_begin_catch@@CXXABI_1.3> 0000000010001464 <.main+0xb44> ld r2,40(r1) 0000000010001468 <.main+0xb48> mr r20,r26 000000001000146c <.main+0xb4c> bl 00000000100008e0 = <0000004b.plt_call.__cxa_end_catch@@CXXABI_1.3> 0000000010001470 <.main+0xb50> ld r2,40(r1) 0000000010001474 <.main+0xb54> b 0000000010000b14 <.main+0x1f4> (None of the allocate_exception..end_catch related code has code anything like doing what clang did for save/restore.) The result is that, used against libunwind built with either clang or powerpc-gcc, the relevant registers for a powerpc64-gcc based a.out are not saved/restored that need to be for correct operation. [libunwind does not use __builtin_eh_return to have (part of) what a historical libgcc_s.so had for for its save/restore.] [Note: In my context the "historical" libgcc_s.so has the interpretation of DW_CFA_remember_state and DW_CFA_restore_state shown in dwarfdmp -v -v -v -F output fixed for how to interpret it (instead of being incomplete).] =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-freebsd-ppc@freebsd.org Fri Mar 22 18:53:26 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 0B2AA154E93A for ; Fri, 22 Mar 2019 18:53:26 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic306-21.consmr.mail.ne1.yahoo.com (sonic306-21.consmr.mail.ne1.yahoo.com [66.163.189.83]) (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 34D288F180 for ; Fri, 22 Mar 2019 18:53:24 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: DHz15MgVM1lCdTBeLJlx.rGeDdOQX_HI_Mb_gbyAx_qqCj9QB_ICrYpm0ieP.7_ 5.YyC4ITZuc0yhPZq5J.oFACF.7dUwuKt7i_mnHJYpf8t5G9xW0sa6Jq3Y.dVOEdVW_KOKDfyv9t 5utfsqcps8ExUMeFLthlyzqmafsN1WoKqLUBa3CBs7HMLADmJyC6NLvBy9OR.j2jgBHHVsufcrex DEnIr_MRgzjp6chQ0jQFlLJ_EpI4mwuZ4rjMjd1ZtARsNHHUDt9b4Z9wk9.I84ddYJ.zaH0Cm.I3 BgM2SEWgIuTsxdjX._wWPyIaO7vcFj_RgNOJYs6stvXHLzSV19G.1rkS1Hla2EdoudLnRdpeDUA7 _19QTGzqsheW8i3nWA3SvoBzj1E3rqwED4buywBEFre0814y79x891EaqnX9BMy0mQ.qe6loLL3K 6kyHV9QmDS_QWNTPgpOT8phAM3qyQ4PniNf1DyDfndazlPvd0J6XeGgZ06dXAx0Izd8JaAoNUgOz bLousubjtSHalAEQCBJznJTKSozkSBNwqdtebc28zWIrIlQlwHs2taDFbu0OuEYNo0Q2JKqJAE5l 1jADcKnrWT36D0zCAPOWIiu3fteC3CQEEzfAzdSkPqOPtaKmKlfnaXfVV56OFZCRwKNu1GueLXMI uBRE4LXE75lxI3raTHdGRJg9lMklD3DK9cEVoRu6Z_0CT8tCqGiS5pA4KsG8S9G99bzsA8UbmBY1 kq.0XmsBnlrDBvmhcmvvxm4pICEJHBOZseLvdDz75V0ySN2QGCYgfZtJEOaXsep7STfd1d80jVjF Ixspvh4sW06NPVQ8z0.GsDvKjztVESWfg7WTViv_RNmOQ5Z9G0KxyaSqRHfthugEgUsw78UbiK2m 6S3Ynu9z9R6JVU7.FAnhidB1iDdfh5uY7q.hNLRk_zc.xM7hBnT9VGlqTU1Yy_6VHkhtH_JZivgn U0FzziSSBDwKKU3da0eXhM2HIRqj1qHwI0FiIUfUnfdWQCIu8TlxjfROsRKYQQMTCJqAvVCKZKgk 4yzNVV7c7Upzm21u_rbdmNLCh1nq6_tGfiwAOJmDgMAtRYgFq6JQxD5AE4wfOV8wYX8hmOVv8ABn Z_HbIVcIn Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Fri, 22 Mar 2019 18:53:22 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.115]) ([67.170.167.181]) by smtp414.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 8d773000af2d8f42b67091210a0ac26b; Fri, 22 Mar 2019 18:53:18 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: llvm submittal 41050 created for powerpc64 C++ exception code generation: ld r2,40(r1) missing or skipped before bl __cxa_begin_catch code From: Mark Millard In-Reply-To: <16343810-DB93-4B7B-92C7-9985B94E3F22@yahoo.com> Date: Fri, 22 Mar 2019 11:53:16 -0700 Content-Transfer-Encoding: 7bit Message-Id: References: <0AD5D131-C5E3-424E-A276-D960ABDBDFCD@yahoo.com> <2429D922-3214-4D40-9616-56BC0CB93A15@yahoo.com> <795BBC02-6CE9-401E-8D9F-84FB9FB31364@yahoo.com> <16343810-DB93-4B7B-92C7-9985B94E3F22@yahoo.com> To: FreeBSD Toolchain , FreeBSD PowerPC ML X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: 34D288F180 X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.30 / 15.00]; RCVD_VIA_SMTP_AUTH(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]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(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)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.94)[0.940,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_SPAM_MEDIUM(0.76)[0.759,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.03)[0.034,0]; RCVD_IN_DNSWL_NONE(0.00)[83.189.163.66.list.dnswl.org : 127.0.5.0]; IP_SCORE(1.07)[ip: (3.27), ipnet: 66.163.184.0/21(1.20), asn: 36646(0.96), country: US(-0.07)] 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: Fri, 22 Mar 2019 18:53:26 -0000 https://reviews.llvm.org/D59694 is a review for a fix for WITH_LLVM_LIBUNWIND= when WITHOUT_LIB32= is in use. Why not lib32 as well? Well . . . As stands: A) 32-bit powerpc llvm-libunwind fails to build. and: B) If it did build, it would have the r2 (TOC) problem even after this patch. Attempting to fix (B) without fixing (A) would leave an untestable fix. So it is unlikely that covering (B) should be part of the 41050 defect's effort, even though powerpc64 FreeBSD will still be incomplete for libunwind support overall. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-freebsd-ppc@freebsd.org Sat Mar 23 19:13:58 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 A39CF155A3AE for ; Sat, 23 Mar 2019 19:13:58 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic302-3.consmr.mail.bf2.yahoo.com (sonic302-3.consmr.mail.bf2.yahoo.com [74.6.135.42]) (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 BCA0777C79 for ; Sat, 23 Mar 2019 19:13:57 +0000 (UTC) (envelope-from marklmi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vP49mWcOQsBx YoCN61JQVqZeOgGzY4W181CxvCfd1vGBooLa8py11erz_NBEKvBhnRmnBu5woSHnD4GwzFbzfeZN D Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.bf2.yahoo.com with HTTP; Sat, 23 Mar 2019 19:13:51 +0000 Received: from c-67-170-167-181.hsd1.or.comcast.net (EHLO [192.168.1.115]) ([67.170.167.181]) by smtp427.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID c409974cd65143dfc6b4a1a157b1178a; Sat, 23 Mar 2019 19:13:49 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: power9: "Successfully booted an LLVM compiled kernel": Can kernel modules (.ko) be dynamically loaded? Message-Id: <53D45B7C-E7F0-4DC9-B09D-D3EFD56122E9@yahoo.com> Date: Sat, 23 Mar 2019 12:13:47 -0700 To: FreeBSD PowerPC ML , Justin Hibbits X-Mailer: Apple Mail (2.3445.102.3) X-Rspamd-Queue-Id: BCA0777C79 X-Spamd-Bar: ++++ X-Spamd-Result: default: False [4.14 / 15.00]; RCVD_VIA_SMTP_AUTH(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]; TO_DN_ALL(0.00)[]; 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)[]; IP_SCORE(1.50)[ip: (5.06), ipnet: 74.6.128.0/21(1.40), asn: 26101(1.12), country: US(-0.07)]; SUBJECT_ENDS_QUESTION(1.00)[]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:26101, ipnet:74.6.128.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)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.57)[0.571,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; NEURAL_SPAM_MEDIUM(0.68)[0.678,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.90)[0.898,0]; RCVD_IN_DNSWL_NONE(0.00)[42.135.6.74.list.dnswl.org : 127.0.5.0]; RCVD_TLS_LAST(0.00)[] 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: Sat, 23 Mar 2019 19:13:58 -0000 As of when clang 5 (and later) became system clang, I've found that .ko files started using R_PPC64_JMP_SLOT r_types in .rela.plt sections. (My context, then and now is still ELFv1 ABI and based on svn's head materials.) Last I checked, FreeBSD did not support R_PPC64_JMP_SLOT and crashed during a dynamic-load of any(?) .ko that had such. So I've been building the modules that I want to use into the kernel itself for when I experiment with clang-based powerpc64 system builds. (I've no clue if the R_PPC64_JMP_SLOT use is considered "KBI" compliant or not vs. if FreeBSD is/was just incomplete in its coverage of the "KBI" for pwoerpc64: so which side should change.) I recognize that power9 likely is based on the ELFv2 ABI. === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)