Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Staging:C
grub2
grub2-ppc64le-20-.TOC.-symbol-is-special-in-ppc...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grub2-ppc64le-20-.TOC.-symbol-is-special-in-ppc64le-.-It-maps-to-the-.patch of Package grub2
From 8212195e18301ed18a060722e2b5933d2052b2c1 Mon Sep 17 00:00:00 2001 From: Ram Pai <linuxram@us.ibm.com> Date: Tue, 25 Feb 2014 18:59:13 +0000 Subject: [PATCH 20/23] handle .TOC. symbol while loading .TOC. symbol is special in ppc64le . It maps to the address of the .toc section. Signed-off-by: Ram Pai <linuxram@us.ibm.com> --- grub-core/kern/dl.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c index de2d0ed..ce2ff38 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -343,6 +343,26 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) return GRUB_ERR_NONE; } +#ifdef __powerpc64le__ +static int +grub_dl_find_section_index (Elf_Ehdr *e, const char *name) +{ + Elf_Shdr *s; + const char *str; + unsigned i; + + s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize); + str = (char *) e + s->sh_offset; + + for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); + i < e->e_shnum; + i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) + if (grub_strcmp (str + s->sh_name, name) == 0) + return i; + return -1; +} +#endif + static grub_err_t grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) { @@ -392,7 +412,19 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) /* Resolve a global symbol. */ if (sym->st_name != 0 && sym->st_shndx == 0) { - grub_symbol_t nsym = grub_dl_resolve_symbol (name); + grub_symbol_t nsym; + +#ifdef __powerpc64le__ + if (grub_strcmp(name, ".TOC.") == 0) { + int j = grub_dl_find_section_index (e, ".toc"); + if (j < 0) + return grub_error (GRUB_ERR_BAD_MODULE, + N_("section '.toc' not found"), name); + sym->st_value = (Elf_Addr) grub_dl_get_section_addr (mod, j); + break; + } +#endif + nsym = grub_dl_resolve_symbol (name); if (! nsym) return grub_error (GRUB_ERR_BAD_MODULE, N_("symbol `%s' not found"), name); -- 1.8.3.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor