On 1/29/19 3:30 PM, Ian Lance Taylor wrote: > On Tue, Jan 29, 2019 at 2:11 AM Manner Róbert <rmanni@xxxxxxxxx> wrote: >> I am having some issues with gccgo on ia64 (Itanium architecture). >> >> I have compiled gcc (8.2.0) with only configure options: >> --enable-languages=c,c++,go >> (Also tried adding --with-libffi, but did not change the behaviour.) >> >> The resulting gccgo seems to compile a hello world successfully and the >> program seems to run fine: >> >>> gccgo -o hello hello.go >>> ./hello >> Hello >> >> However, the "go" binary which gets created, seems to have problems. In sum: >> - for "go build" I get SIGILL >> - for "go --help" I get "fatal error: libgo built without FFI does not >> support reflect.Call or runtime.SetFinalizer" >> >> No matter what I try, somehow libffi does not get used. Doing the same >> compile on amd64 works fine. >> I am less worried about having no reflection support than the SIGILL >> which seems to suggest gccgo might not produce good binary for ia64. >> >> Have you seen similar / do you have any idea? Is anyone using ia64 >> successfully? Can it be a problem if the kernel(and its headers) I am >> compiling on is quite old? >> All produced binaries (go, lib*so*) are ia64 at least according to the >> "file" utility. >> >> Example backtrace of a go build: >> >>> CGO_ENABLED=0 GOTRACEBACK=system go build -a >> SIGILL: illegal instruction >> PC=2305843009225255986 m=2 sigcode=128 > What is the instruction at that PC? Is it valid? The backtrace > suggests that the problem is occurring in C code, which is of course > not compiled with gccgo as such. It may be from the C library, or it > may be compiled with gcc. According to gdb disassembly it is "mov.i ar.pfs=r36". Its inside function "runtime.mcall" in libgo.so I will try to verify if that is true with some disassembler tomorrow, but I am not yet sure how to do that. Do you? Anyways, I will read about that. I have attached the disassembly gdb produces at the SIGILL. The instruction set on that machine is itanium2 (mckinley) and it gets detected correctly, at least as long as I can tell. I will also try to force itanium1 tomorrow and also try with an older version of gcc. > > To get libffi support you will need to add support for > FFI_GO_CLOSURES, which means writing the functions ffi_prep_go_closure > and ffi_call_go. On most platforms this is not too hard; you > basically have to pass the closure argument to ffi_call_go in the > static chain register. I'm not familiar with how ia64 handles the > static chain, though. I will have a look at it, at least try, though not sure if I am capable :( Thanks for your quick response! Robert > > Ian
Dump of assembler code for function runtime.mcall: 0x2000000000b06900 <+0>: [MMI] flushrs;; 0x2000000000b06901 <+1>: nop.m 0x0 0x2000000000b06902 <+2>: nop.i 0x0;; 0x2000000000b06910 <+16>: [MMB] alloc r36=ar.pfs,8,6,0 0x2000000000b06911 <+17>: adds r16=-392,r12 0x2000000000b06912 <+18>: nop.b 0x0 0x2000000000b06920 <+32>: [MMI] adds r17=-384,r12 0x2000000000b06921 <+33>: adds r12=-448,r12 0x2000000000b06922 <+34>: mov r19=b1;; 0x2000000000b06930 <+48>: [MMI] nop.m 0x0 0x2000000000b06931 <+49>: mov.m r18=ar.unat 0x2000000000b06932 <+50>: mov r20=b2 0x2000000000b06940 <+64>: [MMI] adds r2=32,r12 0x2000000000b06941 <+65>: addl r38=34768,r1 0x2000000000b06942 <+66>: mov r39=r0;; 0x2000000000b06950 <+80>: [MII] nop.m 0x0 0x2000000000b06951 <+81>: mov r21=b3 0x2000000000b06952 <+82>: nop.i 0x0 0x2000000000b06960 <+96>: [MMI] ld8 r38=[r38];; 0x2000000000b06961 <+97>: nop.m 0x0 0x2000000000b06962 <+98>: mov r22=b4;; 0x2000000000b06970 <+112>: [MII] nop.m 0x0 0x2000000000b06971 <+113>: mov r23=b5;; 0x2000000000b06972 <+114>: mov r37=pr;; 0x2000000000b06980 <+128>: [MII] nop.m 0x0 0x2000000000b06981 <+129>: mov r35=b0 0x2000000000b06982 <+130>: nop.i 0x0;; 0x2000000000b06990 <+144>: [MMI] st8 [r16]=r18,16 0x2000000000b06991 <+145>: st8.spill [r17]=r1,16 0x2000000000b06992 <+146>: nop.i 0x0;; 0x2000000000b069a0 <+160>: [MMI] st8.spill [r16]=r4,16 0x2000000000b069a1 <+161>: st8.spill [r17]=r5,16 0x2000000000b069a2 <+162>: nop.i 0x0;; 0x2000000000b069b0 <+176>: [MMI] st8.spill [r16]=r6,16 0x2000000000b069b1 <+177>: st8.spill [r17]=r7,16 0x2000000000b069b2 <+178>: nop.i 0x0;; 0x2000000000b069c0 <+192>: [MMI] st8 [r16]=r19,16 0x2000000000b069c1 <+193>: st8 [r17]=r20,16 0x2000000000b069c2 <+194>: nop.i 0x0;; 0x2000000000b069d0 <+208>: [MMI] st8 [r16]=r21,16 0x2000000000b069d1 <+209>: st8 [r17]=r22,16 0x2000000000b069d2 <+210>: nop.i 0x0;; 0x2000000000b069e0 <+224>: [MMI] st8 [r16]=r23,24 0x2000000000b069e1 <+225>: stf.spill [r17]=f2,32 0x2000000000b069e2 <+226>: nop.i 0x0;; 0x2000000000b069f0 <+240>: [MMI] stf.spill [r16]=f3,32 0x2000000000b069f1 <+241>: stf.spill [r17]=f4,32 0x2000000000b069f2 <+242>: nop.i 0x0;; 0x2000000000b06a00 <+256>: [MMI] stf.spill [r16]=f5,32 0x2000000000b06a01 <+257>: stf.spill [r17]=f16,32 0x2000000000b06a02 <+258>: nop.i 0x0;; 0x2000000000b06a10 <+272>: [MMI] stf.spill [r16]=f17,32 0x2000000000b06a11 <+273>: stf.spill [r17]=f18,32 0x2000000000b06a12 <+274>: nop.i 0x0;; 0x2000000000b06a20 <+288>: [MMI] stf.spill [r16]=f19,32 0x2000000000b06a21 <+289>: stf.spill [r17]=f20,32 0x2000000000b06a22 <+290>: nop.i 0x0;; 0x2000000000b06a30 <+304>: [MMI] stf.spill [r16]=f21,32 0x2000000000b06a31 <+305>: stf.spill [r17]=f22,32 0x2000000000b06a32 <+306>: nop.i 0x0;; 0x2000000000b06a40 <+320>: [MMI] stf.spill [r16]=f23,32 0x2000000000b06a41 <+321>: stf.spill [r17]=f24,32 0x2000000000b06a42 <+322>: nop.i 0x0;; 0x2000000000b06a50 <+336>: [MMI] stf.spill [r16]=f25,32 0x2000000000b06a51 <+337>: stf.spill [r17]=f26,32 0x2000000000b06a52 <+338>: nop.i 0x0;; 0x2000000000b06a60 <+352>: [MMI] stf.spill [r16]=f27,32 0x2000000000b06a61 <+353>: stf.spill [r17]=f28,32 0x2000000000b06a62 <+354>: nop.i 0x0;; 0x2000000000b06a70 <+368>: [MMI] stf.spill [r16]=f29,32 0x2000000000b06a71 <+369>: stf.spill [r17]=f30 0x2000000000b06a72 <+370>: nop.i 0x0;; 0x2000000000b06a80 <+384>: [MMI] nop.m 0x0 0x2000000000b06a81 <+385>: stf.spill [r16]=f31 0x2000000000b06a82 <+386>: nop.i 0x0 0x2000000000b06a90 <+400>: [MMB] st8 [r2]=r32 0x2000000000b06a91 <+401>: nop.m 0x0 0x2000000000b06a92 <+402>: br.call.sptk.many b0=0x2000000000ad99c0;; 0x2000000000b06aa0 <+416>: [MII] mov r2=r8 0x2000000000b06aa1 <+417>: adds r1=64,r12;; 0x2000000000b06aa2 <+418>: addl r8=0,r2 0x2000000000b06ab0 <+432>: [MMI] ld8 r1=[r1];; 0x2000000000b06ab1 <+433>: ld8 r38=[r8] 0x2000000000b06ab2 <+434>: nop.i 0x0;; 0x2000000000b06ac0 <+448>: [MMI] adds r14=16,r38;; 0x2000000000b06ac1 <+449>: ld8 r14=[r14] 0x2000000000b06ac2 <+450>: nop.i 0x0;; 0x2000000000b06ad0 <+464>: [MMI] ld8 r14=[r14];; 0x2000000000b06ad1 <+465>: cmp.eq p7,p6=r14,r38 0x2000000000b06ad2 <+466>: nop.i 0x0;; 0x2000000000b06ae0 <+480>: [MLX] nop.m 0x0 0x2000000000b06ae1 <+481>: (p07) movl r38=0xffffffffff8895a0;; 0x2000000000b06af0 <+496>: [MIB] (p07) add r38=r1,r38 0x2000000000b06af1 <+497>: nop.i 0x0 0x2000000000b06af2 <+498>: (p07) br.call.spnt.many b0=0x2000000000aec640;; 0x2000000000b06b00 <+512>: [MMI] adds r17=16,r12 0x2000000000b06b01 <+513>: adds r16=288,r38 0x2000000000b06b02 <+514>: nop.i 0x0 0x2000000000b06b10 <+528>: [MMI] adds r15=304,r38 0x2000000000b06b11 <+529>: adds r14=3000,r38 0x2000000000b06b12 <+530>: adds r38=3031,r38;; 0x2000000000b06b20 <+544>: [MMI] st8 [r16]=r17 0x2000000000b06b21 <+545>: nop.m 0x0 0x2000000000b06b22 <+546>: nop.i 0x0;; 0x2000000000b06b30 <+560>: [MII] mov.m r16=ar.bsp 0x2000000000b06b31 <+561>: nop.i 0x0 0x2000000000b06b32 <+562>: nop.i 0x0 0x2000000000b06b40 <+576>: [MMI] and r38=-16,r38 0x2000000000b06b41 <+577>: st1 [r14]=r0 0x2000000000b06b42 <+578>: nop.i 0x0;; 0x2000000000b06b50 <+592>: [MIB] st8 [r15]=r16 0x2000000000b06b51 <+593>: nop.i 0x0 0x2000000000b06b52 <+594>: br.call.sptk.many b0=0x2000000000ae1aa0;; 0x2000000000b06b60 <+608>: [MMI] nop.m 0x0 0x2000000000b06b61 <+609>: adds r1=64,r12 0x2000000000b06b62 <+610>: nop.i 0x0;; 0x2000000000b06b70 <+624>: [MIB] ld8 r1=[r1] 0x2000000000b06b71 <+625>: nop.i 0x0 0x2000000000b06b72 <+626>: br.call.sptk.many b0=0x2000000000afb740;; 0x2000000000b06b80 <+640>: [MMI] adds r14=3008,r8 0x2000000000b06b81 <+641>: adds r15=16,r8 0x2000000000b06b82 <+642>: nop.i 0x0 0x2000000000b06b90 <+656>: [MMI] adds r1=64,r12 0x2000000000b06b91 <+657>: mov r33=r8 0x2000000000b06b92 <+658>: mov r38=r8;; 0x2000000000b06ba0 <+672>: [MMI] ld8 r14=[r14] 0x2000000000b06ba1 <+673>: ld8 r1=[r1] 0x2000000000b06ba2 <+674>: nop.i 0x0;; 0x2000000000b06bb0 <+688>: [MMI] nop.m 0x0 0x2000000000b06bb1 <+689>: cmp.eq p6,p7=0,r14 0x2000000000b06bb2 <+690>: nop.i 0x0 0x2000000000b06bc0 <+704>: [MMB] ld8 r34=[r15] 0x2000000000b06bc1 <+705>: nop.m 0x0 0x2000000000b06bc2 <+706>: (p06) br.cond.dpnt.few 0x2000000000b06c00 <runtime.mcall+768>;; 0x2000000000b06bd0 <+720>: [MIB] nop.m 0x0 0x2000000000b06bd1 <+721>: nop.i 0x0 0x2000000000b06bd2 <+722>: br.call.sptk.many b0=0x2000000000af15a0;; 0x2000000000b06be0 <+736>: [MMI] nop.m 0x0 0x2000000000b06be1 <+737>: adds r1=64,r12 0x2000000000b06be2 <+738>: nop.i 0x0;; 0x2000000000b06bf0 <+752>: [MMI] ld8 r1=[r1] 0x2000000000b06bf1 <+753>: nop.m 0x0 0x2000000000b06bf2 <+754>: nop.i 0x0 0x2000000000b06c00 <+768>: [MMI] adds r14=3000,r33;; 0x2000000000b06c01 <+769>: ld1 r14=[r14] 0x2000000000b06c02 <+770>: nop.i 0x0;; 0x2000000000b06c10 <+784>: [MIB] cmp4.eq p7,p6=0,r14 0x2000000000b06c11 <+785>: nop.i 0x0 0x2000000000b06c12 <+786>: (p07) br.cond.spnt.few 0x2000000000b06d60 <runtime.mcall+1120>;; 0x2000000000b06c20 <+800>: [MMI] adds r24=56,r12 0x2000000000b06c21 <+801>: adds r25=72,r12 0x2000000000b06c22 <+802>: mov pr=r37,0xfffffffffffffffe;; 0x2000000000b06c30 <+816>: [MMI] nop.m 0x0 0x2000000000b06c31 <+817>: ld8 r26=[r24],24 => 0x2000000000b06c32 <+818>: mov.i ar.pfs=r36 0x2000000000b06c40 <+832>: [MMI] ld8.fill r4=[r25],16;; 0x2000000000b06c41 <+833>: ld8.fill r5=[r24],16 0x2000000000b06c42 <+834>: mov b0=r35 0x2000000000b06c50 <+848>: [MMI] nop.m 0x0 0x2000000000b06c51 <+849>: ld8.fill r6=[r25],16 0x2000000000b06c52 <+850>: nop.i 0x0;; 0x2000000000b06c60 <+864>: [MMI] ld8.fill r7=[r24],16 0x2000000000b06c61 <+865>: mov.m ar.unat=r26 0x2000000000b06c62 <+866>: nop.i 0x0 0x2000000000b06c70 <+880>: [MMI] ld8 r27=[r25],16;; 0x2000000000b06c71 <+881>: ld8 r28=[r24],16 0x2000000000b06c72 <+882>: mov b1=r27 0x2000000000b06c80 <+896>: [MMI] ld8 r29=[r25],16;; 0x2000000000b06c81 <+897>: ld8 r30=[r24],16 0x2000000000b06c82 <+898>: mov b2=r28 0x2000000000b06c90 <+912>: [MMI] ld8 r31=[r25],24;; 0x2000000000b06c91 <+913>: ldf.fill f2=[r24],32 0x2000000000b06c92 <+914>: mov b3=r29 0x2000000000b06ca0 <+928>: [MMI] nop.m 0x0 0x2000000000b06ca1 <+929>: ldf.fill f3=[r25],32 0x2000000000b06ca2 <+930>: nop.i 0x0;; 0x2000000000b06cb0 <+944>: [MII] nop.m 0x0 0x2000000000b06cb1 <+945>: mov b4=r30;; 0x2000000000b06cb2 <+946>: mov b5=r31;; 0x2000000000b06cc0 <+960>: [MMI] ldf.fill f4=[r24],32 0x2000000000b06cc1 <+961>: ldf.fill f5=[r25],32 0x2000000000b06cc2 <+962>: nop.i 0x0;; 0x2000000000b06cd0 <+976>: [MMI] ldf.fill f16=[r24],32 0x2000000000b06cd1 <+977>: ldf.fill f17=[r25],32 0x2000000000b06cd2 <+978>: nop.i 0x0;; 0x2000000000b06ce0 <+992>: [MMI] ldf.fill f18=[r24],32 0x2000000000b06ce1 <+993>: ldf.fill f19=[r25],32 0x2000000000b06ce2 <+994>: nop.i 0x0;; 0x2000000000b06cf0 <+1008>: [MMI] ldf.fill f20=[r24],32 0x2000000000b06cf1 <+1009>: ldf.fill f21=[r25],32 0x2000000000b06cf2 <+1010>: nop.i 0x0;; 0x2000000000b06d00 <+1024>: [MMI] ldf.fill f22=[r24],32 0x2000000000b06d01 <+1025>: ldf.fill f23=[r25],32 0x2000000000b06d02 <+1026>: nop.i 0x0;; 0x2000000000b06d10 <+1040>: [MMI] ldf.fill f24=[r24],32 0x2000000000b06d11 <+1041>: ldf.fill f25=[r25],32 0x2000000000b06d12 <+1042>: nop.i 0x0;; 0x2000000000b06d20 <+1056>: [MMI] ldf.fill f26=[r24],32 0x2000000000b06d21 <+1057>: ldf.fill f27=[r25],32 0x2000000000b06d22 <+1058>: nop.i 0x0;; 0x2000000000b06d30 <+1072>: [MMI] ldf.fill f28=[r24],32 0x2000000000b06d31 <+1073>: ldf.fill f29=[r25],32 0x2000000000b06d32 <+1074>: nop.i 0x0;; 0x2000000000b06d40 <+1088>: [MMI] nop.m 0x0 0x2000000000b06d41 <+1089>: ldf.fill f30=[r24] 0x2000000000b06d42 <+1090>: nop.i 0x0 0x2000000000b06d50 <+1104>: [MMB] ldf.fill f31=[r25] 0x2000000000b06d51 <+1105>: adds r12=448,r12 0x2000000000b06d52 <+1106>: br.ret.sptk.many b0;; 0x2000000000b06d60 <+1120>: [MMI] ld8 r34=[r34] 0x2000000000b06d61 <+1121>: adds r2=32,r12 0x2000000000b06d62 <+1122>: addl r38=34768,r1 0x2000000000b06d70 <+1136>: [MMI] mov r39=r0;; 0x2000000000b06d71 <+1137>: adds r15=2984,r34 0x2000000000b06d72 <+1138>: adds r14=40,r34 0x2000000000b06d80 <+1152>: [MMI] ld8 r2=[r2] 0x2000000000b06d81 <+1153>: ld8 r38=[r38] 0x2000000000b06d82 <+1154>: nop.i 0x0;; 0x2000000000b06d90 <+1168>: [MMI] nop.m 0x0 0x2000000000b06d91 <+1169>: st8 [r15]=r2 0x2000000000b06d92 <+1170>: nop.i 0x0 0x2000000000b06da0 <+1184>: [MMB] st8 [r14]=r33 0x2000000000b06da1 <+1185>: nop.m 0x0 0x2000000000b06da2 <+1186>: br.call.sptk.many b0=0x2000000000ad99c0;; 0x2000000000b06db0 <+1200>: [MMI] mov r2=r8 0x2000000000b06db1 <+1201>: adds r1=64,r12 0x2000000000b06db2 <+1202>: adds r38=3031,r34;; 0x2000000000b06dc0 <+1216>: [MMI] addl r8=0,r2 0x2000000000b06dc1 <+1217>: ld8 r1=[r1] 0x2000000000b06dc2 <+1218>: and r38=-16,r38;; 0x2000000000b06dd0 <+1232>: [MIB] st8 [r8]=r34 0x2000000000b06dd1 <+1233>: nop.i 0x0 0x2000000000b06dd2 <+1234>: br.call.sptk.many b0=0x2000000000ad8920;; 0x2000000000b06de0 <+1248>: [MMI] adds r1=64,r12;; 0x2000000000b06de1 <+1249>: ld8 r1=[r1] 0x2000000000b06de2 <+1250>: nop.i 0x0;; 0x2000000000b06df0 <+1264>: [MLX] nop.m 0x0 0x2000000000b06df1 <+1265>: movl r38=0xffffffffff8895c8;; 0x2000000000b06e00 <+1280>: [MIB] nop.m 0x0 0x2000000000b06e01 <+1281>: add r38=r1,r38 0x2000000000b06e02 <+1282>: br.call.sptk.many b0=0x2000000000aec640;; 0x2000000000b06e10 <+1296>: [MFI] nop.m 0x0 0x2000000000b06e11 <+1297>: break.f 0x0 0x2000000000b06e12 <+1298>: nop.i 0x0;; End of assembler dump. A debugging session is active. Inferior 1 [process 13957] will be killed. Quit anyway? (y or n)