search for: sh_size

Displaying 20 results from an estimated 55 matches for "sh_size".

2007 Apr 18
1
[PATCH 0/2] Use a single loader for i386 and x86_64
...SEEK_SET) < 0) + err(1, "Seeking to section headers"); + if (read(elf_fd, sec, sizeof(sec)) != sizeof(sec)) + err(1, "Reading section headers"); + + for (i = 0; i < ehdr->e_shnum; i++) { + if (sec[i].sh_type == SHT_SYMTAB) { + int ret = 0; + syms = malloc(sec[i].sh_size); + if (!syms) + err(1,"Not enough memory for symbol table"); + ret = lseek(elf_fd, sec[i].sh_offset, SEEK_SET); + if (ret < 0) + err(1, "Seeking to symbol table"); + ret = read(elf_fd, syms, sec[i].sh_size); + if (ret != sec[i].sh_size) + err(1, "Read...
2007 Apr 18
1
[PATCH 0/2] Use a single loader for i386 and x86_64
...SEEK_SET) < 0) + err(1, "Seeking to section headers"); + if (read(elf_fd, sec, sizeof(sec)) != sizeof(sec)) + err(1, "Reading section headers"); + + for (i = 0; i < ehdr->e_shnum; i++) { + if (sec[i].sh_type == SHT_SYMTAB) { + int ret = 0; + syms = malloc(sec[i].sh_size); + if (!syms) + err(1,"Not enough memory for symbol table"); + ret = lseek(elf_fd, sec[i].sh_offset, SEEK_SET); + if (ret < 0) + err(1, "Seeking to symbol table"); + ret = read(elf_fd, syms, sec[i].sh_size); + if (ret != sec[i].sh_size) + err(1, "Read...
2003 Jan 07
1
klibc-0.72 released
This adds [f]getc() and fgets() for parsing config files. Probably hard to avoid. Still trying to decide if I actually want to add system() or not. -hpa
2013 Dec 01
0
[PATCH v2 4/4] efi: PE file size differ from in-memory size
...S32) { - const char *shstrtab, *name; - Elf32_Shdr shdr; + Elf32_Phdr phdr; int i; - void *strtab; - - fseek(f_in, shoff, SEEK_SET); - - /* First find the strtab section */ - fseek(f_in, shstrndx * shentsize, SEEK_CUR); - fread(&shdr, sizeof(shdr), 1, f_in); - strtab = malloc(shdr.sh_size); - if (!strtab) { - fprintf(stderr, "Failed to malloc strtab\n"); - exit(EXIT_FAILURE); - } - - fseek(f_in, shdr.sh_offset, SEEK_SET); - fread(strtab, shdr.sh_size, 1, f_in); - - /* Now search for the .bss section */ - fseek(f_in, shoff, SEEK_SET); - for (i = 0; i < shnum;...
2013 Nov 27
0
[PATCH 4/4] efi: PE file size differ from in-memory size
...S32) { - const char *shstrtab, *name; - Elf32_Shdr shdr; + Elf32_Phdr phdr; int i; - void *strtab; - - fseek(f_in, shoff, SEEK_SET); - - /* First find the strtab section */ - fseek(f_in, shstrndx * shentsize, SEEK_CUR); - fread(&shdr, sizeof(shdr), 1, f_in); - strtab = malloc(shdr.sh_size); - if (!strtab) { - fprintf(stderr, "Failed to malloc strtab\n"); - exit(EXIT_FAILURE); - } - - fseek(f_in, shdr.sh_offset, SEEK_SET); - fread(strtab, shdr.sh_size, 1, f_in); - - /* Now search for the .bss section */ - fseek(f_in, shoff, SEEK_SET); - for (i = 0; i < shnum;...
2015 Oct 10
3
[PATCH] Extend Multiboot1 with support for ELF64 file format
...mbinfo.flags |= MB_INFO_ELF_SHDR; + mbinfo.syms.e.addr = addr; + mbinfo.syms.e.num = eh64->e_shnum; + mbinfo.syms.e.size = eh64->e_shentsize; + mbinfo.syms.e.shndx = eh64->e_shstrndx; + + for (i = 0; i < eh64->e_shnum; i++) { + addr_t align; + + if (!sh64[i].sh_size) + continue; /* Empty section */ + if (sh64[i].sh_flags & SHF_ALLOC) + continue; /* SHF_ALLOC sections should have PHDRs */ + + align = sh64[i].sh_addralign ? sh64[i].sh_addralign : 0; + addr = map_data((char *)ptr + sh64[i].sh_offset, + sh64[i].sh_size, align, MAP_HIGH); + if...
2018 May 23
0
[PATCH v3 23/27] x86/modules: Adapt module loading for PIE support
...ing\n", mod->name); + return -ENOEXEC; + } + if (!syms) { + pr_err("%s: module symtab section missing\n", mod->name); + return -ENOEXEC; + } + + for (i = 0; i < ehdr->e_shnum; i++) { + Elf64_Rela *rels = (void *)ehdr + sechdrs[i].sh_offset; + int numrels = sechdrs[i].sh_size / sizeof(Elf64_Rela); + + if (sechdrs[i].sh_type != SHT_RELA) + continue; + + /* sort by type, symbol index and addend */ + sort(rels, numrels, sizeof(Elf64_Rela), cmp_rela, NULL); + + gots += count_gots(syms, rels, numrels); + } + + mod->arch.core.got->sh_type = SHT_NOBITS; + mod->a...
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
...SHT_GNU_verdef */ + case 0x6fffffff: /* SHT_GNU_versym */ + break; + case SHT_DYNSYM: + BUG_ON(shdr->sh_entsize < sizeof(Elf32_Sym)); + if (!szdynsym) + szdynsym = shdr->sh_entsize; + else + WARN_ON(szdynsym != shdr->sh_entsize); + if (!ndynsym) + ndynsym = shdr->sh_size / szdynsym; + else + WARN_ON(ndynsym != shdr->sh_size / szdynsym); + if (!dynsym) + dynsym = shdr->sh_addr; + else + WARN_ON(dynsym != shdr->sh_addr); + break; + default: + printk(KERN_WARNING "vDSO section %u has unsupported type %08X\n", i, shdr->sh_type)...
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
...SHT_GNU_verdef */ + case 0x6fffffff: /* SHT_GNU_versym */ + break; + case SHT_DYNSYM: + BUG_ON(shdr->sh_entsize < sizeof(Elf32_Sym)); + if (!szdynsym) + szdynsym = shdr->sh_entsize; + else + WARN_ON(szdynsym != shdr->sh_entsize); + if (!ndynsym) + ndynsym = shdr->sh_size / szdynsym; + else + WARN_ON(ndynsym != shdr->sh_size / szdynsym); + if (!dynsym) + dynsym = shdr->sh_addr; + else + WARN_ON(dynsym != shdr->sh_addr); + break; + default: + printk(KERN_WARNING "vDSO section %u has unsupported type %08X\n", i, shdr->sh_type)...
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
...SHT_GNU_verdef */ + case 0x6fffffff: /* SHT_GNU_versym */ + break; + case SHT_DYNSYM: + BUG_ON(shdr->sh_entsize < sizeof(Elf32_Sym)); + if (!szdynsym) + szdynsym = shdr->sh_entsize; + else + WARN_ON(szdynsym != shdr->sh_entsize); + if (!ndynsym) + ndynsym = shdr->sh_size / szdynsym; + else + WARN_ON(ndynsym != shdr->sh_size / szdynsym); + if (!dynsym) + dynsym = shdr->sh_addr; + else + WARN_ON(dynsym != shdr->sh_addr); + break; + default: + printk(KERN_WARNING "vDSO section %u has unsupported type %08X\n", i, shdr->sh_type)...
2013 Nov 27
20
[PATCH 0/4] efi: PE header generation fix
The PE headers of the generated efi file were quite buggy. And since OVMF perform a few consistency checks, syslinux was unable to run on it. I don't pretend to have a thorough understanding of the PE+ headers, some bugs may remain. :) Celelibi (4): efi: Fix PE header field rva_and_sizes_nr efi: Location, size and alignment of .text section efi: Useless relocations in PE file efi: PE
2011 Oct 13
0
[LLVMdev] llvm-objdump related patch
...+ + uint64_t Address; + getSymbolOffset(Symb, Address); + + if (sym->getType() == ELF::STT_FUNC Again, this will only work for functions. Symbols without this type can also be in a section. + && Address >= sec->sh_addr + && Address < (sec->sh_addr + sec->sh_size)) + Result = true; + return object_error::success; } template<support::endianness target_endianness, bool is64Bits> relocation_iterator ELFObjectFile<target_endianness, is64Bits> @@ -232,11 +235,11 @@ static void DisassembleObject(const ObjectFile *Obj) { if (error(i->...
2023 Jun 08
3
[RFC PATCH 0/3] x86/paravirt: Get rid of paravirt patching
This is a small series getting rid of paravirt patching by switching completely to alternative patching for the same functionality. The basic idea is to add the capability to switch from indirect to direct calls via a special alternative patching option. This removes _some_ of the paravirt macro maze, but most of it needs to stay due to the need of hiding the call instructions from the compiler
2023 Jun 08
3
[RFC PATCH 0/3] x86/paravirt: Get rid of paravirt patching
This is a small series getting rid of paravirt patching by switching completely to alternative patching for the same functionality. The basic idea is to add the capability to switch from indirect to direct calls via a special alternative patching option. This removes _some_ of the paravirt macro maze, but most of it needs to stay due to the need of hiding the call instructions from the compiler
2011 Oct 12
2
[LLVMdev] llvm-objdump related patch
Michael, I have rework the patch according to your suggestion. And I have read binutil/objdump source code and found that it has a logic that if there's no symtab, it will use dynsym, which is missing in llvm-objdump. Songmao -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Fix-the-address-calculation-for-llvm-objdump.patch Type: text/x-patch
2007 Apr 18
1
[PATCH] (with benchmarks) binary patching of paravirt_ops call sites
..., alt = s; if (!strcmp(".smp_locks", secstrings + s->sh_name)) locks= s; + if (!strcmp(".parainstructions", secstrings + s->sh_name)) + para = s; } if (alt) { @@ -132,6 +135,10 @@ int module_finalize(const Elf_Ehdr *hdr, lseg, lseg + locks->sh_size, tseg, tseg + text->sh_size); } + if (para) { + void *aseg = (void *)alt->sh_addr; + apply_paravirt(aseg, aseg + alt->sh_size); + } return 0; } diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.6.17-rc4-function-cal...
2007 Apr 18
1
[PATCH] (with benchmarks) binary patching of paravirt_ops call sites
..., alt = s; if (!strcmp(".smp_locks", secstrings + s->sh_name)) locks= s; + if (!strcmp(".parainstructions", secstrings + s->sh_name)) + para = s; } if (alt) { @@ -132,6 +135,10 @@ int module_finalize(const Elf_Ehdr *hdr, lseg, lseg + locks->sh_size, tseg, tseg + text->sh_size); } + if (para) { + void *aseg = (void *)alt->sh_addr; + apply_paravirt(aseg, aseg + alt->sh_size); + } return 0; } diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.6.17-rc4-function-cal...
2008 Oct 21
5
Why could I get function names from a stripped exec?
Hello, all experts. When I use pid provider, my Dscript with -F option output the codepath with flowindent as you know, e.g. -> main -> f1 -> f2 however I realized that the exec file I used at that time was stripped. Does anyone know the reason why I could see the function names? Thanks in advance. -- This message posted from opensolaris.org
2015 Oct 10
2
[PATCH 2/2] com32/mboot/map.c: removed trailing spaces
...@ struct multiboot_header *map_image(void *ptr, size_t len) continue; /* SHF_ALLOC sections should have PHDRs */ align = sh64[i].sh_addralign ? sh64[i].sh_addralign : 0; - addr = map_data((char *)ptr + sh64[i].sh_offset, + addr = map_data((char *)ptr + sh64[i].sh_offset, sh64[i].sh_size, align, MAP_HIGH); if (!addr) { error("Failed to map symbol section\n"); -- 2.0.0
2017 Oct 04
1
[PATCH 11/13] x86/paravirt: Add paravirt alternatives infrastructure
...f (!strcmp(".smp_locks", secstrings + s->sh_name)) locks = s; if (!strcmp(".parainstructions", secstrings + s->sh_name)) @@ -237,6 +239,11 @@ int module_finalize(const Elf_Ehdr *hdr, void *aseg = (void *)alt->sh_addr; apply_alternatives(aseg, aseg + alt->sh_size); } + if (pv_alt) { + /* patch .altinstructions */ + void *seg = (void *)pv_alt->sh_addr; + apply_alternatives(seg, seg + pv_alt->sh_size); + } if (locks && text) { void *lseg = (void *)locks->sh_addr; void *tseg = (void *)text->sh_addr; diff --git a/arch/x86/kernel...