[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start
From: |
Vladimir Serbinenko |
Subject: |
[PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start |
Date: |
Tue, 3 Sep 2024 20:58:52 +0300 |
Assembly code looks for modules at __bss_start. Make this position explicit
rather than matching bss alignment and module alignment.
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
util/grub-mkimagexx.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index e50b29533..fe6085c8b 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -2431,6 +2431,8 @@ SUFFIX (grub_mkimage_load_image) (const char *kernel_path,
if (!is_relocatable (image_target))
{
Elf_Addr current_address = layout->kernel_size;
+ Elf_Addr bss_start = layout->kernel_size;
+ bool is_first = true;
for (i = 0, s = smd.sections;
i < smd.num_sections;
@@ -2453,6 +2455,12 @@ SUFFIX (grub_mkimage_load_image) (const char
*kernel_path,
current_address = grub_host_to_target_addr (s->sh_addr)
- image_target->link_addr;
+ if (is_first)
+ {
+ bss_start = current_address;
+ is_first = false;
+ }
+
smd.vaddrs[i] = current_address
+ image_target->vaddr_offset;
current_address += grub_host_to_target_addr (s->sh_size);
@@ -2460,6 +2468,16 @@ SUFFIX (grub_mkimage_load_image) (const char
*kernel_path,
current_address = ALIGN_UP (current_address + image_target->vaddr_offset,
image_target->section_align)
- image_target->vaddr_offset;
+
+ if (image_target->id == IMAGE_YEELOONG_FLASH
+ || image_target->id == IMAGE_FULOONG2F_FLASH
+ || image_target->id == IMAGE_LOONGSON_ELF
+ || image_target->id == IMAGE_QEMU_MIPS_FLASH
+ || image_target->id == IMAGE_MIPS_ARC)
+ {
+ layout->kernel_size = bss_start;
+ }
+
layout->bss_size = current_address - layout->kernel_size;
}
else
--
2.39.2
- [PATCH v2 1/7] configure: Look for .otf fonts, Vladimir Serbinenko, 2024/09/03
- [PATCH v2 2/7] erofs: Replace 64-bit modulo with bitwise operations, Vladimir Serbinenko, 2024/09/03
- [PATCH v2 3/7] xzembed: Silence warning when no BCJ is available, Vladimir Serbinenko, 2024/09/03
- [PATCH v2 5/7] gentpl: Put startup_raw.S into beginning of the image, Vladimir Serbinenko, 2024/09/03
- [PATCH v2 7/7] mkimage: Explicitly move modules to __bss_start,
Vladimir Serbinenko <=
- [PATCH v2 6/7] offsets: Set mod_align to 4 on mips, Vladimir Serbinenko, 2024/09/03
- [PATCH v2 4/7] configure: Add -mno-gpopt option, Vladimir Serbinenko, 2024/09/03