Dear Kevin,
Am 18.12.21 um 19:10 schrieb Kevin O'Connor:
Use a different definition for the linker script symbol to avoid a gcc warning.
What GCC version did you use, and which warning is it exactly?
Signed-off-by: Kevin O'Connor kevin@koconnor.net
src/memmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/memmap.h b/src/memmap.h index 22bd4bc..32ca265 100644 --- a/src/memmap.h +++ b/src/memmap.h @@ -15,7 +15,7 @@ static inline void *memremap(u32 addr, u32 len) { }
// Return the value of a linker script symbol (see scripts/layoutrom.py) -#define SYMBOL(SYM) ({ extern char SYM; (u32)&SYM; }) +#define SYMBOL(SYM) ({ extern char SYM[]; (u32)SYM; }) #define VSYMBOL(SYM) ((void*)SYMBOL(SYM))
#endif // memmap.h
gcc (Debian 11.2.0-13) 11.2.0 still shows a lot of:
Compile checking out/src/fw/smm.o In file included from src/fw/smm.c:18: src/fw/smm.c: In function 'smm_save_and_copy': src/string.h:23:16: warning: '__builtin_memcpy' offset [0, 511] is out of the bounds [0, 0] [-Warray-bounds] 23 | #define memcpy __builtin_memcpy src/fw/smm.c:148:5: note: in expansion of macro 'memcpy' 148 | memcpy(&smm->cpu, &initsmm->cpu, sizeof(smm->cpu)); | ^~~~~~
Kind regards,
Paul