Re: [iovisor-dev] LLVM error: couldn't allocate output register for constraint 'r' at line 473618
Thanks. By looking at preprocessor, I found ntohl() -> __be32_to_cpu() -> __fswab32() then some x86 inline assembly. I guess something is wrong there so I replace ntohl() with __constant_ntohl(), then it works ok! -#define load_word(ctx, b) ntohl(*(u32 *)(data + (b))) +#define load_word(ctx, b) __constant_ntohl(*(u32 *)(data + (b))) Regards, William On Sun, Jan 8, 2017 at 4:30 PM, Alexei Starovoitov wrote: > "couldn't allocate output register for constraint 'r' " > means that inline asm was used. > Try preprocessing C and look for inline asm usage. > > On Fri, Jan 6, 2017 at 1:30 PM, William Tu via iovisor-dev > wrote: >> thanks >> the code is at >> https://gist.github.com/williamtu/7e41392a34672d7b4574aee063ea4a3b >> >> >> On Fri, Jan 6, 2017 at 1:21 PM, Brenden Blanco wrote: >>> Yes, it would be helpful to share the code. >>> >>> On Fri, Jan 6, 2017 at 12:34 PM, William Tu via iovisor-dev >>> wrote: Hi, I'm adding parser and extra map lookup into the xdp1_kern.c and encounter this LLVM error. My environment: clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) LLVM version 4.0.0svn I think it might be related to bpf map access, if I comment out the map access code, then the problem goes away. Looking at similar error in bcc, I have no clue about how to debug this issue. https://github.com/iovisor/bcc/issues/220 https://github.com/iovisor/bcc/issues/237 I can share the code if it is more helpful. Any comments are appreciated! $ clang -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/5/include -I./arch/x86/include -I./arch/x86/include/generated/uapi -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h \ -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ -Wno-compare-distinct-pointer-types \ -Wno-gnu-variable-sized-type-not-at-end \ -Wno-address-of-packed-member -Wno-tautological-compare \ -O2 -emit-llvm -c /root/net-next/samples/bpf/xdp1_kern.c -o -| llc -march=bpf -filetype=obj -o /root/net-next/samples/bpf/xdp1_kern.o warning: unknown warning option '-Wno-address-of-packed-member' [-Wunknown-warning-option] 1 warning generated. error: couldn't allocate output register for constraint 'r' at line 473618 Thanks William ___ iovisor-dev mailing list iovisor-dev@lists.iovisor.org https://lists.iovisor.org/mailman/listinfo/iovisor-dev >>> >>> >> ___ >> iovisor-dev mailing list >> iovisor-dev@lists.iovisor.org >> https://lists.iovisor.org/mailman/listinfo/iovisor-dev ___ iovisor-dev mailing list iovisor-dev@lists.iovisor.org https://lists.iovisor.org/mailman/listinfo/iovisor-dev
Re: [iovisor-dev] LLVM error: couldn't allocate output register for constraint 'r' at line 473618
"couldn't allocate output register for constraint 'r' " means that inline asm was used. Try preprocessing C and look for inline asm usage. On Fri, Jan 6, 2017 at 1:30 PM, William Tu via iovisor-dev wrote: > thanks > the code is at > https://gist.github.com/williamtu/7e41392a34672d7b4574aee063ea4a3b > > > On Fri, Jan 6, 2017 at 1:21 PM, Brenden Blanco wrote: >> Yes, it would be helpful to share the code. >> >> On Fri, Jan 6, 2017 at 12:34 PM, William Tu via iovisor-dev >> wrote: >>> >>> Hi, >>> >>> I'm adding parser and extra map lookup into the xdp1_kern.c and >>> encounter this LLVM error. My environment: >>> clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) >>> LLVM version 4.0.0svn >>> >>> I think it might be related to bpf map access, if I comment out the >>> map access code, then the problem goes away. Looking at similar error >>> in bcc, I have no clue about how to debug this issue. >>> https://github.com/iovisor/bcc/issues/220 >>> https://github.com/iovisor/bcc/issues/237 >>> I can share the code if it is more helpful. Any comments are appreciated! >>> >>> $ clang -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/5/include >>> -I./arch/x86/include -I./arch/x86/include/generated/uapi >>> -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi >>> -I./include/uapi -I./include/generated/uapi -include >>> ./include/linux/kconfig.h \ >>> -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ >>> -Wno-compare-distinct-pointer-types \ >>> -Wno-gnu-variable-sized-type-not-at-end \ >>> -Wno-address-of-packed-member -Wno-tautological-compare \ >>> -O2 -emit-llvm -c /root/net-next/samples/bpf/xdp1_kern.c -o -| llc >>> -march=bpf -filetype=obj -o /root/net-next/samples/bpf/xdp1_kern.o >>> warning: unknown warning option '-Wno-address-of-packed-member' >>> [-Wunknown-warning-option] >>> 1 warning generated. >>> error: couldn't allocate output register for constraint 'r' at line 473618 >>> >>> Thanks >>> William >>> ___ >>> iovisor-dev mailing list >>> iovisor-dev@lists.iovisor.org >>> https://lists.iovisor.org/mailman/listinfo/iovisor-dev >> >> > ___ > iovisor-dev mailing list > iovisor-dev@lists.iovisor.org > https://lists.iovisor.org/mailman/listinfo/iovisor-dev ___ iovisor-dev mailing list iovisor-dev@lists.iovisor.org https://lists.iovisor.org/mailman/listinfo/iovisor-dev
Re: [iovisor-dev] LLVM error: couldn't allocate output register for constraint 'r' at line 473618
thanks the code is at https://gist.github.com/williamtu/7e41392a34672d7b4574aee063ea4a3b On Fri, Jan 6, 2017 at 1:21 PM, Brenden Blanco wrote: > Yes, it would be helpful to share the code. > > On Fri, Jan 6, 2017 at 12:34 PM, William Tu via iovisor-dev > wrote: >> >> Hi, >> >> I'm adding parser and extra map lookup into the xdp1_kern.c and >> encounter this LLVM error. My environment: >> clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) >> LLVM version 4.0.0svn >> >> I think it might be related to bpf map access, if I comment out the >> map access code, then the problem goes away. Looking at similar error >> in bcc, I have no clue about how to debug this issue. >> https://github.com/iovisor/bcc/issues/220 >> https://github.com/iovisor/bcc/issues/237 >> I can share the code if it is more helpful. Any comments are appreciated! >> >> $ clang -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/5/include >> -I./arch/x86/include -I./arch/x86/include/generated/uapi >> -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi >> -I./include/uapi -I./include/generated/uapi -include >> ./include/linux/kconfig.h \ >> -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ >> -Wno-compare-distinct-pointer-types \ >> -Wno-gnu-variable-sized-type-not-at-end \ >> -Wno-address-of-packed-member -Wno-tautological-compare \ >> -O2 -emit-llvm -c /root/net-next/samples/bpf/xdp1_kern.c -o -| llc >> -march=bpf -filetype=obj -o /root/net-next/samples/bpf/xdp1_kern.o >> warning: unknown warning option '-Wno-address-of-packed-member' >> [-Wunknown-warning-option] >> 1 warning generated. >> error: couldn't allocate output register for constraint 'r' at line 473618 >> >> Thanks >> William >> ___ >> iovisor-dev mailing list >> iovisor-dev@lists.iovisor.org >> https://lists.iovisor.org/mailman/listinfo/iovisor-dev > > ___ iovisor-dev mailing list iovisor-dev@lists.iovisor.org https://lists.iovisor.org/mailman/listinfo/iovisor-dev
Re: [iovisor-dev] LLVM error: couldn't allocate output register for constraint 'r' at line 473618
Yes, it would be helpful to share the code. On Fri, Jan 6, 2017 at 12:34 PM, William Tu via iovisor-dev < iovisor-dev@lists.iovisor.org> wrote: > Hi, > > I'm adding parser and extra map lookup into the xdp1_kern.c and > encounter this LLVM error. My environment: > clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) > LLVM version 4.0.0svn > > I think it might be related to bpf map access, if I comment out the > map access code, then the problem goes away. Looking at similar error > in bcc, I have no clue about how to debug this issue. > https://github.com/iovisor/bcc/issues/220 > https://github.com/iovisor/bcc/issues/237 > I can share the code if it is more helpful. Any comments are appreciated! > > $ clang -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/5/include > -I./arch/x86/include -I./arch/x86/include/generated/uapi > -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi > -I./include/uapi -I./include/generated/uapi -include > ./include/linux/kconfig.h \ > -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ > -Wno-compare-distinct-pointer-types \ > -Wno-gnu-variable-sized-type-not-at-end \ > -Wno-address-of-packed-member -Wno-tautological-compare \ > -O2 -emit-llvm -c /root/net-next/samples/bpf/xdp1_kern.c -o -| llc > -march=bpf -filetype=obj -o /root/net-next/samples/bpf/xdp1_kern.o > warning: unknown warning option '-Wno-address-of-packed-member' > [-Wunknown-warning-option] > 1 warning generated. > error: couldn't allocate output register for constraint 'r' at line 473618 > > Thanks > William > ___ > iovisor-dev mailing list > iovisor-dev@lists.iovisor.org > https://lists.iovisor.org/mailman/listinfo/iovisor-dev > ___ iovisor-dev mailing list iovisor-dev@lists.iovisor.org https://lists.iovisor.org/mailman/listinfo/iovisor-dev