From: Peter Jones <pjones@redhat.com>
To: grub-devel@gnu.org
Cc: Daniel Kiper <dkiper@net-space.pl>, Peter Jones <pjones@redhat.com>
Subject: [PATCH v3 3/7] mkimage: rename a couple of things to be less confusing later.
Date: Wed, 21 Feb 2018 15:20:25 -0500 [thread overview]
Message-ID: <20180221202029.31419-3-pjones@redhat.com> (raw)
In-Reply-To: <20180221202029.31419-1-pjones@redhat.com>
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>
---
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 10d7b41e3bf..e00a831e0ca 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)
@@ -1643,7 +1643,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)
@@ -1673,7 +1673,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;
--
2.15.0
next prev parent reply other threads:[~2018-02-21 20:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 16:26 [PATCH 1/2] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-01-31 16:27 ` [PATCH 2/2] .mod files: Strip annobin annotations and .eh_frame, and their relocations Peter Jones
2018-02-15 22:03 ` Vladimir 'phcoder' Serbinenko
2018-02-20 14:51 ` Daniel Kiper
2018-02-20 23:29 ` Peter Jones
2018-02-15 21:52 ` [PATCH 1/2] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-02-15 22:03 ` Vladimir 'phcoder' Serbinenko
2018-02-20 14:48 ` Daniel Kiper
2018-02-20 23:25 ` [PATCH v2 1/3] mkimage: refactor a bunch of section data into a struct Peter Jones
2018-02-20 23:25 ` [PATCH v2 2/3] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-02-21 11:18 ` Daniel Kiper
2018-02-20 23:25 ` [PATCH v2 3/3] .mod files: Strip annobin annotations and .eh_frame, and their relocations Peter Jones
2018-02-21 11:22 ` Daniel Kiper
2018-02-21 11:07 ` [PATCH v2 1/3] mkimage: refactor a bunch of section data into a struct Daniel Kiper
2018-02-21 20:18 ` Peter Jones
2018-02-21 20:20 ` [PATCH v3 1/7] aout.h: Fix missing include Peter Jones
2018-02-21 20:20 ` [PATCH v3 2/7] mkimage: make it easier to run syntax checkers on grub-mkimagexx.c Peter Jones
2018-02-23 14:27 ` Daniel Kiper
2018-02-21 20:20 ` Peter Jones [this message]
2018-02-23 14:29 ` [PATCH v3 3/7] mkimage: rename a couple of things to be less confusing later Daniel Kiper
2018-02-21 20:20 ` [PATCH v3 4/7] mkimage: make locate_sections() set up vaddresses as well Peter Jones
2018-02-23 14:38 ` Daniel Kiper
2018-02-21 20:20 ` [PATCH v3 5/7] mkimage: refactor a bunch of section data into a struct Peter Jones
2018-02-23 14:51 ` Daniel Kiper
2018-02-23 15:27 ` Peter Jones
2018-02-21 20:20 ` [PATCH v3 6/7] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-02-23 14:54 ` Daniel Kiper
2018-02-21 20:20 ` [PATCH v3 7/7] .mod files: Strip annobin annotations and .eh_frame, and their relocations Peter Jones
2018-02-23 14:54 ` Daniel Kiper
2018-02-23 14:56 ` Daniel Kiper
2018-02-23 14:15 ` [PATCH v3 1/7] aout.h: Fix missing include Daniel Kiper
2018-02-20 23:26 ` [PATCH 1/2] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180221202029.31419-3-pjones@redhat.com \
--to=pjones@redhat.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).