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>
This commit is contained in:
		
				
					committed by
					
						 Martin Roth
						Martin Roth
					
				
			
			
				
	
			
			
			
						parent
						
							cc728f0284
						
					
				
				
					commit
					ff8076d75a
				
			| @@ -34,4 +34,12 @@ typedef unsigned int wint_t; | ||||
| #define MAYBE_STATIC static | ||||
| #endif | ||||
|  | ||||
| #ifndef __ROMCC__ | ||||
| /* Provide a pointer to address 0 that thwarts any "accessing this is | ||||
|  * undefined behaviour and do whatever" trickery in compilers. | ||||
|  * Use when you _really_ need to read32(zeroptr) (ie. read address 0). | ||||
|  */ | ||||
| extern void *zeroptr; | ||||
| #endif | ||||
|  | ||||
| #endif /* STDDEF_H */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user