diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-11-05 20:33:26 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-11-05 20:33:26 +0000 |
commit | 27a0aa20c242f1b85a3187705826e9a7b3b4fc91 (patch) | |
tree | 230002ea922f35edfa162dd3efd5c5a2de87ab8b | |
parent | cbc06b3ab62604dfb94feba0371127241413753f (diff) | |
download | gdb-27a0aa20c242f1b85a3187705826e9a7b3b4fc91.zip gdb-27a0aa20c242f1b85a3187705826e9a7b3b4fc91.tar.gz gdb-27a0aa20c242f1b85a3187705826e9a7b3b4fc91.tar.bz2 |
merge from mainline
-rw-r--r-- | bfd/ChangeLog | 80 | ||||
-rw-r--r-- | bfd/config.bfd | 6 | ||||
-rwxr-xr-x | bfd/configure | 45 | ||||
-rw-r--r-- | bfd/configure.in | 17 | ||||
-rw-r--r-- | bfd/elf.c | 5 | ||||
-rw-r--r-- | bfd/elf32-arm.h | 7 | ||||
-rw-r--r-- | bfd/elf32-sh64-com.c | 2 | ||||
-rw-r--r-- | bfd/elflink.h | 73 | ||||
-rw-r--r-- | bfd/format.c | 54 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 3 | ||||
-rw-r--r-- | bfd/libbfd.h | 3 | ||||
-rw-r--r-- | bfd/targets.c | 15 | ||||
-rw-r--r-- | bfd/version.h | 2 | ||||
-rw-r--r-- | bfd/vms-gsd.c | 8 | ||||
-rw-r--r-- | bfd/vms.c | 2 | ||||
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/symtab.c | 6 | ||||
-rw-r--r-- | gdb/values.c | 4 | ||||
-rw-r--r-- | gdb/version.in | 2 |
19 files changed, 269 insertions, 78 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f427ee7..bfa082b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,83 @@ +2002-11-05 Alan Modra <amodra@bigpond.net.au> + + * elf32-arm.h (t2a1_push_insn, t2a2_ldr_insn, t2a3_mov_insn, + t2a4_bx_insn, t2a5_pop_insn, t2a6_bx_insn): Remove. + +2002-11-05 Graeme Peterson <gp@qnx.com> + + * Makefile.am: Remove entries for elf32-qnx.[ch]. + * Makefile.in: Regenerate. + * config.bfd: Change arm-nto to use bfd_elf32_{big|little}arm_vec, + ppc-nto to use bfd_elf32_powerpc{le}_vec, sh-nto to use + bfd_elf32_sh{l}_vec, and i386-nto to use bfd_elf32_i386_vec. + * configure.in: Remove support for bfd_elf32_sh{l}qnx_vec, + bfd_elf32_powerpc{le}qnx_vec, bfd_elf32_{big|little}armqnx_vec, + and bfd_elf32_i386qnx_vec, and removed elf32-qnx.lo from other targets. + bfd_elf32_sh{l}_vec, and i386-nto to use bfd_elf32_i386_vec. + * configure: Regenerate. + * elf32-qnx.c: Remove. + * elf32-qnx.h: Remove. + * elf.c: Remove calls to QNX specific set_nonloadable_filepos, + is_contained_by_filepos, and copy_private_bfd_data_p. + * elf32-i386.c: Remove QNX extended bfd support. + * elf32-ppc.c: Remove QNX extended bfd support. + * elf32-sh.c: Remove QNX extended bfd support. + * elfarm-nabi.c: Remove QNX extended bfd support. + * targets.c: Remove qnx vectors. + * elfxx-target.h (elf_backend_set_nonloadable_filepos): Remove + (elf_backend_is_contained_by_filepos): Remove. + (elf_backend_copy_private_bfd_data_p): Remove. + * po/SRC-POTFILES.in: Regenerate. + +2002-11-05 Kaz Kojima <kkojima@rr.iij4u.or.jp> + Alan Modra <amodra@bigpond.net.au> + + * config.bfd (sh-*-linux*): Use bfd_elf*_sh64*lin_vec as sh64 + vectors in target_selvecs. + (shle-*-netbsdelf*): Use bfd_elf*_sh64*nbsd_vec as sh64 vectors + in target_selvecs. + (sh-*-netbsdelf*): Likewise. + * configure.in (assocvecs): New variable. Handle assocvecs like + selvecs. + * configure: Regenerate. + * format.c (bfd_check_format_matches): Store bfd_target pointers + in matching_vector instead of target names. Select first target + from bfd_associated_vector that matches a list of ambiguous targets. + * targets.c (_bfd_associated_vector): New array. + (bfd_associated_vector): New variable. + (_bfd_target_vector): Add bfd_elf*_sh64*lin_vec. + * libbfd-in.h (bfd_associated_vector): Declare. + * libbfd.h: Regenerate. + +2002-11-05 Elias Athanasopoulos <eathan@otenet.gr> + + * vms-gsd.c (_bfd_vms_write_gsd): Check that symbol->udata.p is + non-NULL before dereferencing. + +2002-11-04 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * vms.c (vms_object_p): Restore the start address when returning + NULL. + +2002-11-04 Alan Modra <amodra@bigpond.net.au> + Hans-Peter Nilsson <hp@axis.com> + + * elflink.h (struct elf_final_link_info): Add shndxbuf_size. + (elf_bfd_final_link): Don't bother zeroing symtab_hdr fields. + Set up a larger symshndxbuf, and write it out. Free it on + exit rather than freeing symbuf twice. Correct section index + on output section symbol loop. + (elf_link_output_sym): Accumulate symbol extension section + indices, reallocating symshndxbuf rather than writing it out. + (elf_link_flush_output_syms): Don't flush symshndxbuf. + * elf.c (assign_section_numbers): Init i_shdrp to all zero. + Use bfd_zalloc to clear i_shdrp[0] too. + +2002-11-03 Stephen Clarke <stephen.clarke@earthling.net> + + * elf32-sh64-com.c (sh64_address_in_cranges): Use + _raw_size of cranges section if _cooked_size not yet set. + 2002-11-03 Hans-Peter Nilsson <hp@axis.com> * elf32-v850.c (v850_elf_relax_delete_bytes): Correct parameters diff --git a/bfd/config.bfd b/bfd/config.bfd index c37dc75..596d6de 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -949,7 +949,7 @@ case "${targ}" in targ_defvec=bfd_elf32_shblin_vec targ_selvecs=bfd_elf32_shlin_vec #ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" + targ_selvecs="${targ_selvecs} bfd_elf32_sh64lin_vec bfd_elf32_sh64blin_vec bfd_elf64_sh64lin_vec bfd_elf64_sh64blin_vec" #endif ;; sh*eb-*-linux*) @@ -985,7 +985,7 @@ case "${targ}" in targ_defvec=bfd_elf32_shlnbsd_vec targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec" #ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" + targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" #endif ;; sh*le-*-netbsdelf*) @@ -996,7 +996,7 @@ case "${targ}" in targ_defvec=bfd_elf32_shnbsd_vec targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" #ifdef BFD64 - targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" + targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" #endif ;; sh*-*-netbsdelf*) diff --git a/bfd/configure b/bfd/configure index 794cb62..294554e 100755 --- a/bfd/configure +++ b/bfd/configure @@ -5975,12 +5975,14 @@ fi all_targets=false defvec= selvecs= +assocvecs= selarchs= TDEFINES= for targ in $target $canon_targets do if test "x$targ" = "xall"; then all_targets=true + assocvecs="$assocvecs $targ_defvec $targ_selvecs" else . $srcdir/config.bfd if test "x$targ" = "x$target"; then @@ -6011,6 +6013,17 @@ done selvecs="$f" +# uniq the associated vectors in all the configured targets. +f="" +for i in $assocvecs ; do + case " $f " in + *" $i "*) ;; + *) f="$f $i" ;; + esac +done +assocvecs="$f" + + # uniq the architectures in all the configured targets. f="" for i in $selarchs ; do @@ -6320,9 +6333,12 @@ if test x${all_targets} = xtrue ; then selvecs= havevecs= selarchs= + test -n "$assocvecs" && + assocvecs=`echo $assocvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` else # all_targets is true # Only set these if they will be nonempty, for the clever echo. havevecs= + assocvecs= test -n "$selvecs" && havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'` test -n "$selvecs" && @@ -6343,10 +6359,10 @@ case ${host64}-${target64}-${want64} in if test -n "$GCC" ; then bad_64bit_gcc=no; echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6347: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6363: checking for gcc version with buggy 64-bit support" >&5 # Add more tests for gcc versions with non-working 64-bit support here. cat > conftest.$ac_ext <<EOF -#line 6350 "configure" +#line 6366 "configure" #include "confdefs.h" :__GNUC__:__GNUC_MINOR__:__i386__: EOF @@ -6383,6 +6399,7 @@ esac tdefaults="" test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" +test -n "${assocvecs}" && tdefaults="${tdefaults} -DASSOCIATED_VECS='${assocvecs}'" test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'" test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" @@ -6391,17 +6408,17 @@ for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6395: checking for $ac_hdr" >&5 +echo "configure:6412: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6400 "configure" +#line 6417 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6430,12 +6447,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6434: checking for $ac_func" >&5 +echo "configure:6451: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6439 "configure" +#line 6456 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6458,7 +6475,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6483,7 +6500,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6487: checking for working mmap" >&5 +echo "configure:6504: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6491,7 +6508,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6495 "configure" +#line 6512 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6644,7 +6661,7 @@ main() } EOF -if { (eval echo configure:6648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6669,12 +6686,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6673: checking for $ac_func" >&5 +echo "configure:6690: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6678 "configure" +#line 6695 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6697,7 +6714,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/bfd/configure.in b/bfd/configure.in index b59089d..7b41ad2 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -471,12 +471,14 @@ fi all_targets=false defvec= selvecs= +assocvecs= selarchs= TDEFINES= for targ in $target $canon_targets do if test "x$targ" = "xall"; then all_targets=true + assocvecs="$assocvecs $targ_defvec $targ_selvecs" else . $srcdir/config.bfd if test "x$targ" = "x$target"; then @@ -507,6 +509,17 @@ done selvecs="$f" +# uniq the associated vectors in all the configured targets. +f="" +for i in $assocvecs ; do + case " $f " in + *" $i "*) ;; + *) f="$f $i" ;; + esac +done +assocvecs="$f" + + # uniq the architectures in all the configured targets. f="" for i in $selarchs ; do @@ -816,9 +829,12 @@ if test x${all_targets} = xtrue ; then selvecs= havevecs= selarchs= + test -n "$assocvecs" && + assocvecs=`echo $assocvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` else # all_targets is true # Only set these if they will be nonempty, for the clever echo. havevecs= + assocvecs= test -n "$selvecs" && havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'` test -n "$selvecs" && @@ -866,6 +882,7 @@ AC_SUBST(bfd_default_target_size) tdefaults="" test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" +test -n "${assocvecs}" && tdefaults="${tdefaults} -DASSOCIATED_VECS='${assocvecs}'" test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'" test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" AC_SUBST(tdefaults) @@ -2671,18 +2671,17 @@ assign_section_numbers (abfd) /* Set up the list of section header pointers, in agreement with the indices. */ amt = section_number * sizeof (Elf_Internal_Shdr *); - i_shdrp = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt); + i_shdrp = (Elf_Internal_Shdr **) bfd_zalloc (abfd, amt); if (i_shdrp == NULL) return false; amt = sizeof (Elf_Internal_Shdr); - i_shdrp[0] = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); + i_shdrp[0] = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt); if (i_shdrp[0] == NULL) { bfd_release (abfd, i_shdrp); return false; } - memset (i_shdrp[0], 0, sizeof (Elf_Internal_Shdr)); elf_elfsections (abfd) = i_shdrp; diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 5901aea..b74058f 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -367,13 +367,6 @@ static const insn16 t2a1_bx_pc_insn = 0x4778; static const insn16 t2a2_noop_insn = 0x46c0; static const insn32 t2a3_b_insn = 0xea000000; -static const insn16 t2a1_push_insn = 0xb540; -static const insn16 t2a2_ldr_insn = 0x4e03; -static const insn16 t2a3_mov_insn = 0x46fe; -static const insn16 t2a4_bx_insn = 0x4730; -static const insn32 t2a5_pop_insn = 0xe8bd4040; -static const insn32 t2a6_bx_insn = 0xe12fff1e; - #ifndef ELFARM_NABI_C_INCLUDED boolean bfd_elf32_arm_allocate_interworking_sections (info) diff --git a/bfd/elf32-sh64-com.c b/bfd/elf32-sh64-com.c index ae2cab4..df0c463 100644 --- a/bfd/elf32-sh64-com.c +++ b/bfd/elf32-sh64-com.c @@ -127,7 +127,7 @@ sh64_address_in_cranges (cranges, addr, rangep) else { cranges_contents - = bfd_malloc (cranges->_cooked_size == 0 + = bfd_malloc (cranges->_cooked_size != 0 ? cranges->_cooked_size : cranges->_raw_size); if (cranges_contents == NULL) return false; diff --git a/bfd/elflink.h b/bfd/elflink.h index 03be87a..c116ed5 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -4494,6 +4494,8 @@ struct elf_final_link_info size_t symbuf_count; /* Number of symbols which fit in symbuf. */ size_t symbuf_size; + /* And same for symshndxbuf. */ + size_t shndxbuf_size; }; static boolean elf_link_output_sym @@ -4919,6 +4921,7 @@ elf_bfd_final_link (abfd, info) Elf_Internal_Sym elfsym; unsigned int i; Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Shdr *symtab_shndx_hdr; Elf_Internal_Shdr *symstrtab_hdr; struct elf_backend_data *bed = get_elf_backend_data (abfd); struct elf_outext_info eoinfo; @@ -4972,6 +4975,7 @@ elf_bfd_final_link (abfd, info) finfo.symbuf = NULL; finfo.symshndxbuf = NULL; finfo.symbuf_count = 0; + finfo.shndxbuf_size = 0; finfo.first_tls_sec = NULL; for (o = abfd->sections; o != (asection *) NULL; o = o->next) if ((o->flags & SEC_THREAD_LOCAL) != 0 @@ -5192,9 +5196,7 @@ elf_bfd_final_link (abfd, info) symtab_hdr = &elf_tdata (abfd)->symtab_hdr; /* sh_name is set in prep_headers. */ symtab_hdr->sh_type = SHT_SYMTAB; - symtab_hdr->sh_flags = 0; - symtab_hdr->sh_addr = 0; - symtab_hdr->sh_size = 0; + /* sh_flags, sh_addr and sh_size all start off zero. */ symtab_hdr->sh_entsize = sizeof (Elf_External_Sym); /* sh_link is set in assign_section_numbers. */ /* sh_info is set below. */ @@ -5221,9 +5223,11 @@ elf_bfd_final_link (abfd, info) goto error_return; if (elf_numsections (abfd) > SHN_LORESERVE) { - amt = finfo.symbuf_size; + /* Wild guess at number of output symbols. realloc'd as needed. */ + amt = 2 * max_sym_count + elf_numsections (abfd) + 1000; + finfo.shndxbuf_size = amt; amt *= sizeof (Elf_External_Sym_Shndx); - finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_malloc (amt); + finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt); if (finfo.symshndxbuf == NULL) goto error_return; } @@ -5283,7 +5287,7 @@ elf_bfd_final_link (abfd, info) if (! elf_link_output_sym (&finfo, (const char *) NULL, &elfsym, o)) goto error_return; - if (i == SHN_LORESERVE) + if (i == SHN_LORESERVE - 1) i += SHN_HIRESERVE + 1 - SHN_LORESERVE; } } @@ -5558,6 +5562,24 @@ elf_bfd_final_link (abfd, info) /* Now we know the size of the symtab section. */ off += symtab_hdr->sh_size; + symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; + if (symtab_shndx_hdr->sh_name != 0) + { + symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; + symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx); + symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx); + amt = bfd_get_symcount (abfd) * sizeof (Elf_External_Sym_Shndx); + symtab_shndx_hdr->sh_size = amt; + + off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr, + off, true); + + if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_bwrite ((PTR) finfo.symshndxbuf, amt, abfd) != amt)) + return false; + } + + /* Finish up and write out the symbol string table (.strtab) section. */ symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; @@ -5866,7 +5888,7 @@ elf_bfd_final_link (abfd, info) if (finfo.symbuf != NULL) free (finfo.symbuf); if (finfo.symshndxbuf != NULL) - free (finfo.symbuf); + free (finfo.symshndxbuf); for (o = abfd->sections; o != NULL; o = o->next) { if ((o->flags & SEC_RELOC) != 0 @@ -5900,7 +5922,7 @@ elf_bfd_final_link (abfd, info) if (finfo.symbuf != NULL) free (finfo.symbuf); if (finfo.symshndxbuf != NULL) - free (finfo.symbuf); + free (finfo.symshndxbuf); for (o = abfd->sections; o != NULL; o = o->next) { if ((o->flags & SEC_RELOC) != 0 @@ -5959,11 +5981,24 @@ elf_link_output_sym (finfo, name, elfsym, input_sec) dest = finfo->symbuf + finfo->symbuf_count; destshndx = finfo->symshndxbuf; if (destshndx != NULL) - destshndx += finfo->symbuf_count; - elf_swap_symbol_out (finfo->output_bfd, elfsym, (PTR) dest, (PTR) destshndx); - ++finfo->symbuf_count; + { + if (bfd_get_symcount (finfo->output_bfd) >= finfo->shndxbuf_size) + { + bfd_size_type amt; - ++ bfd_get_symcount (finfo->output_bfd); + amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx); + finfo->symshndxbuf = destshndx = bfd_realloc (destshndx, amt * 2); + if (destshndx == NULL) + return false; + memset ((char *) destshndx + amt, 0, amt); + finfo->shndxbuf_size *= 2; + } + destshndx += bfd_get_symcount (finfo->output_bfd); + } + + elf_swap_symbol_out (finfo->output_bfd, elfsym, (PTR) dest, (PTR) destshndx); + finfo->symbuf_count += 1; + bfd_get_symcount (finfo->output_bfd) += 1; return true; } @@ -5988,20 +6023,6 @@ elf_link_flush_output_syms (finfo) return false; hdr->sh_size += amt; - - if (finfo->symshndxbuf != NULL) - { - hdr = &elf_tdata (finfo->output_bfd)->symtab_shndx_hdr; - pos = hdr->sh_offset + hdr->sh_size; - amt = finfo->symbuf_count * sizeof (Elf_External_Sym_Shndx); - if (bfd_seek (finfo->output_bfd, pos, SEEK_SET) != 0 - || (bfd_bwrite ((PTR) finfo->symshndxbuf, amt, finfo->output_bfd) - != amt)) - return false; - - hdr->sh_size += amt; - } - finfo->symbuf_count = 0; } diff --git a/bfd/format.c b/bfd/format.c index ef6b46e..33291d0 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -119,8 +119,9 @@ bfd_check_format_matches (abfd, format, matching) char ***matching; { extern const bfd_target binary_vec; - const bfd_target * const *target, *save_targ, *right_targ, *ar_right_targ; - char **matching_vector = NULL; + const bfd_target * const *target; + const bfd_target **matching_vector = NULL; + const bfd_target *save_targ, *right_targ, *ar_right_targ; int match_count; int ar_match_index; @@ -145,8 +146,8 @@ bfd_check_format_matches (abfd, format, matching) bfd_size_type amt; *matching = NULL; - amt = sizeof (char *) * 2 * _bfd_target_vector_entries; - matching_vector = (char **) bfd_malloc (amt); + amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries; + matching_vector = (const bfd_target **) bfd_malloc (amt); if (!matching_vector) return false; } @@ -170,7 +171,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->xvec = right_targ; /* Set the target as returned. */ if (matching) - free (matching_vector); + free ((PTR) matching_vector); return true; /* File position has moved, BTW. */ } @@ -193,7 +194,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->format = bfd_unknown; if (matching) - free (matching_vector); + free ((PTR) matching_vector); bfd_set_error (bfd_error_file_not_recognized); @@ -236,7 +237,7 @@ bfd_check_format_matches (abfd, format, matching) } if (matching) - matching_vector[match_count] = temp->name; + matching_vector[match_count] = temp; match_count++; @@ -259,7 +260,7 @@ bfd_check_format_matches (abfd, format, matching) if (ar_right_targ != bfd_default_vector[0]) ar_right_targ = *target; if (matching) - matching_vector[ar_match_index] = (*target)->name; + matching_vector[ar_match_index] = *target; ar_match_index++; } else if (err != bfd_error_wrong_format) @@ -268,7 +269,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->format = bfd_unknown; if (matching) - free (matching_vector); + free ((PTR) matching_vector); return false; } @@ -289,7 +290,27 @@ bfd_check_format_matches (abfd, format, matching) { memcpy (matching_vector, matching_vector + _bfd_target_vector_entries, - sizeof (char *) * match_count); + sizeof (*matching_vector) * match_count); + } + } + } + + if (match_count > 1 && bfd_associated_vector != NULL) + { + const bfd_target * const *assoc = bfd_associated_vector; + + while ((right_targ = *assoc++) != NULL) + { + int i = match_count; + + while (--i >= 0) + if (matching_vector[i] == right_targ) + break; + + if (i >= 0) + { + match_count = 1; + break; } } } @@ -299,7 +320,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->xvec = right_targ; /* Change BFD's target permanently. */ if (matching) - free (matching_vector); + free ((PTR) matching_vector); return true; /* File position has moved, BTW. */ } @@ -312,7 +333,7 @@ bfd_check_format_matches (abfd, format, matching) bfd_set_error (bfd_error_file_not_recognized); if (matching) - free (matching_vector); + free ((PTR) matching_vector); } else { @@ -320,8 +341,15 @@ bfd_check_format_matches (abfd, format, matching) if (matching) { - *matching = matching_vector; + *matching = (char **) matching_vector; matching_vector[match_count] = NULL; + /* Return target names. This is a little nasty. Maybe we + should do another bfd_malloc? */ + while (--match_count >= 0) + { + const char *name = matching_vector[match_count]->name; + *(const char **) &matching_vector[match_count] = name; + } } } diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 776dcd6..00d5bd3 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -567,6 +567,9 @@ extern bfd *bfd_last_cache; extern const bfd_target * const *bfd_target_vector; extern const bfd_target *bfd_default_vector[]; +/* List of associated target vectors. */ +extern const bfd_target * const *bfd_associated_vector; + /* Functions shared by the ECOFF and MIPS ELF backends, which have no other common header files. */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index ef001f3..6d40e91 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -572,6 +572,9 @@ extern bfd *bfd_last_cache; extern const bfd_target * const *bfd_target_vector; extern const bfd_target *bfd_default_vector[]; +/* List of associated target vectors. */ +extern const bfd_target * const *bfd_associated_vector; + /* Functions shared by the ECOFF and MIPS ELF backends, which have no other common header files. */ diff --git a/bfd/targets.c b/bfd/targets.c index e665898..a6a0d17 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -859,6 +859,8 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_sh64l_vec, &bfd_elf32_sh64lnbsd_vec, &bfd_elf32_sh64nbsd_vec, + &bfd_elf32_sh64lin_vec, + &bfd_elf32_sh64blin_vec, #endif &bfd_elf32_sparc_vec, &bfd_elf32_tradbigmips_vec, @@ -889,6 +891,8 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf64_sh64l_vec, &bfd_elf64_sh64lnbsd_vec, &bfd_elf64_sh64nbsd_vec, + &bfd_elf64_sh64lin_vec, + &bfd_elf64_sh64blin_vec, #if 0 &bfd_elf64_sparc_vec, #endif @@ -1106,6 +1110,17 @@ const bfd_target *bfd_default_vector[] = { NULL }; +/* bfd_associated_vector[] contains the associated target vectors used + to reduce the ambiguity in bfd_check_format_matches. */ + +static const bfd_target *_bfd_associated_vector[] = { +#ifdef ASSOCIATED_VECS + ASSOCIATED_VECS, +#endif + NULL +}; +const bfd_target * const *bfd_associated_vector = _bfd_associated_vector; + /* When there is an ambiguous match, bfd_check_format_matches puts the names of the matching targets in an array. This variable is the maximum number of entries that the array could possibly need. */ diff --git a/bfd/version.h b/bfd/version.h index 09b1f04..a3f5142 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20021103 +#define BFD_VERSION_DATE 20021105 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c index 0024122..10fbb2d 100644 --- a/bfd/vms-gsd.c +++ b/bfd/vms-gsd.c @@ -420,7 +420,7 @@ _bfd_vms_slurp_gsd (abfd, objtype) { bfd_set_error (bfd_error_no_memory); return -1; - } + } } } else @@ -661,13 +661,13 @@ _bfd_vms_slurp_gsd (abfd, objtype) } else /* symbol reference */ { - symbol->name = + symbol->name = _bfd_vms_save_counted_string (vms_rec+8); #if VMS_DEBUG vms_debug(4, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount, symbol->name, old_flags, flag2str(gsyflagdesc, old_flags)); #endif - symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME); + symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME); } symbol->flags = new_flags; @@ -901,7 +901,7 @@ _bfd_vms_write_gsd (abfd, objtype) unsigned long ca_psindx = 0; unsigned long psindx; - if (old_flags & BSF_FUNCTION) + if ((old_flags & BSF_FUNCTION) && symbol->udata.p != NULL) { code_address = ((asymbol *) (symbol->udata.p))->value; ca_psindx = ((asymbol *) (symbol->udata.p))->section->index; @@ -382,6 +382,7 @@ vms_object_p (abfd) const struct bfd_target *target_vector = 0; const bfd_arch_info_type *arch = 0; PTR tdata_save = abfd->tdata.any; + bfd_vma saddr_save = bfd_get_start_address (abfd); #if VMS_DEBUG vms_debug (1, "vms_object_p(%p)\n", abfd); @@ -519,6 +520,7 @@ vms_object_p (abfd) if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL) bfd_release (abfd, abfd->tdata.any); abfd->tdata.any = tdata_save; + bfd_set_start_address (abfd, saddr_save); return NULL; } diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b01ea10..d348b0b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -294,6 +294,17 @@ (mi_execute_command): Don't print the prompt if the command return is MI_CMD_QUIET. +2002-11-05 David Carlton <carlton@math.stanford.edu> + + * symtab.c (lookup_symbol_aux): In minsym sections, don't use the + previous values of 'objfile' and 'block'. + +2002-11-05 Pierre Muller <muller@ics.u-strasbg.fr> + + * values.c (value_change_enclosing_type): Set + enclosing_type field correctly also for the case where + more memory needs to be allocated. + 2002-11-03 Mark Kettenis <kettenis@gnu.org> * i387-tdep.c (i387_print_float_info): Call fputs_filtered instead @@ -863,7 +874,7 @@ 2002-10-11 Klee Dienes <kdienes@apple.com> - * findvar.c (read_memory_typed_address): New function. + * corefile.c (read_memory_typed_address): New function. * gdbcore.h (read_memory_typed_address): Add prototype. * blockframe.c (sigtramp_saved_pc): Use read_memory_typed_address to read a value destined for a CORE_ADDR, not read_memory_integer. diff --git a/gdb/symtab.c b/gdb/symtab.c index 2ecc40b..e579d16 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -929,7 +929,7 @@ lookup_symbol_aux (const char *name, const char *mangled_name, if (symtab != NULL) *symtab = s; - return fixup_symbol_section (sym, objfile); + return fixup_symbol_section (sym, s->objfile); } else if (MSYMBOL_TYPE (msymbol) != mst_text && MSYMBOL_TYPE (msymbol) != mst_file_text @@ -937,7 +937,7 @@ lookup_symbol_aux (const char *name, const char *mangled_name, { /* This is a mangled variable, look it up by its mangled name. */ - return lookup_symbol_aux (SYMBOL_NAME (msymbol), mangled_name, block, + return lookup_symbol_aux (SYMBOL_NAME (msymbol), mangled_name, NULL, namespace, is_a_field_of_this, symtab); } /* There are no debug symbols for this file, or we are looking @@ -1120,7 +1120,7 @@ lookup_symbol_aux (const char *name, const char *mangled_name, && !STREQ (name, SYMBOL_NAME (msymbol))) { return lookup_symbol_aux (SYMBOL_NAME (msymbol), mangled_name, - block, namespace, is_a_field_of_this, + NULL, namespace, is_a_field_of_this, symtab); } } diff --git a/gdb/values.c b/gdb/values.c index c943f28..950dee6 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -862,7 +862,9 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type) struct value *prev; new_val = (struct value *) xrealloc (val, sizeof (struct value) + TYPE_LENGTH (new_encl_type)); - + + VALUE_ENCLOSING_TYPE (new_val) = new_encl_type; + /* We have to make sure this ends up in the same place in the value chain as the original copy, so it's clean-up behavior is the same. If the value has been released, this is a waste of time, but there diff --git a/gdb/version.in b/gdb/version.in index 1c14be9..f69d163 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2002-11-03-cvs +2002-11-05-cvs |