Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36601 )
Change subject: commonlib,security: Use compiler builtin for offsetof() ......................................................................
commonlib,security: Use compiler builtin for offsetof()
The homegrown implementation of offsetof() uses a pointer to integer cast, which is forbidden in integer constant expressions. Clang has recently become more picky about this, and use of this macro in a _Static_assert() now causes a compilation error. Change the implementation to use the compiler builtin instead, and delete a redundant definition in security/vboot.
Change-Id: Ib77b6499e871b69204143cda70d9d76953e1e1a0 Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M src/commonlib/include/commonlib/helpers.h M src/security/vboot/secdata_tpm.c 2 files changed, 1 insertion(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/01/36601/1
diff --git a/src/commonlib/include/commonlib/helpers.h b/src/commonlib/include/commonlib/helpers.h index f3b71d7..ad1f181 100644 --- a/src/commonlib/include/commonlib/helpers.h +++ b/src/commonlib/include/commonlib/helpers.h @@ -108,7 +108,7 @@ #define GHz (1000 * MHz)
#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#define offsetof(type, member) __builtin_offsetof(type, member) #endif
#if !defined(__clang__) diff --git a/src/security/vboot/secdata_tpm.c b/src/security/vboot/secdata_tpm.c index 38a1810..2fbb30b 100644 --- a/src/security/vboot/secdata_tpm.c +++ b/src/security/vboot/secdata_tpm.c @@ -40,10 +40,6 @@ #include <vb2_api.h> #include <console/console.h>
-#ifndef offsetof -#define offsetof(A,B) __builtin_offsetof(A,B) -#endif - #ifdef FOR_TEST #include <stdio.h> #define VBDEBUG(format, args...) printf(format, ## args)
Jacob Garber has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/36601 )
Change subject: commonlib,security: Use compiler builtin for offsetof() ......................................................................
Abandoned
See CB:36249 instead