lib/program.ld: Make (NOLOAD) and to_load more explicit
(NOLOAD) indicates that the section occupies no space in the file, but does take up space in memory during process execution. It's typically used for bss sections which contain uninitialized global/static variables. to_load makes sure the section is part of the program headers. This is needed for instance with relocatable stages to know how much memory the program will use. Although the BFD linker makes some good guesses making this a NOOP, other linkers like LLD need to mark these sections more explicitly. Change-Id: Ic14543ba580abe7a34c69bba714eae8cce504977 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80803 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
This commit is contained in:
		
				
					committed by
					
						 Nico Huber
						Nico Huber
					
				
			
			
				
	
			
			
			
						parent
						
							ee1cb8f463
						
					
				
				
					commit
					67166a7eb2
				
			| @@ -68,7 +68,7 @@ | |||||||
| 	LONG(0); | 	LONG(0); | ||||||
| 	LONG(0); | 	LONG(0); | ||||||
| 	__CTOR_END__ = .; | 	__CTOR_END__ = .; | ||||||
| } | } : to_load | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* Include data, bss, and heap in that order. Not defined for all stages. */ | /* Include data, bss, and heap in that order. Not defined for all stages. */ | ||||||
| @@ -113,11 +113,11 @@ | |||||||
| 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | ||||||
| 	_edata = .; | 	_edata = .; | ||||||
| 	RECORD_SIZE(data) | 	RECORD_SIZE(data) | ||||||
| } | } : to_load | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if !ENV_SEPARATE_DATA_AND_BSS | #if !ENV_SEPARATE_DATA_AND_BSS | ||||||
| .bss . : { | .bss . (NOLOAD) : { | ||||||
| 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | ||||||
| 	_bss = .; | 	_bss = .; | ||||||
| 	*(.bss) | 	*(.bss) | ||||||
| @@ -127,18 +127,18 @@ | |||||||
| 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | ||||||
| 	_ebss = .; | 	_ebss = .; | ||||||
| 	RECORD_SIZE(bss) | 	RECORD_SIZE(bss) | ||||||
| } | } : to_load | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if ENV_HAS_HEAP_SECTION | #if ENV_HAS_HEAP_SECTION | ||||||
| .heap . : { | .heap . (NOLOAD) : { | ||||||
| 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | ||||||
| 	_heap = .; | 	_heap = .; | ||||||
| 	. += CONFIG_HEAP_SIZE; | 	. += CONFIG_HEAP_SIZE; | ||||||
| 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | 	. = ALIGN(ARCH_POINTER_ALIGN_SIZE); | ||||||
| 	_eheap = .; | 	_eheap = .; | ||||||
| 	RECORD_SIZE(heap) | 	RECORD_SIZE(heap) | ||||||
| } | } : to_load | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE) | #if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user