[coreboot-gerrit] Patch set updated for coreboot: Provide a gcc-safe null pointer
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Wed Jan 27 08:20:10 CET 2016
Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12294
-gerrit
commit d2bf503f8cea28b95ce4fcd4dead9b69b2196ac1
Author: Patrick Georgi <patrick at georgi-clan.de>
Date: Wed Jan 27 08:18:16 2016 +0100
Provide a gcc-safe null pointer
nullptr is a linker object pointing at 0 that can be used to thwart
GCC's (and other compilers') "dereferencing NULL is undefined"
optimization strategy when it gets in the way.
Change-Id: I6aa6f28283281ebae73d6349811e290bf1b99483
Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
src/include/stddef.h | 4 ++++
src/lib/program.ld | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/include/stddef.h b/src/include/stddef.h
index b58f645..4fe4e05 100644
--- a/src/include/stddef.h
+++ b/src/include/stddef.h
@@ -34,4 +34,8 @@ typedef unsigned int wint_t;
#define MAYBE_STATIC static
#endif
+#ifndef __ROMCC__
+extern void *nullptr;
+#endif
+
#endif /* STDDEF_H */
diff --git a/src/lib/program.ld b/src/lib/program.ld
index 865b5f6..0a966ad 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -133,6 +133,10 @@ _eprogram = .;
/* Discard the sections we don't need/want */
+.nullptr 0 (NOLOAD) : {
+ nullptr = .;
+}
+
/DISCARD/ : {
*(.comment)
*(.comment.*)
More information about the coreboot-gerrit
mailing list