Patch "bpf: Disable some `attribute ignored' warnings in GCC" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bpf: Disable some `attribute ignored' warnings in GCC

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bpf-disable-some-attribute-ignored-warnings-in-gcc.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 769f04a675da33fdcebff9296b35e1b98ddd4861
Author: Jose E. Marchesi <jose.marchesi@xxxxxxxxxx>
Date:   Tue May 7 09:42:27 2024 +0200

    bpf: Disable some `attribute ignored' warnings in GCC
    
    [ Upstream commit b0fbdf759da05a35b67fd27b8859738b79af25d6 ]
    
    This patch modifies selftests/bpf/Makefile to pass -Wno-attributes to
    GCC.  This is because of the following attributes which are ignored:
    
    - btf_decl_tag
    - btf_type_tag
    
      There are many of these.  At the moment none of these are
      recognized/handled by gcc-bpf.
    
      We are aware that btf_decl_tag is necessary for some of the
      selftest harness to communicate test failure/success.  Support for
      it is in progress in GCC upstream:
    
      https://gcc.gnu.org/pipermail/gcc-patches/2024-May/650482.html
    
      However, the GCC master branch is not yet open, so the series
      above (currently under review upstream) wont be able to make it
      there until 14.1 gets released, probably mid next week.
    
      As for btf_type_tag, more extensive work will be needed in GCC
      upstream to support it in both BTF and DWARF.  We have a WIP big
      patch for that, but that is not needed to compile/build the
      selftests.
    
    - used
    
      There are SEC macros defined in the selftests as:
    
      #define SEC(N) __attribute__((section(N),used))
    
      The SEC macro is used for both functions and global variables.
      According to the GCC documentation `used' attribute is really only
      meaningful for functions, and it warns when the attribute is used
      for other global objects, like for example ctl_array in
      test_xdp_noinline.c.
    
      Ignoring this is benign.
    
    - align_value
    
      In progs/test_cls_redirect.c:127 there is:
    
      typedef uint8_t *net_ptr __attribute__((align_value(8)));
    
      GCC warns that it is ignoring this attribute, because it is not
      implemented by GCC.
    
      I think ignoring this attribute in GCC is benign, because according
      to the clang documentation [1] its purpose seems to be merely
      declarative and doesn't seem to translate into extra checks at
      run-time, only to perhaps better optimized code ("runtime behavior
      is undefined if the pointed memory object is not aligned to the
      specified alignment").
    
      [1] https://clang.llvm.org/docs/AttributeReference.html#align-value
    
    Tested in bpf-next master.
    
    Signed-off-by: Jose E. Marchesi <jose.marchesi@xxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Acked-by: Yonghong Song <yonghong.song@xxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20240507074227.4523-3-jose.marchesi@xxxxxxxxxx
    Stable-dep-of: 3ece93a4087b ("selftests/bpf: Fix wrong binary in Makefile log output")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 397306f5cf911..e0f499794f162 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -412,7 +412,7 @@ endef
 # Build BPF object using GCC
 define GCC_BPF_BUILD_RULE
 	$(call msg,GCC-BPF,$(TRUNNER_BINARY),$2)
-	$(Q)$(BPF_GCC) $3 -O2 -c $1 -o $2
+	$(Q)$(BPF_GCC) $3 -Wno-attributes -O2 -c $1 -o $2
 endef
 
 SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux