diff options
author | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
commit | fa40f30b4253b1e05c46cc5e0c111176825b7623 (patch) | |
tree | 76cf2d26c0ce0ee7c6a2c1a1a2b65bc4d8e33029 /mdk-stage1/insmod-modutils/obj/obj_ia64.c | |
parent | 327bd24f8e4291bd1882de1990dd7339f781a9cb (diff) | |
download | drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar.gz drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar.bz2 drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar.xz drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.zip |
This commit was manufactured by cvs2svn to create tag 'Corpo_2_1_1'.Corpo_2_1_1
Diffstat (limited to 'mdk-stage1/insmod-modutils/obj/obj_ia64.c')
-rw-r--r-- | mdk-stage1/insmod-modutils/obj/obj_ia64.c | 79 |
1 files changed, 18 insertions, 61 deletions
diff --git a/mdk-stage1/insmod-modutils/obj/obj_ia64.c b/mdk-stage1/insmod-modutils/obj/obj_ia64.c index 4f92c5d27..d207a9042 100644 --- a/mdk-stage1/insmod-modutils/obj/obj_ia64.c +++ b/mdk-stage1/insmod-modutils/obj/obj_ia64.c @@ -19,8 +19,6 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ident "$Id$" - #include <string.h> #include <assert.h> #include <stdlib.h> @@ -255,14 +253,15 @@ obj_ia64_ins_imm64(Elf64_Xword v, Elf64_Addr *bundle, Elf64_Xword slot) { Elf64_Xword ins; - assert(slot == 1); + assert(slot == 2); + ins = obj_ia64_ins_extract_from_bundle(bundle, slot); - ins &= 0xffffffee000101ff; - ins |= ((v & 0x8000000000000000) >> 28) | ((v & 0x0000000000200000)) | + ins &= 0xffffffe000101fff; + ins |= ((v & 0x8000000000000000) >> 27) | ((v & 0x0000000000200000)) | ((v & 0x00000000001f0000) << 6) | ((v & 0x000000000000ff80) << 20) | ((v & 0x000000000000007f) << 13); obj_ia64_ins_insert_in_bundle(bundle, slot, ins); - obj_ia64_ins_insert_in_bundle(bundle, ++slot, ((v & 0x7fffffffffc00000) >> 22)); + obj_ia64_ins_insert_in_bundle(bundle, --slot, ((v & 0x7fffffffffc00000) >> 22)); return obj_reloc_ok; } @@ -295,30 +294,6 @@ obj_ia64_generate_plt(Elf64_Addr v, (Elf64_Addr *)(ifile->pltt->contents + pltent->text_offset), 0); } -struct obj_section * -obj_ia64_create_alloced_section (struct obj_file *f, const char *name, - unsigned long align, unsigned long size, unsigned long sh_flags) -{ - int newidx = f->header.e_shnum++; - struct obj_section *sec; - - f->sections = xrealloc(f->sections, (newidx+1) * sizeof(sec)); - f->sections[newidx] = sec = arch_new_section(); - - memset(sec, 0, sizeof(*sec)); - sec->header.sh_type = SHT_PROGBITS; - sec->header.sh_flags = sh_flags; - sec->header.sh_size = size; - sec->header.sh_addralign = align; - sec->name = name; - sec->idx = newidx; - if (size) - sec->contents = xmalloc(size); - - obj_insert_section_load_order(f, sec); - - return sec; -} /*======================================================================*/ @@ -457,26 +432,10 @@ arch_create_got(struct obj_file *f) if (need_got || need_opd || need_plt) { - Elf64_Sym *extsym; ia64_symbol_t *isym; - const char *name; int local; - unsigned long symndx; - symndx = ELF64_R_SYM(rel->r_info); - extsym = &symtab[symndx]; - if (ELF64_ST_BIND(extsym->st_info) == STB_LOCAL) - { - isym = (ia64_symbol_t *) f->local_symtab[symndx]; - } - else - { - if (extsym->st_name) - name = strtab + extsym->st_name; - else - name = f->sections[extsym->st_shndx]->name; - isym = (ia64_symbol_t *)obj_find_symbol(f, name); - } + obj_find_relsym(isym, f, f, rel, symtab, strtab); local = isym->root.secidx <= SHN_HIRESERVE; if (need_plt) @@ -545,20 +504,22 @@ arch_create_got(struct obj_file *f) } } - ifile->got = obj_ia64_create_alloced_section(f, ".got", 8, got_offset, - (SHF_ALLOC | SHF_WRITE | SHF_IA_64_SHORT)); + ifile->got = obj_create_alloced_section(f, ".got", 8, got_offset, + SHF_WRITE | SHF_IA_64_SHORT); assert(ifile->got != NULL); - ifile->opd = obj_ia64_create_alloced_section(f, ".opd", 16, opd_offset, - (SHF_ALLOC | SHF_WRITE | SHF_IA_64_SHORT)); + ifile->opd = obj_create_alloced_section(f, ".opd", 16, opd_offset, + SHF_WRITE | SHF_IA_64_SHORT); assert(ifile->opd != NULL); if (plt_text_offset > 0) { - ifile->pltt = obj_ia64_create_alloced_section(f, ".plt", 16, - plt_text_offset, (SHF_ALLOC | SHF_EXECINSTR | SHF_IA_64_SHORT)); - ifile->pltd = obj_ia64_create_alloced_section(f, ".IA_64.pltoff", - 16, plt_data_offset, (SHF_ALLOC | SHF_WRITE | SHF_IA_64_SHORT)); + ifile->pltt = obj_create_alloced_section(f, ".plt", 16, + plt_text_offset, + SHF_WRITE | SHF_IA_64_SHORT); + ifile->pltd = obj_create_alloced_section(f, ".IA_64.pltoff", 16, + plt_data_offset, + SHF_WRITE | SHF_IA_64_SHORT); assert(ifile->pltt != NULL); assert(ifile->pltd != NULL); } @@ -950,12 +911,8 @@ arch_apply_relocation(struct obj_file *f, case R_IA64_SEGREL32LSB : /* @segrel(sym + add), data4 LSB */ case R_IA64_SEGREL64LSB : /* @segrel(sym + add), data8 LSB */ - if (targsec->header.sh_type & SHT_NOBITS) - v = ifile->bss - v; - else if (targsec->header.sh_flags & SHF_EXECINSTR) - v = ifile->text - v; - else - v = ifile->data - v; + /* Only one segment for modules, see segment_base in arch_archdata */ + v -= f->sections[1]->header.sh_addr; if (r_info == R_IA64_SEGREL32LSB) COPY_32LSB(loc, v); else |