grub2/0115-mkimage-rename-a-couple-of-things-to-be-less-confusi.patch

101 lines
4.2 KiB
Diff
Raw Normal View History

From 594ac31571970611958b00284f9ca4c6f6c1286d Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 21 Feb 2018 15:20:25 -0500
Subject: [PATCH] mkimage: rename a couple of things to be less confusing
later.
This renames some things:
- the "strtab" and "strtab_section" in relocate_symbols are changed to "symtab"
instead, so as to be less confusing when "strtab" is moved to a struct in a
later patch.
- The places where we pass section_vaddresses to functions are changed to also
be called section_vaddresses"inside those functions, so I get less confused
when I put addresses and vaddresses in a struct in a later patch.
Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
util/grub-mkimagexx.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
index 97ff599f073..85753448ee1 100644
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -509,7 +509,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
Return the address of a start symbol. */
static Elf_Addr
SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
- Elf_Shdr *symtab_section, Elf_Addr *section_addresses,
+ Elf_Shdr *symtab_section, Elf_Addr *section_vaddresses,
Elf_Half section_entsize, Elf_Half num_sections,
void *jumpers, Elf_Addr jumpers_addr,
Elf_Addr bss_start, Elf_Addr end,
@@ -520,15 +520,15 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
Elf_Addr start_address = (Elf_Addr) -1;
Elf_Sym *sym;
Elf_Word i;
- Elf_Shdr *strtab_section;
- const char *strtab;
+ Elf_Shdr *symtab_link_section;
+ const char *symtab;
grub_uint64_t *jptr = jumpers;
- strtab_section
+ symtab_link_section
= (Elf_Shdr *) ((char *) sections
+ (grub_target_to_host32 (symtab_section->sh_link)
* section_entsize));
- strtab = (char *) e + grub_target_to_host (strtab_section->sh_offset);
+ symtab = (char *) e + grub_target_to_host (symtab_link_section->sh_offset);
symtab_size = grub_target_to_host (symtab_section->sh_size);
sym_size = grub_target_to_host (symtab_section->sh_entsize);
@@ -542,7 +542,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
Elf_Section cur_index;
const char *name;
- name = strtab + grub_target_to_host32 (sym->st_name);
+ name = symtab + grub_target_to_host32 (sym->st_name);
cur_index = grub_target_to_host16 (sym->st_shndx);
if (cur_index == STN_ABS)
@@ -565,7 +565,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
else
{
sym->st_value = (grub_target_to_host (sym->st_value)
- + section_addresses[cur_index]);
+ + section_vaddresses[cur_index]);
}
if (image_target->elf_target == EM_IA_64 && ELF_ST_TYPE (sym->st_info)
@@ -580,7 +580,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
grub_util_info ("locating %s at 0x%" GRUB_HOST_PRIxLONG_LONG
" (0x%" GRUB_HOST_PRIxLONG_LONG ")", name,
(unsigned long long) sym->st_value,
- (unsigned long long) section_addresses[cur_index]);
+ (unsigned long long) section_vaddresses[cur_index]);
if (start_address == (Elf_Addr)-1)
if (strcmp (name, "_start") == 0 || strcmp (name, "start") == 0)
@@ -1644,7 +1644,7 @@ create_u64_fixups (struct translate_context *ctx,
/* Make a .reloc section. */
static void
make_reloc_section (Elf_Ehdr *e, struct grub_mkimage_layout *layout,
- Elf_Addr *section_addresses, Elf_Shdr *sections,
+ Elf_Addr *section_vaddresses, Elf_Shdr *sections,
Elf_Half section_entsize, Elf_Half num_sections,
const char *strtab,
const struct grub_install_image_target_desc *image_target)
@@ -1674,7 +1674,7 @@ make_reloc_section (Elf_Ehdr *e, struct grub_mkimage_layout *layout,
rtab_offset = grub_target_to_host (s->sh_offset);
num_rs = rtab_size / r_size;
- section_address = section_addresses[grub_le_to_cpu32 (s->sh_info)];
+ section_address = section_vaddresses[grub_le_to_cpu32 (s->sh_info)];
for (j = 0, r = (Elf_Rel *) ((char *) e + rtab_offset);
j < num_rs;