[RFC arm64] samples/bpf: explicitly exclude sysreg sections with asm macros
Andy Gospodarek
andy at greyhouse.net
Fri Mar 17 10:43:35 PDT 2017
On Fri, Mar 17, 2017 at 04:57:20PM +0000, Robin Murphy wrote:
> On 17/03/17 13:58, Andy Gospodarek wrote:
> > On Fri, Mar 17, 2017 at 11:11:59AM +0000, Robin Murphy wrote:
> >> On 16/03/17 21:04, Andy Gospodarek wrote:
> >>>
> >>> While I generally agree isn't the entire reason this inline asm exists
> >>> -- to fix a binutils issue? :-)
> >>
> >> Binutils is required to build the arm64 kernel; if certain versions of
> >> binutils packaged by arm64 distros can't cope with certain instructions
> >> we need to use, we have to do what we can to make it build. However, if
> >> LLVM cannot cope with inline assembly on arm64, then it's pretty clear
> >> that the kernel cannot be built with LLVM anyway, thus there is nothing
> >> to work around in that regard. Sorry, you've got a straw man there ;)
> >
> > I know, right? I'll see if I can come up with something that appears to
> > be less fragile and/or intrusive to the arm64 arch code as I'd really
> > like to stop carrying a patch in my devel tree for this.
>
> I'm honestly not sure if I'm serious or not, but:
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 72c58675973e..f52ebad7b096 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -154,6 +154,6 @@ $(src)/*.c: verify_target_bpf
> # useless for BPF samples.
> $(obj)/%.o: $(src)/%.c
> $(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) \
> - -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value
> -Wno-pointer-sign \
> + -D__KERNEL__ -D'asm(...)' -Wno-unused-value
> -Wno-pointer-sign \
> -Wno-compare-distinct-pointer-types \
> -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf
> -filetype=obj -o $@
>
Hahahaha, I know what you mean.
Scarily, I had a similar thought. :-)
More information about the linux-arm-kernel
mailing list