Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

compiler_types: Identify compiler versions for __builtin_dynamic_object_size

Clarify when __builtin_dynamic_object_size() is available. All our
supported Clang versions support it. GCC 12 and later support it. Link
to documentation for both.

Acked-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/r/20250416172016.work.154-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>

+5
+5
include/linux/compiler_types.h
··· 449 449 /* 450 450 * When the size of an allocated object is needed, use the best available 451 451 * mechanism to find it. (For cases where sizeof() cannot be used.) 452 + * 453 + * Optional: only supported since gcc >= 12 454 + * 455 + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html 456 + * clang: https://clang.llvm.org/docs/LanguageExtensions.html#evaluating-object-size 452 457 */ 453 458 #if __has_builtin(__builtin_dynamic_object_size) 454 459 #define __struct_size(p) __builtin_dynamic_object_size(p, 0)