From ff8076d75ace8da247b927f7de37f3ed5081b55e Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 27 Jan 2016 08:18:16 +0100 Subject: 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 Reviewed-on: https://review.coreboot.org/12294 Tested-by: Raptor Engineering Automated Test Stand Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/lib/program.ld | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/lib') diff --git a/src/lib/program.ld b/src/lib/program.ld index 865b5f6aa7..9b8c7c9ec1 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.*) -- cgit v1.2.3