summaryrefslogtreecommitdiffstats
path: root/trunk/src/cxx.c
AgeCommit message (Collapse)Author
2010-07-22Merge to r174 -- cleanupMark Hatle
2010-06-15 Mark Hatle <mark.hatle@windriver.com> * Merge to upstream r174 * src/arch-mips.c, src/conflict.c, src/cxx.c, src/main.c, src/verify.c: fix items missed in the merge * Resync dso-readonly.c from dso.c
2010-07-22Merge branch 'prelink_r174' into cross_prelinkMark Hatle
Conflicts: trunk/doc/prelink.8 trunk/src/Makefile.am trunk/src/arch-arm.c trunk/src/arch-mips.c trunk/src/arch-sparc64.c trunk/src/conflict.c trunk/src/cxx.c trunk/src/prelink.h trunk/src/space.c trunk/testsuite/cxx1.sh trunk/testsuite/shuffle2.c
2010-07-22Add MIPS64 prelinking and other associated itemsMark Hatle
2008-10-02 Maciej W. Rozycki <macro@codesourcery.com> * src/arch-mips.c (mips_prelink_reloc): Do not complain about TLS_DTPMOD32 or TLS_DTPMOD64 relocations found in executables. 2008-09-03 Maciej W. Rozycki <macro@codesourcery.com> * src/prelink.h (Elf64_Byte): New definition. (R_MIPS_TLS_DTPMOD64): New macro. (R_MIPS_TLS_DTPREL64): Likewise. (R_MIPS_TLS_TPREL64): Likewise. (RSS_UNDEF): Likewise. (PL_ARCH): Use plarch_##F as the name of the struct in all variants. * src/reloc-info.c: New file. * src/reloc-info.h: Likewise. * src/arch-mips.c (mips_buf_read_addr): New function. (mips_buf_write_addr): Likewise. (mips_arch_adjust): Replace calls to buf_read_une32() and buf_write_ne32() with ones to mips_buf_read_addr() and mips_buf_write_addr() respectively. (mips_read_addend): Rename to... (mips_read_32bit_addend): ... this. (mips_write_addend): Rename to... (mips_write_32bit_addend): ... this. (mips_read_64bit_addend): New function. (mips_write_64bit_addend): Likewise. (mips_adjust_reloc): Handle 64-bit REL relocations. Use reloc_r_sym() and reloc_r_type() in place of GELF_R_SYM() and GELF_R_TYPE() respectively. (mips_prelink_64bit_reloc): New function. (mips_prelink_reloc): Handle 64-bit REL and GLOB_DAT relocations. Handle TLS_DTPMOD64, TLS_DTPREL64 and TLS_TPREL64 relocations. Use reloc_r_sym() and reloc_r_type(). (mips_prelink_rel): Handle 64-bit REL relocations. Use reloc_r_sym(), reloc_r_type() and reloc_r_info_ext() (replacing GELF_R_INFO()). (mips_prelink_conflict_reloc): Handle 64-bit REL relocations. Handle TLS_DTPMOD64, TLS_DTPREL64 and TLS_TPREL64 relocations. Use reloc_r_sym(), reloc_r_type() and reloc_r_info_ext(). (mips_arch_prelink_conflict): Use mips_buf_read_addr(). Use reloc_r_info_ext(). (mips_apply_conflict_rela): Handle 64-bit REL relocations. Use reloc_r_type(). Use mips_buf_read_addr() and mips_buf_write_addr(). (mips_apply_reloc): Handle 64-bit REL relocations. Use reloc_r_sym() and reloc_r_type(). (mips_rel_to_rela): Handle 64-bit REL relocations. Handle TLS_DTPMOD64, TLS_DTPREL64 and TLS_TPREL64 relocations. Use reloc_r_sym() and reloc_r_type(). (mips_rela_to_rel): Handle 64-bit REL and GLOB_DAT relocations. Handle TLS_DTPMOD64, TLS_DTPREL64 and TLS_TPREL64 relocations. Use reloc_r_sym() and reloc_r_type(). (mips_need_rel_to_rela): Use data obtained with gelfx_getshdr() to determine the size of a relocation entry. Use gelfx_getrel() to retrieve them. Handle 64-bit REL relocations. Handle TLS_DTPMOD64, TLS_DTPREL64 and TLS_TPREL64 relocations. Use reloc_r_sym() and reloc_r_type() instead of ELF32_R_SYM() and ELF32_R_TYPE() respectively. (mips_reloc_class): Handle TLS_DTPMOD64, TLS_DTPREL64 and TLS_TPREL64 relocations. (mips_arch_prelink): Use mips_buf_read_addr() and mips_buf_write_addr(). (mips_arch_undo_prelink): Likewise. (mips_undo_prelink_rel): Handle 64-bit GLOB_DAT relocations. Use reloc_r_sym(), reloc_r_type() and reloc_r_info_ext(). (mips64): New PL_ARCH. * src/prelink.c (prelink_prepare): Handle SHT_MIPS_OPTIONS. * src/conflict.c (conflict_rela_cmp_dso): New variable. (conflict_rela_cmp): Use conflict_rela_cmp_dso and reloc_r_sym(). (get_relocated_mem): Use reloc_r_type(). (prelink_add_copy_rel): Use reloc_r_sym() and reloc_r_type(). (prelink_build_conflicts): Use reloc_r_sym(), reloc_r_type() and reloc_r_info(). Pass dso to conflict_rela_cmp() through conflict_rela_cmp_dso. (prelink_find_copy_rela): Use reloc_r_type(). * src/cxx.c (remove_redundant_cxx_conflicts): Use reloc_r_sym(), reloc_r_type() and reloc_r_info(). * src/ld-libs.c (do_rel_section): Use reloc_r_sym() and reloc_r_type(). * src/Makefile.am (common_SOURCES): Add reloc-info.c and reloc-info.h. (prelink_rtld_SOURCES): Likewise. * src/Makefile.in: Regenerate. * configure.in: Check for the Elf64_Byte type. Require autoconf 2.50. * configure: Regenerate. 2008-09-03 Maciej W. Rozycki <macro@codesourcery.com> * src/arch-mips.c (mips_undo_prelink_rel): Fix formatting. 2008-09-03 Maciej W. Rozycki <macro@codesourcery.com> * src/arch-mips.c (mips_init_local_got_iterator): Use ELF_T_ADDR to determine the width of GOT entries. (mips_init_global_got_iterator): Likewise. 200?-??-?? CodeSourcery, LLC. * src/prelink.h: define PL_ARCH(arch) macro * update each arch-<arch>.c file to use the new macro Add attribution
2009-06-15 * src/prelink.h (R_386_IRELATIVE, R_X86_64_IRELATIVE): Definejakub
if not defined. (struct PLArch): Add dest_addr argument to apply_conflict_rela hook. (struct prelink_conflict): Change used type from int to unsigned char, add ifunc field. (get_relocated_mem): Add dest_addr argument. * src/get.c (prelink_record_relocations): Handle lookups resolving to STT_GNU_IFUNC symbols. * src/conflict.c (get_relocated_mem): Add dest_addr argument, pass it through to the apply_conflict_rela hook. Fail if apply_conflict_rela hook failed. (prelink_build_conflicts): Build conflicts even in the executable, and for libraries even if no conflicts were reported by the dynamic linker. In the executable ignore any unused conflicts except for ifunc conflicts. Adjust get_relocated_mem callers. * src/cxx.c (remove_redundant_cxx_conflicts): Adjust get_relocated_mem callers. * arch-alpha.c (alpha_apply_conflict_rela): Add dest_addr argument. (alpha_prelink_conflict_rela): Return early if info->dso == dso. * arch-arm.c (arm_apply_conflict_rela): Add dest_addr argument. (arm_prelink_conflict_rel, arm_prelink_conflict_rela): Return early if info->dso == dso. * arch-cris.c (cris_apply_conflict_rela): Add dest_addr argument. (cris_prelink_conflict_rela): Return early if info->dso == dso. * arch-ia64.c (ia64_apply_conflict_rela): Add dest_addr argument. (ia64_prelink_conflict_rela): Return early if info->dso == dso. * arch-ppc.c (ppc_apply_conflict_rela): Add dest_addr argument. (ppc_prelink_conflict_rela): Return early if info->dso == dso. * arch-ppc64.c (ppc64_apply_conflict_rela): Add dest_addr argument. (ppc64_prelink_conflict_rela): Return early if info->dso == dso. * arch-s390.c (s390_apply_conflict_rela): Add dest_addr argument. (s390_prelink_conflict_rela): Return early if info->dso == dso. * arch-s390x.c (s390x_apply_conflict_rela): Add dest_addr argument. (s390x_prelink_conflict_rela): Return early if info->dso == dso. * arch-sh.c (sh_apply_conflict_rela): Add dest_addr argument. (sh_prelink_conflict_rela): Return early if info->dso == dso. * arch-sparc.c (sparc_apply_conflict_rela): Add dest_addr argument. (sparc_prelink_conflict_rela): Return early if info->dso == dso. * arch-sparc64.c (sparc64_apply_conflict_rela): Add dest_addr argument. (sparc64_prelink_conflict_rela): Return early if info->dso == dso. * arch-mips.c (mipz_apply_conflict_rela): Add dest_addr argument. (mips_prelink_conflict_reloc, mips_arch_prelink_conflict): Return early if info->dso == dso. * arch-i386.c (i386_adjust_rel, i386_adjust_rela, i386_prelink_rel, i386_prelink_rela, i386_rel_to_rela, i386_undo_prelink_rel, i386_rela_to_rel): Handle R_386_IRELATIVE. (i386_apply_conflict_rela): Add dest_addr argument, handle R_386_IRELATIVE. (i386_prelink_conflict_rel, i386_prelink_conflict_rela): Handle R_386_IRELATIVE and conflict->ifunc conflicts. * arch-x86_64.c (x86_64_adjust_rela, x86_64_prelink_rela, x86_64_undo_prelink_rela): Handle R_X86_64_IRELATIVE. (x86_64_apply_conflict_rela): Handle R_X86_64_IRELATIVE and conflict->ifunc conflicts. * testsuite/Makefile.am (TESTS): Add ifunc1.sh, ifunc2.sh and ifunc3.sh. * testsuite/Makefile.in: Regenerated. * testsuite/ifunc1.sh: New test. * testsuite/ifunc2.sh: New test. * testsuite/ifunc3.sh: New test. * testsuite/ifunc1.c: New file. * testsuite/ifunc1lib1.c: New file. * testsuite/ifunc1lib2.c: New file. * testsuite/ifunc3.c: New file. * testsuite/ifunc3lib1.c: New file. * testsuite/ifunc.h: New file. * testsuite/ifunctest.c: New file. git-svn-id: http://sourceware.org/svn/prelink@172 94c539fb-cf18-0410-b60f-edeeb537fa16
2009-03-11 * src/prelink.h (PLArch): Add rtype_class_valid field.jakub
* src/get.c (prelink_record_relocations): If not /4, or dso->arch->rtype_class_valid instead of RTYPE_CLASS_VALID into reloc_class. * src/cxx.c (remove_redundant_cxx_conflicts): Use info->dso->arch->rtype_class_valid instead of RTYPE_CLASS_VALID. * src/arch-ppc64.c (ppc64_reloc_class): For R_PPC64_COPY return RTYPE_CLASS_COPY | RTYPE_CLASS_PLT, for non-TLS relocs return RTYPE_CLASS_PLT. (PL_ARCH): Set rtype_class_valid to RTYPE_CLASS_PLT. * src/arch-alpha.c (PL_ARCH): Set rtype_class_valid to RTYPE_CLASS_VALID. * src/arch-arm.c (PL_ARCH): Likewise. * src/arch-cris.c (PL_ARCH): Likewise. * src/arch-i386.c (PL_ARCH): Likewise. * src/arch-ia64.c (PL_ARCH): Likewise. * src/arch-mips.c (PL_ARCH): Likewise. * src/arch-ppc.c (PL_ARCH): Likewise. * src/arch-s390.c (PL_ARCH): Likewise. * src/arch-s390x.c (PL_ARCH): Likewise. * src/arch-sh.c (PL_ARCH): Likewise. * src/arch-sparc.c (PL_ARCH): Likewise. * src/arch-sparc64.c (PL_ARCH): Likewise. * src/arch-x86_64.c (PL_ARCH): Likewise. git-svn-id: http://sourceware.org/svn/prelink@168 94c539fb-cf18-0410-b60f-edeeb537fa16
2007-10-09 * src/cxx.c (remove_redundant_cxx_conflicts): Allow .sdatajakub
section as well. git-svn-id: http://sourceware.org/svn/prelink@161 94c539fb-cf18-0410-b60f-edeeb537fa16
2007-10-09 * src/prelink.h (struct prelink_conflict): Add next2 field.jakub
(struct prelink_conflicts): Add hash2 field. * src/get.c (prelink_record_relocations): Clear next2 fields. * src/prelink.c (free_info): Also free hash2 table. * src/cxx.c (remove_redundant_cxx_conflicts): Populate hash2 if not populated yet, use it to speed up pltref checking. git-svn-id: http://sourceware.org/svn/prelink@160 94c539fb-cf18-0410-b60f-edeeb537fa16
2007-10-09 * src/prelink.h (struct prelink_conflicts): New type.jakub
(struct prelink_info): Change type of conflicts and curconflicts fields to struct prelink_conflicts *. * src/get.c (conflict_hash_init): New function. (prelink_record_relocations): Adjust initialization of conflicts array. If conflict linked lists has more than 15 entries, use hash table with chains. * src/prelink.c (free_info): Handle freeing conflict list using a hash table. * src/fptr.c (opd_init): Only walk corresponding hash chain if conflict list is using a hash table. * src/conflict.c (prelink_conflict): Likewise. (prelink_build_conflicts): Handle conflict list using a hash table. * src/cxx.c (remove_redundant_cxx_conflicts): Likewise. Only walk corresponding hash chain if conflict list is using a hash table. git-svn-id: http://sourceware.org/svn/prelink@159 94c539fb-cf18-0410-b60f-edeeb537fa16
2007-10-09 * src/cxx.c (find_cxx_sym): If fcs->lastndx != -1, search firstjakub
among symbols around it. git-svn-id: http://sourceware.org/svn/prelink@157 94c539fb-cf18-0410-b60f-edeeb537fa16
2007-10-08 * src/cxx.c: Include alloca.h.jakub
(specials): Moved out of remove_redundant_cxx_conflicts to toplevel. Remove section fields. (find_cxx_sym_valsize, find_cxx_sym_cache): New structs. (struct find_cxx_sym): Add cache and lastndx fields. (cachecmp, create_cache): New functions. (find_cxx_sym): Add cache argument. If cache[n] is NULL, call create_cache. Do a binary search in cache[n]->vals array instead of always reading the whole symbol table. (remove_redundant_cxx_conflicts): Adjust find_cxx_sym caller. Check if secname is ".data" or ".data.rel.ro" instead of comparing it against specials[k].secname. Use binary search in binsymcache when doing check_pltref checks. * testsuite/Makefile.am (TESTS): Add cxx2.sh. * testsuite/Makefile.in: Regenerated. * testsuite/cxx1.sh: Check that some conflicts are optimized out by C++ optimizations. * testsuite/cxx2.sh: New test. * testsuite/cxx2.C: New. git-svn-id: http://sourceware.org/svn/prelink@155 94c539fb-cf18-0410-b60f-edeeb537fa16
2007-10-04 * src/prelink.h (read_config): New prototype.jakub
(gather_config, blacklist_from_config): Remove argument. * src/gather.c (struct config_line): New type. (config_lines, config_end): New variables. (read_config): New function. (gather_config, blacklist_from_config): Walk config_lines chain instead of reading the config file. * src/verify.c (prelink_verify): Call read_config. Don't pass any argument to gather_config. * src/main.c (main): Likewise. Also for blacklist_from_config. * testsuite/quick2.sh: Use new -c etc/prelink.conf.d/*.conf feature in prelink.conf and multiple config snippets. git-svn-id: http://sourceware.org/svn/prelink@154 94c539fb-cf18-0410-b60f-edeeb537fa16
2006-07-21Move code into trunk subdirectory.drow
git-svn-id: http://sourceware.org/svn/prelink@134 94c539fb-cf18-0410-b60f-edeeb537fa16