All of lore.kernel.org
 help / color / mirror / Atom feed
From: yang.shi@linaro.org (Shi, Yang)
To: linux-arm-kernel@lists.infradead.org
Subject: Failed to build arm64 bpf samples with LLVM 3.7 on 4.3 kernel
Date: Tue, 10 Nov 2015 15:10:42 -0800	[thread overview]
Message-ID: <56427972.5000004@linaro.org> (raw)
In-Reply-To: <CAADnVQJ+4maNAbMgTwJAHka0jX8ut5v9Nxh=4tOnhJdAbOm2hQ@mail.gmail.com>

On 11/10/2015 2:42 PM, Alexei Starovoitov wrote:
> On Tue, Nov 10, 2015 at 11:25 AM, Shi, Yang <yang.shi@linaro.org> wrote:
>> Hi guys,
>>
>> I just tried to build arm64 bpf samples on 4.3 kernel, but LLVM complain:
>>
>> LLVM ERROR: Inline asm not supported by this streamer because we don't have
>> an asm parser for this target
>>
>> I took some time to bisect it, then found it is caused by sysreg.h
>>
>> There is inline assembly macro defined in sysreg.h:
>>
>> asm(
>> "       .irp
>> num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30\n"
>> "       .equ    __reg_num_x\\num, \\num\n"
>> "       .endr\n"
>> "       .equ    __reg_num_xzr, 31\n"
>> "\n"
>> "       .macro  mrs_s, rt, sreg\n"
>> "       .inst   0xd5200000|(\\sreg)|(__reg_num_\\rt)\n"
>> "       .endm\n"
>> "\n"
>> "       .macro  msr_s, sreg, rt\n"
>> "       .inst   0xd5000000|(\\sreg)|(__reg_num_\\rt)\n"
>> "       .endm\n"
>> );
>>
>> sysreg.h was not included by any other arm64 header files in 4.2, but in 4.3
>> it is included by futex.h and uaccess.h, which are included by bpf samples
>> via skbuff.h.
>>
>> But, it sounds LLVM can't recognize it. I'm not familiar with LLVM, so any
>> suggestion?
>>
>> Could it be worked around by some LLVM compile flags?
>
> hmm this used to work. I don't have arm64 setup anymore.

Yes, sysreg.h used to be not included by any header file.

> Try hacking it by adding #define __ASM_SYSREG_H to prevent inclusion
> of that file? all those asms are unused anyway.
> tracing samples include kernel headers to have exact struct layout.
> and #include skbuff.h can be removed from almost all samples.
> In-kernel 'struct sk_buff' only used inside tracex1_kern.c

The below change works:

         clang $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \
-               -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
+               -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value 
-Wno-pointer-sign \
                 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf 
-filetype=obj -o $@

Is it ok for upstream too?

Thanks,
Yang

>

  reply	other threads:[~2015-11-10 23:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 19:25 Failed to build arm64 bpf samples with LLVM 3.7 on 4.3 kernel Shi, Yang
2015-11-10 22:42 ` Alexei Starovoitov
2015-11-10 23:10   ` Shi, Yang [this message]
2015-11-11  0:47     ` Alexei Starovoitov
2015-11-11  0:53       ` Shi, Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56427972.5000004@linaro.org \
    --to=yang.shi@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.