summaryrefslogtreecommitdiffstats
path: root/src/lib/program.ld
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2016-01-27 08:18:16 +0100
committerMartin Roth <martinroth@google.com>2016-01-28 23:25:53 +0100
commitff8076d75ace8da247b927f7de37f3ed5081b55e (patch)
tree239a0d035ffc5fd4d46e3cfb8b3b88191fbe08e7 /src/lib/program.ld
parentcc728f02846a1752215503dc7897caf6fc5a1fc1 (diff)
downloadcoreboot-ff8076d75ace8da247b927f7de37f3ed5081b55e.tar.gz
coreboot-ff8076d75ace8da247b927f7de37f3ed5081b55e.tar.bz2
coreboot-ff8076d75ace8da247b927f7de37f3ed5081b55e.zip
Provide a gcc-safe zero pointer
zeroptr 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@georgi-clan.de> Reviewed-on: https://review.coreboot.org/12294 Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/lib/program.ld')
-rw-r--r--src/lib/program.ld4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/program.ld b/src/lib/program.ld
index 865b5f6aa731..9b8c7c9ec1ad 100644
--- a/src/lib/program.ld
+++ b/src/lib/program.ld
@@ -133,6 +133,10 @@ _eprogram = .;
/* Discard the sections we don't need/want */
+.zeroptr 0 (NOLOAD) : {
+ zeroptr = .;
+}
+
/DISCARD/ : {
*(.comment)
*(.comment.*)