Skip to content

Commit 0b9e1fc

Browse files
danielRepmiguelafsilva5
authored andcommitted
fix(linker): fix broken linker symbols
This commit addresses issues introduced on linker symbols when MEM_NON_UNIFIED and .datanocopy were added. - Add _data_(vma/lma)_end symbol to get the address of the data end address used during the data copy routine of non-unified platforms - Move _image_load_end to the original location right before the vm_images, allowing .datanocopy to be correctly mapped in bao's first continuous region - Force _dmem_phys_beg calculation to be related to the type of memory protection (mpu/mmu) of the platform and not the memory type (unified/non-unified) Signed-off-by: Daniel Oliveira <[email protected]>
1 parent 85544aa commit 0b9e1fc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/arch/armv8/aarch32/boot.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ _set_master_cpu:
159159
/* Copy data from RX to RWX */
160160
ldr r7, =_data_lma_start // LMA start
161161
ldr r11, =_data_vma_start // VMA start
162-
ldr r12, =_image_load_end // LMA end
162+
ldr r12, =_data_lma_end // LMA end
163163
bl copy_data
164164

165165
ldr r1, =_data_vma_start

src/linker.ld

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ SECTIONS
5656
_ipi_cpumsg_handlers_id_end = .;
5757
}
5858

59-
_image_load_end = .;
59+
_data_vma_end = .;
6060

6161
.datanocopy : ALIGN(PAGE_SIZE) {
6262
/**
@@ -71,9 +71,12 @@ SECTIONS
7171
. = ALIGN(PAGE_SIZE);
7272
}
7373

74+
_image_load_end = .;
75+
7476
#ifdef MEM_NON_UNIFIED
7577
/* Save the current location counter (VMA) and switch to LMA for .vm_images */
7678
_vma_before_vm_images = .;
79+
_data_lma_end = ALIGN((_data_lma_start + (_data_vma_end - _data_vma_start)), PAGE_SIZE);
7780
_image_load_end = ALIGN((_data_lma_start + (_image_load_end - _data_vma_start)), PAGE_SIZE);
7881
. = _image_load_end;
7982
#endif
@@ -122,8 +125,9 @@ SECTIONS
122125
. = ALIGN(PAGE_SIZE);
123126
_image_end = ABSOLUTE(.);
124127

128+
#ifdef MEM_PROT_MMU
125129
_dmem_phys_beg = ABSOLUTE(.) + extra_allocated_phys_mem;
126-
#ifdef MEM_NON_UNIFIED
130+
#else
127131
_dmem_phys_beg = ABSOLUTE(.);
128132
#endif
129133

0 commit comments

Comments
 (0)