On Mon, May 19, 2025 at 01:00:53PM -0700, Dave Jiang wrote:
> Pull in the kernel UAPI header files from CXL Features support and FWCTL.
> This is needed to support building the CXL Features unit test.


__counted_by's got supported in GCC 14.1 and appended failure was with 12.2.1.
Suggest conditionally stubbing it out like this:

diff --git a/cxl/fwctl/features.h b/cxl/fwctl/features.h
index 490606d7694b..b71a2fdf2040 100644
--- a/cxl/fwctl/features.h
+++ b/cxl/fwctl/features.h
@@ -9,6 +9,14 @@
 
 #include <linux/types.h>
 
+/*
+ * Vendored Version: Do not use a compiler attribute that may not be available
+ * to user space. counted_by_'s are supported in GCC 14.1
+ */
+#ifndef __counted_by_le
+#define __counted_by_le(count)
+#endif
+


FAILED: test/fwctl.p/fwctl.c.o 
cc -Itest/fwctl.p -Itest -I../test -I. -I.. -Indctl -I../ndctl 
-I/usr/include/uuid -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall 
-Winvalid-pch -std=gnu99 -O0 -g -Wchar-subscripts -Wformat-security 
-Wmissing-declarations -Wmissing-prototypes -Wshadow -Wsign-compare 
-Wstrict-prototypes -Wtype-limits -Wmaybe-uninitialized 
-Wdeclaration-after-statement -Wunused-result -include config.h -MD -MQ 
test/fwctl.p/fwctl.c.o -MF test/fwctl.p/fwctl.c.o.d -o test/fwctl.p/fwctl.c.o 
-c ../test/fwctl.c
In file included from ../test/fwctl.c:17:
../cxl/fwctl/features.h:105:38: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or 
‘__attribute__’ before ‘__counted_by_le’
  105 |         struct cxl_feat_entry ents[] __counted_by_le(num_entries);
      |                                      ^~~~~~~~~~~~~~~
../test/fwctl.c: In function ‘cxl_fwctl_rpc_get_supported_features’:
../test/fwctl.c:323:26: error: ‘struct cxl_mbox_get_sup_feats_out’ has no 
member named ‘ents’
  323 |         entry = &feat_out->ents[0];
      |                          ^~
[91/254] Generating symbol file 
daxctl/lib/libdaxctl.so.1.1.6.p/libdaxctl.so.1.1.6.symbols
ninja: build stopped: subcommand failed.

snip


Reply via email to