yonghong-song added a comment.

@compnerd  could you also take a look at this patch?

First, some background about this patch. The reason of this patch is due to:

  
https://lore.kernel.org/bpf/CAOFdcFPnHEc2qd-=c+hdk4ntjjfbhsf4r-g7pdjtrbat6mu...@mail.gmail.com/

Further the following link has details about hardened gentoo and modified clang 
default flags:

  https://wiki.gentoo.org/wiki/Hardened_Gentoo

Unfortunately, we don't want -fstack-protector for bpf target as bpf kernel 
verifier will do stack verification.
This patch tries to ignore -fstack-protector. NVPTX arch has the same need of 
ignoring -fstack-protector.
This patch presented a different message than NVPTX. This patch:

  clang-16: warning: ignoring '-fstack-protector' option as it is not currently 
supported for target 'bpf' [-Woption-ignored]

NVPTX

  clang-16: warning: argument unused during compilation: '-fstack-protector' 
[-Wunused-command-line-argument]

Does clang community has a preference for the above two formats?

Let us say we do implement this patch and merged into clang, then using gentoo 
clang compiler, we will hit
the warning:

  clang-16: warning: ignoring '-fstack-protector' option as it is not currently 
supported for target 'bpf' [-Woption-ignored]

I suspect gentoo community might complain. I don't think we should add 
-Wno-option-ignored since this may cause
unintended issues with compiler command line arguments. 
Without -Wno-option-ignored, gentoo community might wants to append 
-fno-stack-protector to disable stack-protector,
but with the current implementation, we might actually trigger another warning.

So we have to two choices here for bpf target:

  (1). ignore any stack-protector option and do not issue any warning, or
  (2). append -fno-stack-protector by clang to compilation flags.

We can document this behavior in related clang (and kernel) docs.

WDYT?

WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142046/new/

https://reviews.llvm.org/D142046

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to