From: Daniel Jacobowitz Date: Mon, 28 Oct 2002 18:45:58 +0000 (+0000) Subject: Merge from mainline. X-Git-Tag: binutils-2_13_1~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aac1dea7832ae45e1d61c651a96c7fe436c3aca8;p=thirdparty%2Fbinutils-gdb.git Merge from mainline. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b1249502bf9..03d647c319c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,144 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-24 John David Anglin + * aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to + unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to + unsigned int. + (NAME(aout,final_link)): Cast enum used in assignment. + (aout_link_write_symbols): Cast enums in comparisons, int values to + boolean, enums in assignments to int. + (aout_link_input_section_std): Cast rel->r_index to unsigned int. + (aout_link_input_section_ext): Likewise. Cast enums used in comparisons + with unsigned ints. + (aout_link_reloc_link_order): Cast enum to int in assignment. + * archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr + calls to char *. + * bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in + assignment. + * bfd-in2.h (bfd_set_section_vma): Likewise. + * bfd.c (bfd_record_phdr): Cast enums in assignments. + * binary.c (bfd_alloc): Cast enum to long. + * coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean. + * dwarf2.c (read_abbrevs): Add casts to enum types. + (read_attribute_value): Likewise. + (arange_add): Cast result of bfd_zalloc call. + (comp_unit_contains_address): Return true and false. + (comp_unit_find_nearest_line): Cast return to boolean. + * format.c (bfd_check_format_matches, bfd_set_format): Likewise. + * gen-aout.c: define macro '_' if not defined. + * libbfd.c (bfd_realloc): Cast malloc and realloc to PTR. + (bfd_bwrite): Cast bfd_realloc to bfd_byte *. + (bfd_write_bigendian_4byte_int): Cast return to boolean. + (bfd_seek): Cast bfd_realloc to bfd_byte *. + (bfd_generic_is_local_label_name): Cast return to boolean. + * libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'. + * linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to + struct bfd_hash_entry *. + (_bfd_generic_link_hash_newfunc): likewise. + (_bfd_generic_final_link): Cast enum to unsigned int. + * merge.c (sec_merge_emit): Cast return to boolean. + (merge_strings): Add casts to const unsigned char *. + * reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int. + (bfd_generic_get_relocated_section_content): Cast enum to unsigned int. + * section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to + struct bfd_hash_entry *. + (bfd_set_section_content): Add cast to PTR in comparison. + * srec.c (S3Forced): Initialize to false. + (srec_get_symtab): Cast return value from bfd_alloc to asymbol *. + * stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons. + (_bfd_discard_section_stabs): Likewise. Also cast return to boolean. + * syms.c (bfd_is_undefined_symclass): Cast return to boolean. + (_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in + comparisons. + + 2002-10-23 Jakub Jelinek + * elf64-alpha.c (elf64_alpha_check_relocs): Only put maybe_dynamic + relocs into shared lib non-allocated reloc sections. + + 2002-10-23 Nathan Tallent + * dwarf2.c (add_line_info): Ensure that the line_info_table is + sorted even when given an out-of-order line sequence. + (lookup_address_in_line_info_table): When an exact VMA match is + not found, return line information with the closest VMA. + + 2002-10-21 Alan Modra + * targets.c (bfd_target_list): Don't return the default target twice. + + 2002-10-19 H.J. Lu + * elflink.h (elf_link_add_object_symbols): Correctly handle + DT_RPATH and DT_RUNPATH. + + 2002-10-16 Jakub Jelinek + * config.bfd (s390-*-linux*): Add targ64_selvecs. + (s390x-*-linux*): Add targ_selvecs. + + 2002-10-16 Alan Modra + * elflink.h (elf_link_add_object_symbols): Error out on dynamic objects + loaded with --just-symbols. + + * elf32-i386qnx.c (TARGET_LITTLE_NAME): Define. + + 2002-10-14 Kaz Kojima + * config.bfd (sh*eb-*-linux*, sh*-*-linux*): Add the alternative + endian vector to targ_selvecs. + + 2002-10-08 H.J. Lu + * elf32-i386.c (elf_i386_relocate_section): Re-arrange the + IE->LE transition for R_386_TLS_IE. + + 2002-10-07 Mark Elbrecht + * cofflink.c (mark_relocs): Don't mark relocations in excluded + sections. + + 2002-10-05 Alexandre Oliva + * elfxx-mips.c (mips_elf_create_dynamic_relocation): Set the type + of the other two relocations packed with a REL32 to NONE. + + 2002-10-02 Stephen Clarke + * elf32-sh.c (elf_sh_link_hash_entry): Add gotplt_refcount. + (sh_elf_link_hash_newfunc): Initialize it. + (allocate_dynrelocs): Transfer gotplt refs from plt.refcount + to got.refcount for symbols that are forced local or when + we have direct got refs. + (sh_elf_gc_sweep_hook): Adjust gotplt_refcount. Use it + to correctly adjust got.refcount and plt.refcount. + (sh_elf_copy_indirect_symbol): Copy gotplt_refcount across. + (sh_elf_check_relocs): Increment gotplt_refcount. + + 2002-10-01 Jakub Jelinek + * elf32-i386.c (elf_i386_relocate_section): Fix + movl foo@indntpoff, %eax IE->LE transition. + + 2002-09-28 Jason Thorpe + * elf32-vax.c (elf_vax_size_dynamic_section): Don't strip + .got sections. + + 2002-09-27 Matt Thomas + * elf32-vax.c (elf_vax_check_relocs): Remove unused + local_got_refcounts usage. Remove allocation of got slot. + (elf_vax_gc_sweep_hook): Remove unused local_got_refcounts usage. + Remove de-allocation of got slot. + (elf_vax_size_dynamic_section): Fix some indentation. Add hash + traversal for elf_vax_instantiate_got_entries. Allow empty .got + sections to be GC'ed. + (elf_vax_instantiate_got_entries): New function. + (elf_vax_relocate_section): Simplify R_VAX_GOT32 handling. Remove + tests that are now handled by elf_vax_instantiate_got_entries. + Assert GOT entry falls within .got section size. Remove redundant + comparisions. Fix comments. + + 2002-09-24 Jakub Jelinek + * elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE + addend into r_addend, not *r_offset. + (elf32_sparc_finish_dynamic_symbol): Likewise. + * elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at + R_SPARC_RELATIVE's r_offset. + + 2002-08-07 Thiemo Seufer + * elfxx-mips.c (mips_elf_create_dynamic_relocation): Cast signedness + mismatch. + 2002-10-14 Richard Henderson * elf64-alpha.c (elf64_alpha_relocate_section) [BRSGP]: Increment diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 83e9732a154..70359d658ed 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -2259,8 +2259,8 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* now the fun stuff */ if (bfd_header_big_endian (abfd)) { - r_index = ((bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[0] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[2]); r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) @@ -2268,8 +2268,8 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) } else { - r_index = ((bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[2] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[0]); r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) @@ -2281,9 +2281,9 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* Base relative relocs are always against the symbol table, regardless of the setting of r_extern. r_extern just reflects whether the symbol the reloc is against is local or global. */ - if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) r_extern = 1; if (r_extern && r_index > symcount) @@ -2318,8 +2318,8 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* now the fun stuff */ if (bfd_header_big_endian (abfd)) { - r_index = ((bytes->r_index[0] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[0] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[2]); r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); @@ -2331,8 +2331,8 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) } else { - r_index = ((bytes->r_index[2] << 16) - | (bytes->r_index[1] << 8) + r_index = (((unsigned int) bytes->r_index[2] << 16) + | ((unsigned int) bytes->r_index[1] << 8) | bytes->r_index[0]); r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); @@ -3863,7 +3863,7 @@ NAME(aout,final_link) (abfd, info, callback) for (p = o->link_order_head; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = true; + p->u.indirect.section->linker_mark = (unsigned int) true; } } @@ -4412,7 +4412,7 @@ aout_link_write_symbols (finfo, input_bfd) characters in the symbol names, not including the file numbers in types (the first number after an open parenthesis). */ - if (type == N_BINCL) + if (type == (int) N_BINCL) { struct external_nlist *incl_sym; int nest; @@ -4426,13 +4426,13 @@ aout_link_write_symbols (finfo, input_bfd) int incl_type; incl_type = H_GET_8 (input_bfd, incl_sym->e_type); - if (incl_type == N_EINCL) + if (incl_type == (int) N_EINCL) { if (nest == 0) break; --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) { @@ -4457,7 +4457,7 @@ aout_link_write_symbols (finfo, input_bfd) /* If we have already included a header file with the same value, then replace this one with an N_EXCL symbol. */ - copy = ! finfo->info->keep_memory; + copy = (boolean) (! finfo->info->keep_memory); incl_entry = aout_link_includes_lookup (&finfo->includes, name, true, copy); if (incl_entry == NULL) @@ -4485,7 +4485,7 @@ aout_link_write_symbols (finfo, input_bfd) /* This is a duplicate header file. We must change it to be an N_EXCL entry, and mark all the included symbols to prevent outputting them. */ - type = N_EXCL; + type = (int) N_EXCL; nest = 0; for (incl_sym = sym + 1, incl_map = symbol_map + 1; @@ -4495,7 +4495,7 @@ aout_link_write_symbols (finfo, input_bfd) int incl_type; incl_type = H_GET_8 (input_bfd, incl_sym->e_type); - if (incl_type == N_EINCL) + if (incl_type == (int) N_EINCL) { if (nest == 0) { @@ -4504,7 +4504,7 @@ aout_link_write_symbols (finfo, input_bfd) } --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) *incl_map = -1; @@ -4859,8 +4859,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, if (bfd_header_big_endian (input_bfd)) { - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[0] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[2]); r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); @@ -4872,8 +4872,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, } else { - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[2] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[0]); r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); @@ -5195,8 +5195,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (bfd_header_big_endian (input_bfd)) { - r_index = ((rel->r_index[0] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[0] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[2]); r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) @@ -5204,8 +5204,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, } else { - r_index = ((rel->r_index[2] << 16) - | (rel->r_index[1] << 8) + r_index = (((unsigned int) rel->r_index[2] << 16) + | ((unsigned int) rel->r_index[1] << 8) | rel->r_index[0]); r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) @@ -5221,16 +5221,16 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, /* We are generating a relocateable output file, and must modify the reloc accordingly. */ if (r_extern - || r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + || r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) { /* If we know the symbol this relocation is against, convert it into a relocation against a section. This is what the native linker does. */ - if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) h = NULL; else h = sym_hashes[r_index]; @@ -5398,9 +5398,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, relocation = 0; } } - else if (r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + else if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) { struct external_nlist *sym; int type; @@ -5482,9 +5482,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, to skip this reloc. */ if (hundef && ! finfo->info->shared - && r_type != RELOC_BASE10 - && r_type != RELOC_BASE13 - && r_type != RELOC_BASE22) + && r_type != (unsigned int) RELOC_BASE10 + && r_type != (unsigned int) RELOC_BASE13 + && r_type != (unsigned int) RELOC_BASE22) { const char *name; @@ -5498,7 +5498,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, return false; } - if (r_type != RELOC_SPARC_REV32) + if (r_type != (unsigned int) RELOC_SPARC_REV32) r = MY_final_link_relocate (howto_table_ext + r_type, input_bfd, input_section, contents, r_addr, relocation, @@ -5527,9 +5527,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (h != NULL) name = h->root.root.string; else if (r_extern - || r_type == RELOC_BASE10 - || r_type == RELOC_BASE13 - || r_type == RELOC_BASE22) + || r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); else @@ -5645,7 +5645,7 @@ aout_link_reloc_link_order (finfo, o, p) int r_relative; int r_length; - r_pcrel = howto->pc_relative; + r_pcrel = (int) howto->pc_relative; r_baserel = (howto->type & 8) != 0; r_jmptable = (howto->type & 16) != 0; r_relative = (howto->type & 32) != 0; diff --git a/bfd/archive.c b/bfd/archive.c index d7ac214c724..b051e2aaa33 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -436,12 +436,12 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) spaces, so only look for ' ' if we don't find '/'. */ char *e; - e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd)); + e = (char *) memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd)); if (e == NULL) { - e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)); + e = (char *) memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)); if (e == NULL) - e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd)); + e = (char *) memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd)); } if (e != NULL) diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 807a4408b9f..f0f8cfd2a81 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -346,7 +346,7 @@ typedef struct sec *sec_ptr; #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true) +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index bad428138f9..5589f8551e8 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -352,7 +352,7 @@ typedef struct sec *sec_ptr; #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) -#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true) +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (unsigned int)true), true) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) diff --git a/bfd/bfd.c b/bfd/bfd.c index cfd77726a3e..8037b12491e 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1293,10 +1293,10 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at, m->p_type = type; m->p_flags = flags; m->p_paddr = at; - m->p_flags_valid = flags_valid; - m->p_paddr_valid = at_valid; - m->includes_filehdr = includes_filehdr; - m->includes_phdrs = includes_phdrs; + m->p_flags_valid = (unsigned int) flags_valid; + m->p_paddr_valid = (unsigned int) at_valid; + m->includes_filehdr = (unsigned int) includes_filehdr; + m->includes_phdrs = (unsigned int) includes_phdrs; m->count = count; if (count > 0) memcpy (m->sections, secs, count * sizeof (asection *)); diff --git a/bfd/binary.c b/bfd/binary.c index fc972b22d13..7bddabf5fa8 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -185,7 +185,7 @@ binary_get_symtab (abfd, alocation) syms = (asymbol *) bfd_alloc (abfd, amt); if (syms == NULL) - return false; + return (long) false; /* Start symbol. */ syms[0].the_bfd = abfd; diff --git a/bfd/coffgen.c b/bfd/coffgen.c index ee6c8fce545..21589c6945a 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -2196,7 +2196,7 @@ _bfd_coff_is_local_label_name (abfd, name) bfd *abfd ATTRIBUTE_UNUSED; const char *name; { - return name[0] == '.' && name[1] == 'L'; + return (boolean) (name[0] == '.' && name[1] == 'L'); } /* Provided a BFD, a section and an offset (in bytes, not octets) into the diff --git a/bfd/cofflink.c b/bfd/cofflink.c index eb9388fc71e..c1302ee878a 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -1322,6 +1322,9 @@ mark_relocs (finfo, input_bfd) if ((a->flags & SEC_RELOC) == 0 || a->reloc_count < 1) continue; + /* Don't mark relocs in excluded sections. */ + if (a->output_section == bfd_abs_section_ptr) + continue; /* Read in the relocs. */ internal_relocs = _bfd_coff_read_internal_relocs diff --git a/bfd/config.bfd b/bfd/config.bfd index 184bbef9a2e..0e26ae3588b 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -888,10 +888,12 @@ case "${targ}" in s390-*-linux*) targ_defvec=bfd_elf32_s390_vec + targ64_selvecs=bfd_elf64_s390_vec ;; #ifdef BFD64 s390x-*-linux*) targ_defvec=bfd_elf64_s390_vec + targ_selvecs=bfd_elf32_s390_vec ;; #endif @@ -925,9 +927,11 @@ case "${targ}" in ;; sh*eb-*-linux*) targ_defvec=bfd_elf32_shblin_vec + targ_selvecs=bfd_elf32_shlin_vec ;; sh*-*-linux*) targ_defvec=bfd_elf32_shlin_vec + targ_selvecs=bfd_elf32_shblin_vec ;; #ifdef BFD64 diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 5aadaddf2b1..063982662bc 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -402,7 +402,7 @@ read_indirect_string (unit, buf, bytes_read_ptr) return NULL; } - buf = stash->dwarf_str_buffer + offset; + buf = stash->dwarf_str_buffer + offset; if (*buf == '\0') return NULL; return buf; @@ -578,7 +578,8 @@ read_abbrevs (abfd, offset, stash) /* Read in abbrev header. */ cur_abbrev->number = abbrev_number; - cur_abbrev->tag = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); + cur_abbrev->tag = (enum dwarf_tag) + read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr); abbrev_ptr += 1; @@ -601,8 +602,10 @@ read_abbrevs (abfd, offset, stash) return 0; } - cur_abbrev->attrs[cur_abbrev->num_attrs].name = abbrev_name; - cur_abbrev->attrs[cur_abbrev->num_attrs++].form = abbrev_form; + cur_abbrev->attrs[cur_abbrev->num_attrs].name + = (enum dwarf_attribute) abbrev_name; + cur_abbrev->attrs[cur_abbrev->num_attrs++].form + = (enum dwarf_form) abbrev_form; abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); @@ -614,7 +617,7 @@ read_abbrevs (abfd, offset, stash) abbrevs[hash_number] = cur_abbrev; /* Get next abbreviation. - Under Irix6 the abbreviations for a compilation unit are not + Under Irix6 the abbreviations for a compilation unit are not always properly terminated with an abbrev number of 0. Exit loop if we encounter an abbreviation which we have already read (which means we are about to read the abbreviations @@ -646,7 +649,7 @@ read_attribute_value (attr, form, unit, info_ptr) struct dwarf_block *blk; bfd_size_type amt; - attr->form = form; + attr->form = (enum dwarf_form) form; switch (form) { @@ -806,7 +809,8 @@ struct line_info_table char* comp_dir; char** dirs; struct fileinfo* files; - struct line_info* last_line; + struct line_info* last_line; /* largest VMA */ + struct line_info* lcl_head; /* local head; used in 'add_line_info' */ }; struct funcinfo @@ -817,6 +821,11 @@ struct funcinfo bfd_vma high; }; +/* add_line_info: adds a new entry to the line_info list in the + line_info_table, ensuring that the list is sorted. Note that the + line_info list is sorted from highest to lowest VMA (with possible + duplicates); that is, line_info->prev_line always accesses an equal + or smaller VMA. */ static void add_line_info (table, address, filename, line, column, end_sequence) struct line_info_table* table; @@ -829,9 +838,72 @@ add_line_info (table, address, filename, line, column, end_sequence) bfd_size_type amt = sizeof (struct line_info); struct line_info* info = (struct line_info*) bfd_alloc (table->abfd, amt); - info->prev_line = table->last_line; - table->last_line = info; + /* Find the correct location for 'info'. Normally we will receive + new line_info data 1) in order and 2) with increasing VMAs. + However some compilers break the rules (cf. decode_line_info) and + so we include some heuristics for quickly finding the correct + location for 'info'. In particular, these heuristics optimize for + the common case in which the VMA sequence that we receive is a + list of locally sorted VMAs such as + p...z a...j (where a < j < p < z) + Note: table->lcl_head is used to head an *actual* or *possible* + sequence within the list (such as a...j) that is not directly + headed by table->last_line + + Note: we may receive duplicate entries from 'decode_line_info'. */ + + while (1) + if (!table->last_line + || address >= table->last_line->address) + { + /* Normal case: add 'info' to the beginning of the list */ + info->prev_line = table->last_line; + table->last_line = info; + + /* lcl_head: initialize to head a *possible* sequence at the end. */ + if (!table->lcl_head) + table->lcl_head = info; + break; + } + else if (!table->lcl_head->prev_line + && table->lcl_head->address > address) + { + /* Abnormal but easy: lcl_head is 1) at the *end* of the line + list and 2) the head of 'info'. */ + info->prev_line = NULL; + table->lcl_head->prev_line = info; + break; + } + else if (table->lcl_head->prev_line + && table->lcl_head->address > address + && address >= table->lcl_head->prev_line->address) + { + /* Abnormal but easy: lcl_head is 1) in the *middle* of the line + list and 2) the head of 'info'. */ + info->prev_line = table->lcl_head->prev_line; + table->lcl_head->prev_line = info; + break; + } + else + { + /* Abnormal and hard: Neither 'last_line' nor 'lcl_head' are valid + heads for 'info'. Reset 'lcl_head' and repeat. */ + struct line_info* li2 = table->last_line; /* always non-NULL */ + struct line_info* li1 = li2->prev_line; + + while (li1) + { + if (li2->address > address && address >= li1->address) + break; + + li2 = li1; /* always non-NULL */ + li1 = li1->prev_line; + } + table->lcl_head = li2; + } + + /* Set member data of 'info'. */ info->address = address; info->filename = filename; info->line = line; @@ -908,7 +980,8 @@ arange_add (unit, low_pc, high_pc) } /* Need to allocate a new arange and insert it into the arange list. */ - arange = bfd_zalloc (unit->abfd, (bfd_size_type) sizeof (*arange)); + arange = (struct arange *) + bfd_zalloc (unit->abfd, (bfd_size_type) sizeof (*arange)); arange->low = low_pc; arange->high = high_pc; @@ -982,6 +1055,7 @@ decode_line_info (unit, stash) table->files = NULL; table->last_line = NULL; + table->lcl_head = NULL; line_ptr = stash->dwarf_line_buffer + unit->line_offset; @@ -1091,10 +1165,10 @@ decode_line_info (unit, stash) int basic_block = 0; int end_sequence = 0; /* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some - compilers generate address sequences that are wildly out of - order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler - for ia64-Linux). Thus, to determine the low and high - address, we must compare on every DW_LNS_copy, etc. */ + compilers generate address sequences that are wildly out of + order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler + for ia64-Linux). Thus, to determine the low and high + address, we must compare on every DW_LNS_copy, etc. */ bfd_vma low_pc = 0; bfd_vma high_pc = 0; @@ -1133,12 +1207,11 @@ decode_line_info (unit, stash) end_sequence = 1; add_line_info (table, address, filename, line, column, end_sequence); - arange_add (unit, low_pc, high_pc); if (low_pc == 0 || address < low_pc) low_pc = address; if (address > high_pc) high_pc = address; - arange_add (unit, low_pc, address); + arange_add (unit, low_pc, high_pc); break; case DW_LNE_set_address: address = read_address (unit, line_ptr); @@ -1250,19 +1323,31 @@ lookup_address_in_line_info_table (table, addr, function, filename_ptr, const char **filename_ptr; unsigned int *linenumber_ptr; { + /* Note: table->last_line should be a descendingly sorted list. */ struct line_info* next_line = table->last_line; - struct line_info* each_line; + struct line_info* each_line = NULL; + *filename_ptr = NULL; if (!next_line) return false; each_line = next_line->prev_line; + /* Check for large addresses */ + if (addr > next_line->address) + each_line = NULL; /* ensure we skip over the normal case */ + + /* Normal case: search the list; save */ while (each_line && next_line) { - if (!each_line->end_sequence - && addr >= each_line->address && addr < next_line->address) + /* If we have an address match, save this info. This allows us + to return as good as results as possible for strange debugging + info. */ + boolean addr_match = false; + if (each_line->address <= addr && addr <= next_line->address) { + addr_match = true; + /* If this line appears to span functions, and addr is in the later function, return the first line of that function instead of the last line of the earlier one. This check is for GCC @@ -1279,16 +1364,22 @@ lookup_address_in_line_info_table (table, addr, function, filename_ptr, *filename_ptr = each_line->filename; *linenumber_ptr = each_line->line; } - return true; } + + if (addr_match && !each_line->end_sequence) + return true; /* we have definitely found what we want */ + next_line = each_line; each_line = each_line->prev_line; } - /* At this point each_line is NULL but next_line is not. If we found the - containing function in this compilation unit, return the first line we - have a number for. This is also for compatibility with GCC 2.95. */ - if (function != NULL) + /* At this point each_line is NULL but next_line is not. If we found + a candidate end-of-sequence point in the loop above, we can return + that (compatibility with a bug in the Intel compiler); otherwise, + assuming that we found the containing function for this address in + this compilation unit, return the first line we have a number for + (compatibility with GCC 2.95). */ + if (*filename_ptr == NULL && function != NULL) { *filename_ptr = next_line->filename; *linenumber_ptr = next_line->line; @@ -1646,18 +1737,18 @@ comp_unit_contains_address (unit, addr) struct arange *arange; if (unit->error) - return 0; + return false; arange = &unit->arange; do { if (addr >= arange->low && addr < arange->high) - return 1; + return true; arange = arange->next; } while (arange); - return 0; + return false; } /* If UNIT contains ADDR, set the output parameters to the values for @@ -1702,7 +1793,7 @@ comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr, } if (unit->first_child_die_ptr < unit->end_ptr - && ! scan_unit_for_functions (unit)) + && ! scan_unit_for_functions (unit)) { unit->error = 1; return false; @@ -1715,7 +1806,7 @@ comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr, line_p = lookup_address_in_line_info_table (unit->line_table, addr, function, filename_ptr, linenumber_ptr); - return line_p || func_p; + return (boolean) (line_p || func_p); } /* Locate a section in a BFD containing debugging info. The search starts @@ -1822,7 +1913,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, return false; /* There can be more than one DWARF2 info section in a BFD these days. - Read them all in and produce one large stash. We do this in two + Read them all in and produce one large stash. We do this in two passes - in the first pass we just accumulate the section sizes. In the second pass we read in the section's contents. The allows us to avoid reallocing the data as we add sections to the stash. */ @@ -1918,7 +2009,7 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, stash->info_ptr += addr_size; if (length > 0) - { + { each = parse_comp_unit (abfd, stash, length, offset_size); stash->info_ptr += length; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index d52d5a7db4d..9fd9f502c14 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2616,36 +2616,40 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (rel->r_offset >= 1); val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); - if (val != 0xa1) - { - BFD_ASSERT (rel->r_offset >= 2); - type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); - } if (val == 0xa1) { /* movl foo, %eax. */ - bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 2); - } - else if (type == 0x8b) - { - /* movl */ - BFD_ASSERT ((val & 0xc7) == 0x05); - bfd_put_8 (output_bfd, 0xc7, - contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), - contents + rel->r_offset - 1); + bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 1); } - else if (type == 0x03) + else { - /* addl */ - BFD_ASSERT ((val & 0xc7) == 0x05); - bfd_put_8 (output_bfd, 0x81, - contents + rel->r_offset - 2); - bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), - contents + rel->r_offset - 1); + BFD_ASSERT (rel->r_offset >= 2); + type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + switch (type) + { + case 0x8b: + /* movl */ + BFD_ASSERT ((val & 0xc7) == 0x05); + bfd_put_8 (output_bfd, 0xc7, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, + 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + break; + case 0x03: + /* addl */ + BFD_ASSERT ((val & 0xc7) == 0x05); + bfd_put_8 (output_bfd, 0x81, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, + 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + break; + default: + BFD_FAIL (); + break; + } } - else - BFD_FAIL (); bfd_put_32 (output_bfd, -tpoff (info, relocation), contents + rel->r_offset); continue; diff --git a/bfd/elf32-i386qnx.c b/bfd/elf32-i386qnx.c index 5f2e1113f4c..9894f3759ae 100644 --- a/bfd/elf32-i386qnx.c +++ b/bfd/elf32-i386qnx.c @@ -102,7 +102,9 @@ elf_i386qnx_set_nonloadable_filepos (abfd, phdrs) } #undef TARGET_LITTLE_SYM -#define TARGET_LITTLE_SYM bfd_elf32_i386qnx_vec +#define TARGET_LITTLE_SYM bfd_elf32_i386qnx_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-i386-nto" #define elf_backend_set_nonloadable_filepos elf_i386qnx_set_nonloadable_filepos #define elf_backend_is_contained_by_filepos elf_i386qnx_is_contained_by_filepos diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index ed426b9e1f6..841c42a687f 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -3388,6 +3388,8 @@ struct elf_sh_link_hash_entry /* Track dynamic relocs copied for this symbol. */ struct elf_sh_dyn_relocs *dyn_relocs; + + bfd_signed_vma gotplt_refcount; }; /* sh ELF linker hash table. */ @@ -3452,6 +3454,7 @@ sh_elf_link_hash_newfunc (entry, table, string) eh = (struct elf_sh_link_hash_entry *) ret; eh->dyn_relocs = NULL; + eh->gotplt_refcount = 0; #ifdef INCLUDE_SHMEDIA ret->datalabel_got_offset = (bfd_vma) -1; #endif @@ -3870,6 +3873,18 @@ allocate_dynrelocs (h, inf) info = (struct bfd_link_info *) inf; htab = sh_elf_hash_table (info); + eh = (struct elf_sh_link_hash_entry *) h; + if ((h->got.refcount > 0 + || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) + && eh->gotplt_refcount > 0) + { + /* The symbol has been forced local, or we have some direct got refs, + so treat all the gotplt refs as got refs. */ + h->got.refcount += eh->gotplt_refcount; + if (h->plt.refcount >= eh->gotplt_refcount) + h->plt.refcount -= eh->gotplt_refcount; + } + if (htab->root.dynamic_sections_created && h->plt.refcount > 0) { @@ -3964,7 +3979,6 @@ allocate_dynrelocs (h, inf) else h->got.offset = (bfd_vma) -1; - eh = (struct elf_sh_link_hash_entry *) h; if (eh->dyn_relocs == NULL) return true; @@ -5198,6 +5212,7 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs) const Elf_Internal_Rela *rel, *relend; unsigned long r_symndx; struct elf_link_hash_entry *h; + struct elf_sh_link_hash_entry *eh; elf_section_data (sec)->local_dynrel = NULL; @@ -5300,10 +5315,15 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs) if (r_symndx >= symtab_hdr->sh_info) { h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->got.refcount > 0) + eh = (struct elf_sh_link_hash_entry *) h; + if (eh->gotplt_refcount > 0) + { + eh->gotplt_refcount -= 1; + if (h->plt.refcount > 0) + h->plt.refcount -= 1; + } + else if (h->got.refcount > 0) h->got.refcount -= 1; - if (h->plt.refcount > 0) - h->plt.refcount -= 1; } else if (local_got_refcounts != NULL) { @@ -5363,6 +5383,8 @@ sh_elf_copy_indirect_symbol (bed, dir, ind) edir->dyn_relocs = eind->dyn_relocs; eind->dyn_relocs = NULL; } + edir->gotplt_refcount = eind->gotplt_refcount; + eind->gotplt_refcount = 0; _bfd_elf_link_hash_copy_indirect (bed, dir, ind); } @@ -5537,6 +5559,7 @@ sh_elf_check_relocs (abfd, info, sec, relocs) h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; h->plt.refcount += 1; + ((struct elf_sh_link_hash_entry *) h)->gotplt_refcount += 1; break; diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 38200dc04bf..b6cf7ebb579 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1298,7 +1298,6 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, off &= ~1; else { - bfd_put_32 (output_bfd, relocation, sgot->contents + off); if (info->shared) { @@ -1314,7 +1313,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, + sgot->output_offset + off); outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); - outrel.r_addend = 0; + outrel.r_addend = relocation; + relocation = 0; bfd_elf32_swap_reloca_out (output_bfd, &outrel, (((Elf32_External_Rela *) srelgot->contents) @@ -1322,6 +1322,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, ++srelgot->reloc_count; } + bfd_put_32 (output_bfd, relocation, sgot->contents + off); local_got_offsets[r_symndx] |= 1; } } @@ -1827,14 +1828,21 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym) if (info->shared && (info->symbolic || h->dynindx == -1) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); + { + asection *sec = h->root.u.def.section; + rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); + rela.r_addend = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } else { - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); + rela.r_addend = 0; } - rela.r_addend = 0; + bfd_put_32 (output_bfd, (bfd_vma) 0, + sgot->contents + (h->got.offset &~ (bfd_vma) 1)); bfd_elf32_swap_reloca_out (output_bfd, &rela, ((Elf32_External_Rela *) srela->contents + srela->reloc_count)); diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index e7145f12221..0ff087449df 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -419,6 +419,11 @@ struct elf_vax_link_hash_table static boolean elf_vax_discard_copies PARAMS ((struct elf_vax_link_hash_entry *, PTR)); +/* Declare this now that the above structures are defined. */ + +static boolean elf_vax_instantiate_got_entries + PARAMS ((struct elf_link_hash_entry *, PTR)); + /* Traverse an VAX ELF linker hash table. */ #define elf_vax_link_hash_traverse(table, func, info) \ @@ -569,7 +574,6 @@ elf_vax_check_relocs (abfd, info, sec, relocs) bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; asection *sgot; @@ -582,7 +586,6 @@ elf_vax_check_relocs (abfd, info, sec, relocs) dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); sgot = NULL; srelgot = NULL; @@ -653,18 +656,6 @@ elf_vax_check_relocs (abfd, info, sec, relocs) { h->got.refcount = 1; eh->got_addend = rel->r_addend; - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (!bfd_elf32_link_record_dynamic_symbol (info, h)) - return false; - } - - /* Allocate space in the .got section. */ - sgot->_raw_size += 4; - /* Allocate relocation space. */ - srelgot->_raw_size += sizeof (Elf32_External_Rela); } else { @@ -902,25 +893,18 @@ elf_vax_gc_sweep_hook (abfd, info, sec, relocs) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; unsigned long r_symndx; struct elf_link_hash_entry *h; bfd *dynobj; - asection *sgot; - asection *srelgot; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); dynobj = elf_hash_table (info)->dynobj; if (dynobj == NULL) return true; - sgot = bfd_get_section_by_name (dynobj, ".got"); - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) { @@ -932,29 +916,7 @@ elf_vax_gc_sweep_hook (abfd, info, sec, relocs) { h = sym_hashes[r_symndx - symtab_hdr->sh_info]; if (h->got.refcount > 0) - { - --h->got.refcount; - if (h->got.refcount == 0) - { - /* We don't need the .got entry any more. */ - sgot->_raw_size -= 4; - srelgot->_raw_size -= sizeof (Elf32_External_Rela); - } - } - } - else if (local_got_refcounts != NULL) - { - if (local_got_refcounts[r_symndx] > 0) - { - --local_got_refcounts[r_symndx]; - if (local_got_refcounts[r_symndx] == 0) - { - /* We don't need the .got entry any more. */ - sgot->_raw_size -= 4; - if (info->shared) - srelgot->_raw_size -= sizeof (Elf32_External_Rela); - } - } + --h->got.refcount; } break; @@ -1221,8 +1183,15 @@ elf_vax_size_dynamic_sections (output_bfd, info) fill them in in the relocate_section routine. */ if (info->shared && info->symbolic) elf_vax_link_hash_traverse (elf_vax_hash_table (info), - elf_vax_discard_copies, - (PTR) NULL); + elf_vax_discard_copies, + (PTR) NULL); + + /* If this is a -Bsymbolic shared link or a static link, we need to + discard all the got entries we've recorded. Otherwise, we need to + instantiate (allocate space for them). */ + elf_link_hash_traverse (elf_hash_table (info), + elf_vax_instantiate_got_entries, + (PTR) info); /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate @@ -1392,6 +1361,60 @@ elf_vax_discard_copies (h, ignore) return true; } +/* This function is called via elf_link_hash_traverse. It looks for entries + that have GOT or PLT (.GOT) references. If creating a static object or a + shared object with -Bsymbolic, it resets the reference count back to 0 + and sets the offset to -1 so normal PC32 relocation will be done. If + creating a shared object or executable, space in the .got and .rela.got + will be reserved for the symbol. */ + +/*ARGSUSED*/ +static boolean +elf_vax_instantiate_got_entries (h, infoptr) + struct elf_link_hash_entry *h; + PTR infoptr; +{ + struct bfd_link_info *info = (struct bfd_link_info *) infoptr; + bfd *dynobj; + asection *sgot; + asection *srelgot; + + /* We don't care about non-GOT (and non-PLT) entries. */ + if (h->got.refcount <= 0 && h->plt.refcount <= 0) + return true; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj == NULL) + return true; + + sgot = bfd_get_section_by_name (dynobj, ".got"); + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + + if (!elf_hash_table (info)->dynamic_sections_created + || (info->shared && info->symbolic)) + { + h->got.refcount = 0; + h->got.offset = (bfd_vma) -1; + h->plt.refcount = 0; + h->plt.offset = (bfd_vma) -1; + } + else if (h->got.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1) + { + if (!bfd_elf32_link_record_dynamic_symbol (info, h)) + return false; + } + + /* Allocate space in the .got and .rela.got sections. */ + sgot->_raw_size += 4; + srelgot->_raw_size += sizeof (Elf32_External_Rela); + } + + return true; +} + /* Relocate an VAX ELF section. */ static boolean @@ -1556,8 +1579,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, case R_VAX_GOT32: /* Relocation is to the address of the entry for this symbol in the global offset table. */ - if (h != NULL - && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + if (h == NULL || h->got.offset == (bfd_vma) -1) break; /* Relocation is the offset of the entry for this symbol in @@ -1566,18 +1588,6 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, { bfd_vma off; - if (!elf_hash_table (info)->dynamic_sections_created - || (h == NULL) - || (info->shared - && info->symbolic - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a -Bsymbolic link - and the symbol is defined locally or there is no symbol. - Change the GOT32 entry to a PC32 entry. */ - break; - } - if (sgot == NULL) { sgot = bfd_get_section_by_name (dynobj, ".got"); @@ -1587,6 +1597,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (h != NULL); off = h->got.offset; BFD_ASSERT (off != (bfd_vma) -1); + BFD_ASSERT (off < sgot->_raw_size); if (info->shared && h->dynindx == -1 @@ -1615,15 +1626,12 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, } relocation = sgot->output_offset + off; - /* Neither GOT relocation uses the addend. */ + /* The GOT relocation uses the addend. */ rel->r_addend = 0; - if (r_type == R_VAX_GOT32) - { - /* Change the reference to be indirect */ - contents[rel->r_offset - 1] |= 0x10; - relocation += sgot->output_section->vma; - } + /* Change the reference to be indirect. */ + contents[rel->r_offset - 1] |= 0x10; + relocation += sgot->output_section->vma; } break; @@ -1847,11 +1855,11 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section, break; } - /* VAX PCREL relocations are from the end of relocation, not the start */ + /* VAX PCREL relocations are from the end of relocation, not the start. + So subtract the difference from the relocation amount since we can't + add it to the offset. */ if (howto->pc_relative && howto->pcrel_offset) - { - relocation -= bfd_get_reloc_size(howto); - } + relocation -= bfd_get_reloc_size(howto); r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, rel->r_offset, diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 1058a1c269e..7397ed1b814 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3100,7 +3100,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) case R_ALPHA_REFLONG: case R_ALPHA_REFQUAD: - if (info->shared || maybe_dynamic) + if ((info->shared && (sec->flags & SEC_ALLOC)) || maybe_dynamic) need = NEED_DYNREL; break; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index def93c41fe0..920b481bf80 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -2744,11 +2744,12 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym) } else { - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); rela.r_addend = 0; } + bfd_put_64 (output_bfd, (bfd_vma) 0, + sgot->contents + (h->got.offset &~ (bfd_vma) 1)); bfd_elf64_swap_reloca_out (output_bfd, &rela, ((Elf64_External_Rela *) srela->contents + srela->reloc_count)); diff --git a/bfd/elflink.h b/bfd/elflink.h index cf5aff6e522..fd1c563d008 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -1298,6 +1298,14 @@ elf_link_add_object_symbols (abfd, info) const char *name; bfd_size_type oldsize; bfd_size_type strindex; + struct bfd_link_needed_list *rpath = NULL, *runpath = NULL; + + /* ld --just-symbols and dynamic objects don't mix very well. + Test for --just-symbols by looking at info set up by + _bfd_elf_link_just_syms. */ + if ((s = abfd->sections) != NULL + && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) + goto error_return; /* Find the name to use in a DT_NEEDED entry that refers to this object. If the object has a DT_SONAME entry, we use it. @@ -1327,8 +1335,6 @@ elf_link_add_object_symbols (abfd, info) Elf_External_Dyn *extdynend; int elfsec; unsigned long shlink; - int rpath; - int runpath; dynbuf = (Elf_External_Dyn *) bfd_malloc (s->_raw_size); if (dynbuf == NULL) @@ -1345,8 +1351,6 @@ elf_link_add_object_symbols (abfd, info) extdyn = dynbuf; extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn); - rpath = 0; - runpath = 0; for (; extdyn < extdynend; extdyn++) { Elf_Internal_Dyn dyn; @@ -1390,13 +1394,6 @@ elf_link_add_object_symbols (abfd, info) char *fnm, *anm; unsigned int tagv = dyn.d_un.d_val; - /* When we see DT_RPATH before DT_RUNPATH, we have - to clear runpath. Do _NOT_ bfd_release, as that - frees all more recently bfd_alloc'd blocks as - well. */ - if (rpath && hash_table->runpath) - hash_table->runpath = NULL; - amt = sizeof (struct bfd_link_needed_list); n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv); @@ -1410,13 +1407,11 @@ elf_link_add_object_symbols (abfd, info) n->name = anm; n->by = abfd; n->next = NULL; - for (pn = & hash_table->runpath; + for (pn = & runpath; *pn != NULL; pn = &(*pn)->next) ; *pn = n; - runpath = 1; - rpath = 0; } /* Ignore DT_RPATH if we have seen DT_RUNPATH. */ if (!runpath && dyn.d_tag == DT_RPATH) @@ -1442,18 +1437,32 @@ elf_link_add_object_symbols (abfd, info) n->name = anm; n->by = abfd; n->next = NULL; - for (pn = & hash_table->runpath; + for (pn = & rpath; *pn != NULL; pn = &(*pn)->next) ; *pn = n; - rpath = 1; } } free (dynbuf); } + /* DT_RUNPATH overrides DT_RPATH. Do _NOT_ bfd_release, as that + frees all more recently bfd_alloc'd blocks as well. */ + if (runpath) + rpath = runpath; + + if (rpath) + { + struct bfd_link_needed_list **pn; + for (pn = & hash_table->runpath; + *pn != NULL; + pn = &(*pn)->next) + ; + *pn = rpath; + } + /* We do not want to include any of the sections in a dynamic object in the output file. We hack by simply clobbering the list of sections in the BFD. This could be handled more diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 88c59885abe..043c11bbb46 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -2937,7 +2937,12 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec, /* The relocation is always an REL32 relocation because we don't know where the shared library will wind up at load-time. */ - outrel[0].r_info = ELF_R_INFO (output_bfd, indx, R_MIPS_REL32); + outrel[0].r_info = ELF_R_INFO (output_bfd, (unsigned long) indx, + R_MIPS_REL32); + outrel[1].r_info = ELF_R_INFO (output_bfd, (unsigned long) 0, + R_MIPS_NONE); + outrel[2].r_info = ELF_R_INFO (output_bfd, (unsigned long) 0, + R_MIPS_NONE); /* Adjust the output offset of the relocation to reference the correct location in the output file. */ diff --git a/bfd/format.c b/bfd/format.c index 1efa9e24547..ef6b46edfb8 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -132,7 +132,7 @@ bfd_check_format_matches (abfd, format, matching) } if (abfd->format != bfd_unknown) - return abfd->format == format; + return (boolean) (abfd->format == format); /* Since the target type was defaulted, check them all in the hope that one will be uniquely recognized. */ @@ -355,7 +355,7 @@ bfd_set_format (abfd, format) } if (abfd->format != bfd_unknown) - return abfd->format == format; + return (boolean) (abfd->format == format); /* Presume the answer is yes. */ abfd->format = format; diff --git a/bfd/gen-aout.c b/bfd/gen-aout.c index 1bba14adb5b..b6720e87dc9 100644 --- a/bfd/gen-aout.c +++ b/bfd/gen-aout.c @@ -21,6 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "/usr/include/a.out.h" #include +#ifndef _ +#define _(X) X +#endif + int main (argc, argv) int argc; char** argv; diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 29170a0d561..f21abbcd6ce 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -186,9 +186,9 @@ bfd_realloc (ptr, size) } if (ptr == NULL) - ret = malloc ((size_t) size); + ret = (PTR) malloc ((size_t) size); else - ret = realloc (ptr, (size_t) size); + ret = (PTR) realloc (ptr, (size_t) size); if (ret == NULL && (size_t) size != 0) bfd_set_error (bfd_error_no_memory); @@ -562,7 +562,7 @@ bfd_bwrite (ptr, size, abfd) newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { - bim->buffer = bfd_realloc (bim->buffer, newsize); + bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize); if (bim->buffer == 0) { bim->size = 0; @@ -608,7 +608,7 @@ bfd_write_bigendian_4byte_int (abfd, i) { bfd_byte buffer[4]; bfd_putb32 ((bfd_vma) i, buffer); - return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4; + return (boolean) (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4); } bfd_vma @@ -706,7 +706,7 @@ bfd_seek (abfd, position, direction) newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { - bim->buffer = bfd_realloc (bim->buffer, newsize); + bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize); if (bim->buffer == 0) { bim->size = 0; @@ -1414,7 +1414,7 @@ bfd_generic_is_local_label_name (abfd, name) { char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.'; - return (name[0] == locals_prefix); + return (boolean) (name[0] == locals_prefix); } /* Can be used from / for bfd_merge_private_bfd_data to check that diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 88b09098296..ea9c5700b1f 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -784,7 +784,7 @@ typedef struct struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *)); - boolean (*_bfd_coff_adjust_symndx)\ + boolean (*_bfd_coff_adjust_symndx) PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, boolean *)); diff --git a/bfd/linker.c b/bfd/linker.c index e44ac6c6c9d..a5ded1f5883 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -449,7 +449,8 @@ _bfd_link_hash_newfunc (entry, table, string) subclass. */ if (entry == NULL) { - entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)); + entry = (struct bfd_hash_entry *) + bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)); if (entry == NULL) return entry; } @@ -645,8 +646,8 @@ _bfd_generic_link_hash_newfunc (entry, table, string) subclass. */ if (entry == NULL) { - entry = bfd_hash_allocate (table, - sizeof (struct generic_link_hash_entry)); + entry = (struct bfd_hash_entry *) + bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry)); if (entry == NULL) return entry; } @@ -2019,7 +2020,7 @@ _bfd_generic_final_link (abfd, info) for (o = abfd->sections; o != NULL; o = o->next) for (p = o->link_order_head; p != NULL; p = p->next) if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = true; + p->u.indirect.section->linker_mark = (unsigned int) true; /* Build the output symbol table. */ for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) diff --git a/bfd/merge.c b/bfd/merge.c index ce61207251f..9dc2e708344 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -353,7 +353,7 @@ sec_merge_emit (abfd, entry) if (alignment_power) free (pad); - return entry == NULL || entry->secinfo != secinfo; + return (boolean) (entry == NULL || entry->secinfo != secinfo); } /* This function is called for each input file from the add_symbols @@ -667,7 +667,7 @@ merge_strings (sinfo) break; if (e->len > 4 * e->u.entsize) { - s = e->root.string + e->len - e->u.entsize; + s = (const unsigned char *) (e->root.string + e->len - e->u.entsize); hash = 0; for (i = 0; i < 4 * e->u.entsize; i++) { @@ -690,7 +690,7 @@ merge_strings (sinfo) else *p = (PTR) e; } - s = e->root.string + e->len - e->u.entsize; + s = (const unsigned char *) (e->root.string + e->len - e->u.entsize); hash = 0; for (i = 0; i < e->u.entsize; i++) { diff --git a/bfd/reloc.c b/bfd/reloc.c index 59f7819d635..01ff516da59 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -3574,7 +3574,7 @@ const char * bfd_get_reloc_code_name (code) bfd_reloc_code_real_type code; { - if (code > BFD_RELOC_UNUSED) + if ((int) code > (int) BFD_RELOC_UNUSED) return 0; return bfd_reloc_code_real_names[(int)code]; } @@ -3702,7 +3702,7 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, /* We're not relaxing the section, so just copy the size info. */ input_section->_cooked_size = input_section->_raw_size; - input_section->reloc_done = true; + input_section->reloc_done = (unsigned int) true; reloc_count = bfd_canonicalize_reloc (input_bfd, input_section, diff --git a/bfd/section.c b/bfd/section.c index 51b21c70fbb..b5871e9bbfa 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -643,7 +643,8 @@ bfd_section_hash_newfunc (entry, table, string) subclass. */ if (entry == NULL) { - entry = bfd_hash_allocate (table, sizeof (struct section_hash_entry)); + entry = (struct bfd_hash_entry *) + bfd_hash_allocate (table, sizeof (struct section_hash_entry)); if (entry == NULL) return entry; } @@ -1186,7 +1187,7 @@ bfd_set_section_contents (abfd, section, location, offset, count) /* Record a copy of the data in memory if desired. */ if (section->contents - && location != section->contents + offset) + && location != (PTR) (section->contents + offset)) memcpy (section->contents + offset, location, (size_t) count); if (BFD_SEND (abfd, _bfd_set_section_contents, diff --git a/bfd/srec.c b/bfd/srec.c index 129b2ba4bb5..6c29fa16881 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -181,7 +181,7 @@ unsigned int Chunk = DEFAULT_CHUNK; /* The type of srec output (free or forced to S3). This variable can be modified by objcopy's --srec-forceS3 parameter. */ -boolean S3Forced = 0; +boolean S3Forced = false; /* When writing an S-record file, the S-records can not be output as they are seen. This structure is used to hold them in memory. */ @@ -1203,7 +1203,7 @@ srec_get_symtab (abfd, alocation) csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol)); if (csymbols == NULL && symcount != 0) - return false; + return (long) false; abfd->tdata.srec_data->csymbols = csymbols; for (s = abfd->tdata.srec_data->symbols, c = csymbols; diff --git a/bfd/stabs.c b/bfd/stabs.c index e225d9cd60d..0cb37412983 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -331,7 +331,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) symbol, ignoring nesting, adding up all the characters in the symbol names, not including the file numbers in types (the first number after an open parenthesis). */ - if (type == N_BINCL) + if (type == (int) N_BINCL) { bfd_vma val; int nest; @@ -351,13 +351,13 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) incl_type = incl_sym[TYPEOFF]; if (incl_type == 0) break; - else if (incl_type == N_EINCL) + else if (incl_type == (int) N_EINCL) { if (nest == 0) break; --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) { @@ -400,7 +400,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) goto error_return; ne->offset = sym - stabbuf; ne->val = val; - ne->type = N_BINCL; + ne->type = (int) N_BINCL; ne->next = secinfo->excls; secinfo->excls = ne; @@ -422,7 +422,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) /* We have seen this header file before. Tell the final pass to change the type to N_EXCL. */ - ne->type = N_EXCL; + ne->type = (int) N_EXCL; /* Mark the skipped symbols. */ @@ -435,7 +435,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) incl_type = incl_sym[TYPEOFF]; - if (incl_type == N_EINCL) + if (incl_type == (int) N_EINCL) { if (nest == 0) { @@ -445,7 +445,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) } --nest; } - else if (incl_type == N_BINCL) + else if (incl_type == (int) N_BINCL) ++nest; else if (nest == 0) { @@ -597,7 +597,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, type = sym[TYPEOFF]; - if (type == N_FUN) + if (type == (int) N_FUN) { int strx = bfd_get_32 (abfd, sym + STRDXOFF); @@ -624,7 +624,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, else if (deleting == -1) { /* Outside of a function. Check for deleted variables. */ - if (type == N_STSYM || type == N_LCSYM) + if (type == (int) N_STSYM || type == (int) N_LCSYM) if ((*reloc_symbol_deleted_p) (sym + VALOFF - stabbuf, cookie)) { *pstridx = -1; @@ -674,7 +674,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, BFD_ASSERT (offset != 0); } - return (skip > 0); + return (boolean) (skip > 0); error_return: if (stabbuf != NULL) diff --git a/bfd/syms.c b/bfd/syms.c index 8a8abf45387..da71d80b7b7 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -713,7 +713,7 @@ boolean bfd_is_undefined_symclass (symclass) int symclass; { - return symclass == 'U' || symclass == 'w' || symclass == 'v'; + return (boolean) (symclass == 'U' || symclass == 'w' || symclass == 'v'); } /* @@ -1069,7 +1069,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, saw_fun = 1; for (stab = info->stabs; stab < info->stabs + stabsize; stab += STABSIZE) { - if (stab[TYPEOFF] == N_SO) + if (stab[TYPEOFF] == (bfd_byte) N_SO) { /* N_SO with null name indicates EOF */ if (bfd_get_32 (abfd, stab + STRDXOFF) == 0) @@ -1083,12 +1083,12 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, /* two N_SO's in a row is a filename and directory. Skip */ if (stab + STABSIZE < info->stabs + stabsize - && *(stab + STABSIZE + TYPEOFF) == N_SO) + && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO) { stab += STABSIZE; } } - else if (stab[TYPEOFF] == N_FUN) + else if (stab[TYPEOFF] == (bfd_byte) N_FUN) { saw_fun = 1; ++info->indextablesize; @@ -1157,7 +1157,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, { last_stab = stab; if (stab + STABSIZE >= info->stabs + stabsize - || *(stab + STABSIZE + TYPEOFF) != N_SO) + || *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO) { directory_name = NULL; } diff --git a/bfd/targets.c b/bfd/targets.c index d41edf64668..3042b5a6349 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -1249,7 +1249,9 @@ bfd_target_list () return NULL; for (target = &bfd_target_vector[0]; *target != NULL; target++) - *(name_ptr++) = (*target)->name; + if (target == &bfd_target_vector[0] + || *target != bfd_target_vector[0]) + *name_ptr++ = (*target)->name; return name_list; } diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 110f3ab3e2d..8cedab7d095 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,15 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-21 Alan Modra + * bucomm.c (list_supported_targets): Use bfd_target_list. + + 2002-10-09 Daniel Jacobowitz + * readelf.c (display_debug_info): Ignore empty .rela.debug_info + sections. Allow relocations against the absolute symbol. Don't + use the value in compunit.cu_abbrev_offset if we found a RELA + relocation. + 2002-10-21 Svein E. Seldal * objdump.c (dump_data): Correct addr_offset for opb != 1. diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 35112fc7166..7ffcabaf946 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -128,16 +128,18 @@ list_supported_targets (name, f) const char *name; FILE *f; { - extern const bfd_target *const *bfd_target_vector; int t; + const char **targ_names = bfd_target_list (); if (name == NULL) fprintf (f, _("Supported targets:")); else fprintf (f, _("%s: supported targets:"), name); - for (t = 0; bfd_target_vector[t] != NULL; t++) - fprintf (f, " %s", bfd_target_vector[t]->name); + + for (t = 0; targ_names[t] != NULL; t++) + fprintf (f, " %s", targ_names[t]); fprintf (f, "\n"); + free (targ_names); } /* List the supported architectures. */ diff --git a/binutils/readelf.c b/binutils/readelf.c index e053cbaecb1..d39703291eb 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -7949,7 +7949,8 @@ display_debug_info (section, start, file) Elf_Internal_Sym *sym; if (relsec->sh_type != SHT_RELA - || SECTION_HEADER (relsec->sh_info) != section) + || SECTION_HEADER (relsec->sh_info) != section + || relsec->sh_size == 0) continue; if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size, @@ -7970,7 +7971,8 @@ display_debug_info (section, start, file) { sym = symtab + ELF32_R_SYM (rp->r_info); - if (ELF32_ST_TYPE (sym->st_info) != STT_SECTION) + if (ELF32_R_SYM (rp->r_info) != 0 + && ELF32_ST_TYPE (sym->st_info) != STT_SECTION) { warn (_("Skipping unexpected symbol type %u\n"), ELF32_ST_TYPE (sym->st_info)); @@ -7981,7 +7983,8 @@ display_debug_info (section, start, file) { sym = symtab + ELF64_R_SYM (rp->r_info); - if (ELF64_ST_TYPE (sym->st_info) != STT_SECTION) + if (ELF64_R_SYM (rp->r_info) != 0 + && ELF64_ST_TYPE (sym->st_info) != STT_SECTION) { warn (_("Skipping unexpected symbol type %u\n"), ELF64_ST_TYPE (sym->st_info)); @@ -7989,7 +7992,7 @@ display_debug_info (section, start, file) } } - compunit.cu_abbrev_offset += rp->r_addend; + compunit.cu_abbrev_offset = rp->r_addend; break; } diff --git a/gas/ChangeLog b/gas/ChangeLog index 7a662d8a5f5..e15df7a9150 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,23 @@ +2002-08-24 Andreas Schwab + + * config/tc-m68k.c (tc_m68k_fix_adjustable): Don't adjust symbols + in merge sections. + +2002-10-28 Daniel Jacobowitz + + * doc/gasp.texi: Fix typo in last typo fix. + +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-21 Richard Sandiford + * config/tc-mips.c (mips_need_elf_addend_fixup): Return true + for relocs against symbols in a merged section. + + Thu Oct 10 14:31:30 2002 J"orn Rennecke + * config/tc-sh.c (assemble_ppi): Initialize reg_x / reg_y / reg_n + inside loop. + 2002-10-17 Johannes Stezenbach * itbl-parse.y (entry): Provide empty action. diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 111fab732fe..a98f5264538 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -848,6 +848,10 @@ tc_m68k_fix_adjustable (fixP) if (! relaxable_symbol (fixP->fx_addsy)) return 0; + /* Don't adjust symbols in merge sections. */ + if ((S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0) + return 0; + /* adjust_reloc_syms doesn't know about the GOT */ switch (fixP->fx_r_type) { diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 4b5858456a7..34a44b8933e 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -10954,7 +10954,7 @@ mips_need_elf_addend_fixup (fixP) if (symbol_used_in_reloc_p (fixP->fx_addsy) && (((bfd_get_section_flags (stdoutput, S_GET_SEGMENT (fixP->fx_addsy)) - & SEC_LINK_ONCE) != 0) + & (SEC_LINK_ONCE | SEC_MERGE)) != 0) || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)), ".gnu.linkonce", sizeof (".gnu.linkonce") - 1))) diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 3faa94cdfee..1361cb8d515 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -2122,16 +2122,16 @@ assemble_ppi (op_end, opcode) int move_code; unsigned int size; - /* Some insn ignore one or more register fields, e.g. psts machl,a0. - Make sure we encode a defined insn pattern. */ - reg_x = 0; - reg_y = 0; - reg_n = 0; - for (;;) { sh_operand_info operand[3]; + /* Some insn ignore one or more register fields, e.g. psts machl,a0. + Make sure we encode a defined insn pattern. */ + reg_x = 0; + reg_y = 0; + reg_n = 0; + if (opcode->arg[0] != A_END) op_end = get_operands (opcode, op_end, operand); opcode = get_specific (opcode, operand); diff --git a/gas/doc/gasp.texi b/gas/doc/gasp.texi index fe48742be61..889e997105c 100644 --- a/gas/doc/gasp.texi +++ b/gas/doc/gasp.texi @@ -110,7 +110,7 @@ output. @emph{Note} The use of @sc{gasp} has now been deprecated. Anything that it could do can now be done by the macro facilities built into -@sc{gas} itself. At some point in the future the sc@{gasp} sources will +@sc{gas} itself. At some point in the future the @sc{gasp} sources will be removed entirely from the binutils distribution. Here is a small example to give the flavor of @sc{gasp}. This input to diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index a510cfe968f..8cf3abeb853 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-21 Richard Sandiford + * gas/mips/elf-rel7.[sd]: New test. + * gas/mips/mips.exp: Run it. + 2002-09-23 Daniel Jacobowitz Merge from mainline: diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 8e415ef6ed5..26c4f40315d 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -207,6 +207,7 @@ if { [istarget mips*-*-*] } then { } run_dump_test "elf-rel5" run_dump_test "elf-rel6" + run_dump_test "elf-rel7" run_dump_test "${tmips}${el}empic" run_dump_test "empic2" run_dump_test "empic3_e" diff --git a/include/ChangeLog b/include/ChangeLog index 786e08bcd07..2353d992112 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,11 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-24 Nathan Tallent + * ansidecl.h (__STDC__): Add (__alpha && __cplusplus) to the + list of platform compilers that may look, smell and act + like __STDC__ but that may not define it. + 2002-09-23 Daniel Jacobowitz Merge from mainline: diff --git a/include/ansidecl.h b/include/ansidecl.h index 9a7c5777ff2..d169b4f50ed 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -136,10 +136,13 @@ So instead we use the macro below and test it against specific values. */ #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) #endif /* GCC_VERSION */ -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) +#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) || (defined(__alpha) && defined(__cplusplus)) /* All known AIX compilers implement these things (but don't always define __STDC__). The RISC/OS MIPS compiler defines these things in SVR4 mode, but does not define __STDC__. */ +/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other + C++ compilers, does not define __STDC__, though it acts as if this + was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */ #define ANSI_PROTOTYPES 1 #define PTR void * diff --git a/ld/ChangeLog b/ld/ChangeLog index 0689c01e006..81e45aec6c5 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,57 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-23 Jakub Jelinek + * emultempl/elf32.em (place_orphan): Don't put non-allocated .rel* + sections into .rel{,a}.dyn. + + 2002-10-21 Danny Smith + * scripttempl/pe.sc (__RUNTIME_PSEUDO_RELOC_LIST__, + __RUNTIME_PSEUDO_RELOC_LIST_END__): Add only when relocating. + + 2002-10-16 Jakub Jelinek + * configure.tgt (s390x-*-linux*): Add elf_s390 emulation. + (s390-*-linux*): Add elf64_s390 emulation if want64. + * emulparams/elf64_sparc.sh (LIB_PATH): Update to match 2002-05-22 + genscript.sh changes. + * emulparams/elf_x86_64.sh (LIB_PATH): Likewise. + * emulparams/elf64_s390.sh (LIB_PATH): Set up native 64 bit dirs. + + 2002-10-10 Jakub Jelinek + * ldfile.c (ldfile_try_open_bfd): When searching skip linker scripts if + they have OUTPUT_FORMAT not matching actual output format. + * ldlang.c (lang_get_output_target): New function. + (open_output): Use it. + * ldlang.h (lang_get_output_target): New prototype. + + 2002-10-07 Ralf Habacker + * pe-dll.cc (autofilter_symbolprefixlist): Don't re-export + auto-import symbols. + (make_one): Create _nm_ for data only. + + 2002-10-10 Alan Modra + * emultempl/elf32.em (output_rel_find): Prefer .rel script sections + when orphan is .rel, .rela when orphan is .rela. + (gld${EMULATION_NAME}_place_orphan): Handle combreloc .rel* case + first. Remove outsecname var. + + 2002-09-30 Alan Modra + * scripttempl/elfd30v.sc: Order reloc sections placing .plt last. + * scripttempl/elfm68hc11.sc: Likewise. + * scripttempl/elfm68hc12.sc: Likewise. + + * emultempl/elf32.em (output_rel_find): Always place orphan loadable + reloc sections just before .rel.plt/.rela.plt. + (gld${EMULATION_NAME}_place_orphan <.rel>): Remove combreloc code. + Only put loadable reloc sections in hold_rel. + + 2002-09-29 H.J. Lu + * emulparams/elf32ppc.sh (OTHER_GOT_RELOC_SECTIONS): New. + + 2002-08-27 Egor Duda + * scripttempl/pe.sc: Handle .rdata_runtime_pseudo_reloc sections. + Add symbols for application to access them. + 2002-10-15 Alan Modra * ldlang.c (load_symbols): Revert last change. diff --git a/ld/configure.tgt b/ld/configure.tgt index c1d7620c8d9..bcdbb04833f 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -491,8 +491,16 @@ fr30-*-*) targ_emul=elf32fr30 ;; mcore-*-pe) targ_emul=mcorepe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;; mcore-*-elf) targ_emul=elf32mcore ;; -s390x-*-linux*) targ_emul=elf64_s390 ;; -s390-*-linux*) targ_emul=elf_s390 ;; +s390x-*-linux*) targ_emul=elf64_s390 + targ_extra_emuls=elf_s390 + targ_extra_libpath=$targ_extra_emuls + tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;; +s390-*-linux*) targ_emul=elf_s390 + if test "${want64}" = "true"; then + targ_extra_emuls=elf64_s390 + targ_extra_libpath=$targ_extra_emuls + tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'` + fi ;; *-*-ieee*) targ_emul=vanilla ;; *) diff --git a/ld/emulparams/elf32ppc.sh b/ld/emulparams/elf32ppc.sh index f88198f631f..778260b55c9 100644 --- a/ld/emulparams/elf32ppc.sh +++ b/ld/emulparams/elf32ppc.sh @@ -17,6 +17,10 @@ OTHER_READWRITE_SECTIONS=" .got1 ${RELOCATING-0} : { *(.got1) } .got2 ${RELOCATING-0} : { *(.got2) } " +OTHER_GOT_RELOC_SECTIONS=" + .rela.got1 ${RELOCATING-0} : { *(.rela.got1) } + .rela.got2 ${RELOCATING-0} : { *(.rela.got2) } +" # Treat a host that matches the target with the possible exception of "64" # in the name as if it were native. diff --git a/ld/emulparams/elf64_s390.sh b/ld/emulparams/elf64_s390.sh index 8416c89e11f..236fd1767e7 100644 --- a/ld/emulparams/elf64_s390.sh +++ b/ld/emulparams/elf64_s390.sh @@ -9,3 +9,33 @@ MACHINE= NOP=0x07070707 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes + +# Treat a host that matches the target with the possible exception of "x" +# in the name as if it were native. +if test `echo "$host" | sed -e s/390x/390/` \ + = `echo "$target" | sed -e s/390x/390/`; then + case " $EMULATION_LIBPATH " in + *" ${EMULATION_NAME} "*) + LIB_PATH=${libdir} + for lib in ${NATIVE_LIB_DIRS}; do + case :${LIB_PATH}: in + *:${lib}:*) ;; + *) LIB_PATH=${LIB_PATH}:${lib} ;; + esac + done + + case "$target" in + s390*-linux*) + suffix=64 ;; + esac + + # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first + # on Linux. + if [ -n "$suffix" ]; then + case "$EMULATION_NAME" in + *64*) + LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$suffix:,g`$LIB_PATH ;; + esac + fi ;; + esac +fi diff --git a/ld/emulparams/elf64_sparc.sh b/ld/emulparams/elf64_sparc.sh index a4706b5fe8a..7a4d2dc9c5d 100644 --- a/ld/emulparams/elf64_sparc.sh +++ b/ld/emulparams/elf64_sparc.sh @@ -22,36 +22,37 @@ case "$target" in ;; esac -if [ "x${host}" = "x${target}" ]; then +# Treat a host that matches the target with the possible exception of "64" +# and "v7", "v8", "v9" in the name as if it were native. +if test `echo "$host" | sed -e 's/64//;s/v[789]//'` \ + = `echo "$target" | sed -e 's/64//;s/v[789]//'`; then case " $EMULATION_LIBPATH " in *" ${EMULATION_NAME} "*) - # Native, and default or emulation requesting LIB_PATH. + LIB_PATH=${libdir} + for lib in ${NATIVE_LIB_DIRS}; do + case :${LIB_PATH}: in + *:${lib}:*) ;; + *) LIB_PATH=${LIB_PATH}:${lib} ;; + esac + done # Linux and Solaris modify the default library search path # to first include a 64-bit specific directory. It's put # in slightly different places on the two systems. case "$target" in - sparc*-linux*) - suffix=64 ;; - sparc*-solaris*) - suffix=/sparcv9 ;; + sparc*-linux*) + suffix=64 ;; + sparc*-solaris*) + suffix=/sparcv9 ;; esac - if [ -n "${suffix}" ]; then - - LIB_PATH=/lib${suffix}:/lib - LIB_PATH=${LIB_PATH}:/usr/lib${suffix}:/usr/lib - if [ -n "${NATIVE_LIB_DIRS}" ]; then - LIB_PATH=${LIB_PATH}:`echo ${NATIVE_LIB_DIRS} | sed s_:_${suffix}:_g`${suffix}:${NATIVE_LIB_DIRS} - fi - if [ "${libdir}" != /usr/lib ]; then - LIB_PATH=${LIB_PATH}:${libdir}${suffix}:${libdir} - fi - if [ "${libdir}" != /usr/local/lib ]; then - LIB_PATH=${LIB_PATH}:/usr/local/lib${suffix}:/usr/local/lib - fi - - fi - ;; + # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first + # on Linux and /lib/sparcv9, /usr/lib/sparcv9 etc. on Solaris. + if [ -n "$suffix" ]; then + case "$EMULATION_NAME" in + *64*) + LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$suffix:,g`$LIB_PATH ;; + esac + fi ;; esac fi diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh index 1786e339467..a428bfc123c 100644 --- a/ld/emulparams/elf_x86_64.sh +++ b/ld/emulparams/elf_x86_64.sh @@ -15,30 +15,27 @@ NO_SMALL_DATA=yes if [ "x${host}" = "x${target}" ]; then case " $EMULATION_LIBPATH " in *" ${EMULATION_NAME} "*) - # Native, and default or emulation requesting LIB_PATH. + LIB_PATH=${libdir} + for lib in ${NATIVE_LIB_DIRS}; do + case :${LIB_PATH}: in + *:${lib}:*) ;; + *) LIB_PATH=${LIB_PATH}:${lib} ;; + esac + done # Linux modify the default library search path to first include # a 64-bit specific directory. case "$target" in - x86_64*-linux*) - suffix=64 ;; + x86_64*-linux*) + suffix=64 ;; esac - if [ -n "${suffix}" ]; then - - LIB_PATH=/lib${suffix}:/lib - LIB_PATH=${LIB_PATH}:/usr/lib${suffix}:/usr/lib - if [ -n "${NATIVE_LIB_DIRS}" ]; then - LIB_PATH=${LIB_PATH}:`echo ${NATIVE_LIB_DIRS} | sed s_:_${suffix}:_g`${suffix}:${NATIVE_LIB_DIRS} - fi - if [ "${libdir}" != /usr/lib ]; then - LIB_PATH=${LIB_PATH}:${libdir}${suffix}:${libdir} - fi - if [ "${libdir}" != /usr/local/lib ]; then - LIB_PATH=${LIB_PATH}:/usr/local/lib${suffix}:/usr/local/lib - fi - - fi - ;; + # Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first. + if [ -n "$suffix" ]; then + case "$EMULATION_NAME" in + *64*) + LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,$suffix:,g`$LIB_PATH ;; + esac + fi ;; esac fi diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 26e4c46297f..4fee5fb8556 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -75,7 +75,7 @@ static void gld${EMULATION_NAME}_before_allocation static boolean gld${EMULATION_NAME}_open_dynamic_archive PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *)); static lang_output_section_statement_type *output_rel_find - PARAMS ((void)); + PARAMS ((asection *)); static asection *output_prev_sec_find PARAMS ((lang_output_section_statement_type *)); static boolean gld${EMULATION_NAME}_place_orphan @@ -996,24 +996,46 @@ cat >>e${EMULATION_NAME}.c <name[4] == 'a'; - for (u = lang_output_section_statement.head; - u != (lang_statement_union_type *) NULL; - u = lookup->next) + for (u = lang_output_section_statement.head; u; u = lookup->next) { lookup = &u->output_section_statement; - if (strncmp (".rel", lookup->name, 4) == 0 - && lookup->bfd_section != NULL - && (lookup->bfd_section->flags & SEC_ALLOC) != 0) + if (strncmp (".rel", lookup->name, 4) == 0) { - return lookup; + /* Don't place after .rel.plt as doing so results in wrong + dynamic tags. Also, place allocated reloc sections before + non-allocated. */ + int lookrela = lookup->name[4] == 'a'; + + if (strcmp (".plt", lookup->name + 4 + lookrela) == 0 + || (lookup->bfd_section != NULL + && (lookup->bfd_section->flags & SEC_ALLOC) == 0)) + break; + last = lookup; + if (rela == lookrela) + last_rel = lookup; + if (lookup->bfd_section != NULL + && (lookup->bfd_section->flags & SEC_ALLOC) != 0) + last_rel_alloc = lookup; } } - return (lang_output_section_statement_type *) NULL; + + if (last_rel_alloc) + return last_rel_alloc; + + if (last_rel) + return last_rel; + + return last; } /* Find the last output section before given output statement. @@ -1069,13 +1091,24 @@ gld${EMULATION_NAME}_place_orphan (file, s) lang_statement_list_type add; etree_type *address; const char *secname; - const char *outsecname; const char *ps = NULL; lang_output_section_statement_type *os; + int isdyn = 0; secname = bfd_get_section_name (s->owner, s); + if (! link_info.relocateable + && link_info.combreloc + && (s->flags & SEC_ALLOC) + && strncmp (secname, ".rel", 4) == 0) + { + if (secname[4] == 'a') + secname = ".rela.dyn"; + else + secname = ".rel.dyn"; + isdyn = 1; + } - if (! config.unique_orphan_sections && ! unique_section_p (secname)) + if (isdyn || (!config.unique_orphan_sections && !unique_section_p (secname))) { /* Look through the script to see where to place this section. */ os = lang_output_section_find (secname); @@ -1138,27 +1171,10 @@ gld${EMULATION_NAME}_place_orphan (file, s) && HAVE_SECTION (hold_data, ".data")) place = &hold_data; else if (strncmp (secname, ".rel", 4) == 0 + && (s->flags & SEC_LOAD) != 0 && (hold_rel.os != NULL - || (hold_rel.os = output_rel_find ()) != NULL)) - { - if (! link_info.relocateable && link_info.combreloc) - { - if (strncmp (secname, ".rela", 5) == 0) - os = lang_output_section_find (".rela.dyn"); - else - os = lang_output_section_find (".rel.dyn"); - - if (os != NULL - && os->bfd_section != NULL - && ((s->flags ^ os->bfd_section->flags) - & (SEC_LOAD | SEC_ALLOC)) == 0) - { - lang_add_section (&os->children, s, os, file); - return true; - } - } - place = &hold_rel; - } + || (hold_rel.os = output_rel_find (s)) != NULL)) + place = &hold_rel; else if ((s->flags & (SEC_CODE | SEC_READONLY)) == SEC_READONLY && HAVE_SECTION (hold_rodata, ".rodata")) place = &hold_rodata; @@ -1171,13 +1187,10 @@ gld${EMULATION_NAME}_place_orphan (file, s) /* Choose a unique name for the section. This will be needed if the same section name appears in the input file with different loadable or allocatable characteristics. */ - outsecname = secname; - if (bfd_get_section_by_name (output_bfd, outsecname) != NULL) + if (bfd_get_section_by_name (output_bfd, secname) != NULL) { - outsecname = bfd_get_unique_section_name (output_bfd, - outsecname, - &count); - if (outsecname == NULL) + secname = bfd_get_unique_section_name (output_bfd, secname, &count); + if (secname == NULL) einfo ("%F%P: place_orphan failed: %E\n"); } @@ -1198,7 +1211,7 @@ gld${EMULATION_NAME}_place_orphan (file, s) { /* If the name of the section is representable in C, then create symbols to mark the start and the end of the section. */ - for (ps = outsecname; *ps != '\0'; ps++) + for (ps = secname; *ps != '\0'; ps++) if (! ISALNUM (*ps) && *ps != '_') break; if (*ps == '\0') @@ -1206,8 +1219,8 @@ gld${EMULATION_NAME}_place_orphan (file, s) char *symname; etree_type *e_align; - symname = (char *) xmalloc (ps - outsecname + sizeof "__start_"); - sprintf (symname, "__start_%s", outsecname); + symname = (char *) xmalloc (ps - secname + sizeof "__start_"); + sprintf (symname, "__start_%s", secname); e_align = exp_unop (ALIGN_K, exp_intop ((bfd_vma) 1 << s->alignment_power)); lang_add_assignment (exp_assop ('=', symname, e_align)); @@ -1219,7 +1232,7 @@ gld${EMULATION_NAME}_place_orphan (file, s) else address = NULL; - os = lang_enter_output_section_statement (outsecname, address, 0, + os = lang_enter_output_section_statement (secname, address, 0, (bfd_vma) 0, (etree_type *) NULL, (etree_type *) NULL, @@ -1240,8 +1253,8 @@ gld${EMULATION_NAME}_place_orphan (file, s) if (place != NULL) stat_ptr = &add; - symname = (char *) xmalloc (ps - outsecname + sizeof "__stop_"); - sprintf (symname, "__stop_%s", outsecname); + symname = (char *) xmalloc (ps - secname + sizeof "__stop_"); + sprintf (symname, "__stop_%s", secname); lang_add_assignment (exp_assop ('=', symname, exp_nameop (NAME, "."))); } diff --git a/ld/ldfile.c b/ld/ldfile.c index 9fb2b2dab9e..813d55edafd 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -131,7 +131,99 @@ ldfile_try_open_bfd (attempt, entry) if (check != NULL) { if (! bfd_check_format (check, bfd_object)) - return true; + { + if (check == entry->the_bfd + && bfd_get_error () == bfd_error_file_not_recognized + && ! ldemul_unrecognized_file (entry)) + { + int token, skip = 0; + char *arg, *arg1, *arg2, *arg3; + extern FILE *yyin; + + /* Try to interpret the file as a linker script. */ + ldfile_open_command_file (attempt); + + ldfile_assumed_script = true; + parser_input = input_selected; + ldlex_both (); + token = INPUT_SCRIPT; + while (token != 0) + { + switch (token) + { + case OUTPUT_FORMAT: + if ((token = yylex ()) != '(') + continue; + if ((token = yylex ()) != NAME) + continue; + arg1 = yylval.name; + arg2 = NULL; + arg3 = NULL; + token = yylex (); + if (token == ',') + { + if ((token = yylex ()) != NAME) + { + free (arg1); + continue; + } + arg2 = yylval.name; + if ((token = yylex ()) != ',' + || (token = yylex ()) != NAME) + { + free (arg1); + free (arg2); + continue; + } + arg3 = yylval.name; + token = yylex (); + } + if (token == ')') + { + switch (command_line.endian) + { + default: + case ENDIAN_UNSET: + arg = arg1; break; + case ENDIAN_BIG: + arg = arg2 ? arg2 : arg1; break; + case ENDIAN_LITTLE: + arg = arg3 ? arg3 : arg1; break; + } + if (strcmp (arg, lang_get_output_target ()) != 0) + skip = 1; + } + free (arg1); + if (arg2) free (arg2); + if (arg3) free (arg3); + break; + case NAME: + case LNAME: + case VERS_IDENTIFIER: + case VERS_TAG: + free (yylval.name); + break; + case INT: + if (yylval.bigint.str) + free (yylval.bigint.str); + break; + } + token = yylex (); + } + ldfile_assumed_script = false; + fclose (yyin); + yyin = NULL; + if (skip) + { + einfo (_("%P: skipping incompatible %s when searching for %s\n"), + attempt, entry->local_sym_name); + bfd_close (entry->the_bfd); + entry->the_bfd = NULL; + return false; + } + } + return true; + } if ((bfd_arch_get_compatible (check, output_bfd) == NULL) /* XCOFF archives can have 32 and 64 bit objects */ diff --git a/ld/ldlang.c b/ld/ldlang.c index 990ff0a84f6..c8b93beba18 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1783,6 +1783,29 @@ get_first_input_target () return target; } +const char * +lang_get_output_target () +{ + const char *target; + + /* Has the user told us which output format to use? */ + if (output_target != (char *) NULL) + return output_target; + + /* No - has the current target been set to something other than + the default? */ + if (current_target != default_target) + return current_target; + + /* No - can we determine the format of the first input file? */ + target = get_first_input_target (); + if (target != NULL) + return target; + + /* Failed - use the default output target. */ + return default_target; +} + /* Open the output file. */ static bfd * @@ -1791,24 +1814,7 @@ open_output (name) { bfd *output; - /* Has the user told us which output format to use? */ - if (output_target == (char *) NULL) - { - /* No - has the current target been set to something other than - the default? */ - if (current_target != default_target) - output_target = current_target; - - /* No - can we determine the format of the first input file? */ - else - { - output_target = get_first_input_target (); - - /* Failed - use the default output target. */ - if (output_target == NULL) - output_target = default_target; - } - } + output_target = lang_get_output_target (); /* Has the user requested a particular endianness on the command line? */ diff --git a/ld/ldlang.h b/ld/ldlang.h index cb4b6d332dc..57c8c51e5f7 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -483,5 +483,6 @@ extern void lang_register_vers_node struct bfd_elf_version_deps *)); boolean unique_section_p PARAMS ((const char *)); extern void lang_add_unique PARAMS ((const char *)); +extern const char *lang_get_output_target PARAMS ((void)); #endif diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 648556789ca..61dc16cbb63 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -257,6 +257,8 @@ static autofilter_entry_type autofilter_symbolprefixlist[] = /* { "__imp_", 6 }, */ /* Do __imp_ explicitly to save time. */ { "__rtti_", 7 }, + /* Don't re-export auto-imported symbols. */ + { "_nm_", 4 }, { "__builtin_", 10 }, /* Don't export symbols specifying internal DLL layout. */ { "_head_", 6 }, @@ -1814,8 +1816,10 @@ make_one (exp, parent) quick_symbol (abfd, U ("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0); quick_symbol (abfd, U ("_imp__"), exp->internal_name, "", id5, BSF_GLOBAL, 0); /* Symbol to reference ord/name of imported - symbol, used to implement auto-import. */ - quick_symbol (abfd, U("_nm__"), exp->internal_name, "", id6, BSF_GLOBAL, 0); + data symbol, used to implement auto-import. */ + if (exp->flag_data) + quick_symbol (abfd, U("_nm__"), exp->internal_name, "", id6, + BSF_GLOBAL,0); if (pe_dll_compat_implib) quick_symbol (abfd, U ("__imp_"), exp->internal_name, "", id5, BSF_GLOBAL, 0); diff --git a/ld/scripttempl/elfd30v.sc b/ld/scripttempl/elfd30v.sc index 4c42585b6d6..b1d7b94705f 100644 --- a/ld/scripttempl/elfd30v.sc +++ b/ld/scripttempl/elfd30v.sc @@ -58,44 +58,44 @@ SECTIONS .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) } .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) } + .rel.text ${RELOCATING-0} : { *(.rel.text) *(.rel.gnu.linkonce.t*) } .rela.text ${RELOCATING-0} : { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data ${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) } .rela.data ${RELOCATING-0} : { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.stext ${RELOCATING-0} : { *(.rel.stest) } .rela.stext ${RELOCATING-0} : { *(.rela.stest) } + .rel.etext ${RELOCATING-0} : { *(.rel.etest) } .rela.etext ${RELOCATING-0} : { *(.rela.etest) } + .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } + .rel.edata ${RELOCATING-0} : { *(.rel.edata) } .rela.edata ${RELOCATING-0} : { *(.rela.edata) } + .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) } - .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } - .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } - .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } - .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } - .rela.got ${RELOCATING-0} : { *(.rela.got) } - .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } - .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } - .rela.init ${RELOCATING-0} : { *(.rela.init) } - .rela.fini ${RELOCATING-0} : { *(.rela.fini) } - .rela.bss ${RELOCATING-0} : { *(.rela.bss) } - .rela.plt ${RELOCATING-0} : { *(.rela.plt) } - - .rel.data ${RELOCATING-0} : { *(.rel.data) *(.rel.gnu.linkonce.d*) } - .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } - .rel.stext ${RELOCATING-0} : { *(.rel.stest) } - .rel.etext ${RELOCATING-0} : { *(.rel.etest) } - .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } - .rel.edata ${RELOCATING-0} : { *(.rel.edata) } .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) } + .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) } .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) } - .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } + .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) } + .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) } + .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } .rel.got ${RELOCATING-0} : { *(.rel.got) } + .rela.got ${RELOCATING-0} : { *(.rela.got) } .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } + .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } + .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } .rel.init ${RELOCATING-0} : { *(.rel.init) } + .rela.init ${RELOCATING-0} : { *(.rela.init) } .rel.fini ${RELOCATING-0} : { *(.rel.fini) } + .rela.fini ${RELOCATING-0} : { *(.rela.fini) } .rel.bss ${RELOCATING-0} : { *(.rel.bss) } + .rela.bss ${RELOCATING-0} : { *(.rela.bss) } .rel.plt ${RELOCATING-0} : { *(.rel.plt) } + .rela.plt ${RELOCATING-0} : { *(.rela.plt) } .init ${RELOCATING-0} : { *(.init) } =${NOP-0} ${DATA_PLT-${PLT}} diff --git a/ld/scripttempl/elfm68hc11.sc b/ld/scripttempl/elfm68hc11.sc index eaee371c9a5..95043acde63 100644 --- a/ld/scripttempl/elfm68hc11.sc +++ b/ld/scripttempl/elfm68hc11.sc @@ -264,35 +264,34 @@ SECTIONS ${RELOCATING+*(.rela.bss.*)} ${RELOCATING+*(.rela.gnu.linkonce.b.*)} } + .rel.stext ${RELOCATING-0} : { *(.rel.stest) } .rela.stext ${RELOCATING-0} : { *(.rela.stest) } + .rel.etext ${RELOCATING-0} : { *(.rel.etest) } .rela.etext ${RELOCATING-0} : { *(.rela.etest) } + .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } + .rel.edata ${RELOCATING-0} : { *(.rel.edata) } .rela.edata ${RELOCATING-0} : { *(.rela.edata) } + .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) } - .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } - .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } - .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } - .rela.got ${RELOCATING-0} : { *(.rela.got) } - .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } - .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } - .rela.init ${RELOCATING-0} : { *(.rela.init) } - .rela.fini ${RELOCATING-0} : { *(.rela.fini) } - .rela.plt ${RELOCATING-0} : { *(.rela.plt) } - - .rel.stext ${RELOCATING-0} : { *(.rel.stest) } - .rel.etext ${RELOCATING-0} : { *(.rel.etest) } - .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } - .rel.edata ${RELOCATING-0} : { *(.rel.edata) } .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) } - .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } + .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) } + .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) } + .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } .rel.got ${RELOCATING-0} : { *(.rel.got) } + .rela.got ${RELOCATING-0} : { *(.rela.got) } .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } + .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } + .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } .rel.init ${RELOCATING-0} : { *(.rel.init) } + .rela.init ${RELOCATING-0} : { *(.rela.init) } .rel.fini ${RELOCATING-0} : { *(.rel.fini) } + .rela.fini ${RELOCATING-0} : { *(.rela.fini) } .rel.plt ${RELOCATING-0} : { *(.rel.plt) } + .rela.plt ${RELOCATING-0} : { *(.rela.plt) } /* Concatenate .page0 sections. Put them in the page0 memory bank unless we are creating a relocatable file. */ diff --git a/ld/scripttempl/elfm68hc12.sc b/ld/scripttempl/elfm68hc12.sc index 2b25e775bb1..dbbfbd783a2 100644 --- a/ld/scripttempl/elfm68hc12.sc +++ b/ld/scripttempl/elfm68hc12.sc @@ -263,35 +263,34 @@ SECTIONS ${RELOCATING+*(.rela.bss.*)} ${RELOCATING+*(.rela.gnu.linkonce.b.*)} } + .rel.stext ${RELOCATING-0} : { *(.rel.stest) } .rela.stext ${RELOCATING-0} : { *(.rela.stest) } + .rel.etext ${RELOCATING-0} : { *(.rel.etest) } .rela.etext ${RELOCATING-0} : { *(.rela.etest) } + .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) } + .rel.edata ${RELOCATING-0} : { *(.rel.edata) } .rela.edata ${RELOCATING-0} : { *(.rela.edata) } + .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) } - .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } - .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } - .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } - .rela.got ${RELOCATING-0} : { *(.rela.got) } - .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } - .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } - .rela.init ${RELOCATING-0} : { *(.rela.init) } - .rela.fini ${RELOCATING-0} : { *(.rela.fini) } - .rela.plt ${RELOCATING-0} : { *(.rela.plt) } - - .rel.stext ${RELOCATING-0} : { *(.rel.stest) } - .rel.etext ${RELOCATING-0} : { *(.rel.etest) } - .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) } - .rel.edata ${RELOCATING-0} : { *(.rel.edata) } .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) } - .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) } + .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) } .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) } + .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) } .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) } + .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) } .rel.got ${RELOCATING-0} : { *(.rel.got) } + .rela.got ${RELOCATING-0} : { *(.rela.got) } .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } + .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } + .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } .rel.init ${RELOCATING-0} : { *(.rel.init) } + .rela.init ${RELOCATING-0} : { *(.rela.init) } .rel.fini ${RELOCATING-0} : { *(.rel.fini) } + .rela.fini ${RELOCATING-0} : { *(.rela.fini) } .rel.plt ${RELOCATING-0} : { *(.rel.plt) } + .rela.plt ${RELOCATING-0} : { *(.rela.plt) } /* Concatenate .page0 sections. Put them in the page0 memory bank unless we are creating a relocatable file. */ diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc index 2f24757e422..a22611c105a 100644 --- a/ld/scripttempl/pe.sc +++ b/ld/scripttempl/pe.sc @@ -85,6 +85,11 @@ SECTIONS *(.rdata) ${R_RDATA} *(.eh_frame) + ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = .;} + ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = .;} + *(.rdata_runtime_pseudo_reloc) + ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;} + ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;} } .pdata ${RELOCATING+BLOCK(__section_alignment__)} : diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 9075adc7c43..e38e044eeaa 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,40 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-10 Jakub Jelinek + * ld-i386/combreloc.s: New test. + * ld-i386/combreloc.d: New test. + * ld-i386/i386.exp (i386tests): Add it. + + 2002-10-10 Alan Modra + * ld-i386/i386.exp (reloc): Turn off combreloc. + * ld-i386/reloc.d: Likewise. + * ld-powerpc/powerpc.exp: Likewise. + * ld-powerpc/reloc.d: Likewise. + + 2002-10-03 H.J. Lu + * ld-elfvers/vers21.c (_old_foobar): Initialized to -1 for gcc + 3.x. + + 2002-10-02 Stephen Clarke + * ld-sh/sh64/gotplt.d, ld-sh/sh64/gotplt.map, + ld-sh/sh64/gotplt.s: New test. + + 2002-10-01 Jakub Jelinek + * ld-i386/i386.exp: Add tlsindntpoff test. + * ld-i386/tlsindntpoff.s: New test. + * ld-i386/tlsindntpoff.dd: New test. + + 2002-09-30 Alan Modra + * ld-powerpc/powerpc.exp: Restrict to 32 bit ELF. + + 2002-09-30 Alan Modra + * ld-powerpc/reloc.s, ld-powerpc/reloc.d: New. + * ld-powerpc/powerpc.exp: New. + + * ld-i386/reloc.s, ld-i386/reloc.d: New. + * ld-i386/i386.exp: Run new test. + 2002-09-23 Daniel Jacobowitz Merge from mainline: diff --git a/ld/testsuite/ld-elfvers/vers21.c b/ld/testsuite/ld-elfvers/vers21.c index 23382af1509..2879c7f0e3d 100644 --- a/ld/testsuite/ld-elfvers/vers21.c +++ b/ld/testsuite/ld-elfvers/vers21.c @@ -27,6 +27,6 @@ _old_foo () return foo (); } -int _old_foobar = 0; +int _old_foobar = -1; int foobar = 1; diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 09526f8d2ad..0b9257e2610 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -57,6 +57,12 @@ set i386tests { "--32" {tlsnopic1.s tlsnopic2.s} {{readelf -Ssrl tlsnopic.rd} {objdump -drj.text tlsnopic.dd} {objdump -sj.got tlsnopic.sd}} "libtlsnopic.so"} + {"Reloc section order" "-shared -melf_i386 -z nocombreloc" "--32" + {reloc.s} {{objdump -hw reloc.d}} "reloc.so"} + {"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc" + "--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"} + {"TLS @indntpoff with %eax" "-melf_i386" "--32" {tlsindntpoff.s} + {{objdump -drj.text tlsindntpoff.dd}} "tlsindntpoff"} } # FIXME: Generalize and move this to ld-lib.exp diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 47eca16e6e1..a82516eb1f8 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-16 Jakub Jelinek + * config.table: Use mh-s390pic for s390x too. + 2002-07-10 Jason Merrill * cp-demangle.c (demangle_identifier): Support extended Unicode diff --git a/libiberty/config.table b/libiberty/config.table index b9a2479aac7..df48ce99525 100644 --- a/libiberty/config.table +++ b/libiberty/config.table @@ -39,6 +39,7 @@ if [ "${shared}" = "yes" ]; then powerpc*-*-aix*) ;; powerpc*-*-*) frag=mh-ppcpic ;; sparc*-*-*) frag=mh-sparcpic ;; + s390*-*-*) frag=mh-s390pic ;; *) frag=mh-${host_cpu}pic ;; esac if [ -n "${frag}" ]; then diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 94638977e18..492e682fa9a 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,15 @@ +2002-10-28 Daniel Jacobowitz + + Merge from mainline: + 2002-10-07 Nathan Tallent + * sparc-opc.c (sparc_opcodes) : Add conditional/unconditional branch + classification. + + 2002-09-24 Nick Clifton + * po/de.po: Updated Danish translation file. + 2002-09-04 Nick Clifton Daniel Jacobowitz diff --git a/opcodes/po/de.po b/opcodes/po/de.po index 6039e3e0629..2914776e6ab 100644 --- a/opcodes/po/de.po +++ b/opcodes/po/de.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: opcodes 2.12-pre020121\n" -"POT-Creation-Date: 2002-01-17 13:58+0000\n" -"PO-Revision-Date: 2002-02-24 13:59+0100\n" +"Project-Id-Version: opcodes 2.12.91\n" +"POT-Creation-Date: 2002-07-23 15:55-0400\n" +"PO-Revision-Date: 2002-09-24 07:13+0200\n" "Last-Translator: Martin v. Löwis \n" "Language-Team: German \n" "MIME-Version: 1.0\n" @@ -25,21 +25,21 @@ msgstr "Sprunghinweis ist nicht ausgerichtet (unaligned)." msgid "Illegal limm reference in last instruction!\n" msgstr "Ungültige limm-Referenz in der letzten Anweisung!\n" -#: arm-dis.c:509 +#: arm-dis.c:507 msgid "" msgstr "" -#: arm-dis.c:1019 +#: arm-dis.c:1010 #, c-format msgid "Unrecognised register name set: %s\n" msgstr "Unbekannte Registernamensmenge: %s\n" -#: arm-dis.c:1026 +#: arm-dis.c:1017 #, c-format msgid "Unrecognised disassembler option: %s\n" msgstr "Unbekannte Disassembler-Option: %s\n" -#: arm-dis.c:1198 +#: arm-dis.c:1191 msgid "" "\n" "The following ARM specific disassembler options are supported for use with\n" @@ -59,7 +59,8 @@ msgstr "Interner Disassemblerfehler." msgid "unknown constraint `%c'" msgstr "" -#: cgen-asm.c:346 fr30-ibld.c:195 m32r-ibld.c:195 openrisc-ibld.c:195 +#: cgen-asm.c:346 fr30-ibld.c:195 frv-ibld.c:195 m32r-ibld.c:195 +#: openrisc-ibld.c:195 xstormy16-ibld.c:195 #, c-format msgid "operand out of range (%ld not between %ld and %ld)" msgstr "" @@ -85,104 +86,126 @@ msgstr "Unbekannter Fehler %d\n" msgid "Address 0x%x is out of bounds.\n" msgstr "" -#: fr30-asm.c:324 m32r-asm.c:326 openrisc-asm.c:245 +#: fr30-asm.c:323 frv-asm.c:595 m32r-asm.c:325 openrisc-asm.c:244 +#: xstormy16-asm.c:231 #, c-format msgid "Unrecognized field %d while parsing.\n" msgstr "" -#: fr30-asm.c:374 m32r-asm.c:376 openrisc-asm.c:295 +#: fr30-asm.c:373 frv-asm.c:645 m32r-asm.c:375 openrisc-asm.c:294 +#: xstormy16-asm.c:281 msgid "missing mnemonic in syntax string" msgstr "" #. We couldn't parse it. -#: fr30-asm.c:510 fr30-asm.c:514 fr30-asm.c:601 fr30-asm.c:703 m32r-asm.c:512 m32r-asm.c:516 m32r-asm.c:603 m32r-asm.c:705 openrisc-asm.c:431 openrisc-asm.c:435 openrisc-asm.c:522 openrisc-asm.c:624 +#: fr30-asm.c:509 fr30-asm.c:513 fr30-asm.c:600 fr30-asm.c:702 frv-asm.c:781 +#: frv-asm.c:785 frv-asm.c:872 frv-asm.c:974 m32r-asm.c:511 m32r-asm.c:515 +#: m32r-asm.c:602 m32r-asm.c:704 openrisc-asm.c:430 openrisc-asm.c:434 +#: openrisc-asm.c:521 openrisc-asm.c:623 xstormy16-asm.c:417 +#: xstormy16-asm.c:421 xstormy16-asm.c:508 xstormy16-asm.c:610 msgid "unrecognized instruction" msgstr "" -#: fr30-asm.c:557 m32r-asm.c:559 openrisc-asm.c:478 +#: fr30-asm.c:556 frv-asm.c:828 m32r-asm.c:558 openrisc-asm.c:477 +#: xstormy16-asm.c:464 #, c-format msgid "syntax error (expected char `%c', found `%c')" msgstr "Syntaxfehler (erwartetes Zeichen »%c«, gefunden »%c«)" -#: fr30-asm.c:567 m32r-asm.c:569 openrisc-asm.c:488 +#: fr30-asm.c:566 frv-asm.c:838 m32r-asm.c:568 openrisc-asm.c:487 +#: xstormy16-asm.c:474 #, c-format msgid "syntax error (expected char `%c', found end of instruction)" msgstr "" -#: fr30-asm.c:595 m32r-asm.c:597 openrisc-asm.c:516 +#: fr30-asm.c:594 frv-asm.c:866 m32r-asm.c:596 openrisc-asm.c:515 +#: xstormy16-asm.c:502 msgid "junk at end of line" msgstr "" -#: fr30-asm.c:702 m32r-asm.c:704 openrisc-asm.c:623 +#: fr30-asm.c:701 frv-asm.c:973 m32r-asm.c:703 openrisc-asm.c:622 +#: xstormy16-asm.c:609 msgid "unrecognized form of instruction" msgstr "" -#: fr30-asm.c:714 m32r-asm.c:716 openrisc-asm.c:635 +#: fr30-asm.c:713 frv-asm.c:985 m32r-asm.c:715 openrisc-asm.c:634 +#: xstormy16-asm.c:621 #, c-format msgid "bad instruction `%.50s...'" msgstr "" -#: fr30-asm.c:717 m32r-asm.c:719 openrisc-asm.c:638 +#: fr30-asm.c:716 frv-asm.c:988 m32r-asm.c:718 openrisc-asm.c:637 +#: xstormy16-asm.c:624 #, c-format msgid "bad instruction `%.50s'" msgstr "" #. Default text to print if an instruction isn't recognized. -#: fr30-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39 +#: fr30-dis.c:39 frv-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39 +#: xstormy16-dis.c:39 msgid "*unknown*" msgstr "" -#: fr30-dis.c:319 m32r-dis.c:250 openrisc-dis.c:137 +#: fr30-dis.c:318 frv-dis.c:360 m32r-dis.c:249 openrisc-dis.c:136 +#: xstormy16-dis.c:169 #, c-format msgid "Unrecognized field %d while printing insn.\n" msgstr "" -#: fr30-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166 +#: fr30-ibld.c:166 frv-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166 +#: xstormy16-ibld.c:166 #, c-format msgid "operand out of range (%ld not between %ld and %lu)" msgstr "" -#: fr30-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179 +#: fr30-ibld.c:179 frv-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179 +#: xstormy16-ibld.c:179 #, c-format msgid "operand out of range (%lu not between 0 and %lu)" msgstr "" -#: fr30-ibld.c:731 m32r-ibld.c:660 openrisc-ibld.c:634 +#: fr30-ibld.c:730 frv-ibld.c:820 m32r-ibld.c:659 openrisc-ibld.c:633 +#: xstormy16-ibld.c:678 #, c-format msgid "Unrecognized field %d while building insn.\n" msgstr "" -#: fr30-ibld.c:939 m32r-ibld.c:794 openrisc-ibld.c:737 +#: fr30-ibld.c:937 frv-ibld.c:1103 m32r-ibld.c:792 openrisc-ibld.c:735 +#: xstormy16-ibld.c:826 #, c-format msgid "Unrecognized field %d while decoding insn.\n" msgstr "" -#: fr30-ibld.c:1088 m32r-ibld.c:904 openrisc-ibld.c:817 +#: fr30-ibld.c:1086 frv-ibld.c:1348 m32r-ibld.c:902 openrisc-ibld.c:815 +#: xstormy16-ibld.c:939 #, c-format msgid "Unrecognized field %d while getting int operand.\n" msgstr "" -#: fr30-ibld.c:1217 m32r-ibld.c:994 openrisc-ibld.c:877 +#: fr30-ibld.c:1215 frv-ibld.c:1573 m32r-ibld.c:992 openrisc-ibld.c:875 +#: xstormy16-ibld.c:1032 #, c-format msgid "Unrecognized field %d while getting vma operand.\n" msgstr "" -#: fr30-ibld.c:1351 m32r-ibld.c:1092 openrisc-ibld.c:946 +#: fr30-ibld.c:1349 frv-ibld.c:1807 m32r-ibld.c:1090 openrisc-ibld.c:944 +#: xstormy16-ibld.c:1134 #, c-format msgid "Unrecognized field %d while setting int operand.\n" msgstr "" -#: fr30-ibld.c:1473 m32r-ibld.c:1178 openrisc-ibld.c:1003 +#: fr30-ibld.c:1471 frv-ibld.c:2029 m32r-ibld.c:1176 openrisc-ibld.c:1001 +#: xstormy16-ibld.c:1224 #, c-format msgid "Unrecognized field %d while setting vma operand.\n" msgstr "" -#: h8300-dis.c:384 +#: h8300-dis.c:385 #, c-format msgid "Hmmmm %x" msgstr "" -#: h8300-dis.c:395 +#: h8300-dis.c:396 #, c-format msgid "Don't understand %x \n" msgstr "" @@ -232,12 +255,12 @@ msgstr "" msgid "# " msgstr "" -#: mips-dis.c:290 +#: mips-dis.c:337 #, c-format msgid "# internal error, undefined modifier(%c)" msgstr "" -#: mips-dis.c:1154 +#: mips-dis.c:1209 #, c-format msgid "# internal disassembler error, unrecognised modifier (%c)" msgstr "" @@ -271,62 +294,62 @@ msgstr "" msgid "$" msgstr "" -#: ppc-opc.c:765 ppc-opc.c:798 +#: ppc-opc.c:777 ppc-opc.c:810 msgid "invalid conditional option" msgstr "" -#: ppc-opc.c:800 +#: ppc-opc.c:812 msgid "attempt to set y bit when using + or - modifier" msgstr "" -#: ppc-opc.c:832 ppc-opc.c:884 +#: ppc-opc.c:844 ppc-opc.c:896 msgid "offset not a multiple of 4" msgstr "" -#: ppc-opc.c:857 +#: ppc-opc.c:869 msgid "offset not between -2048 and 2047" msgstr "" -#: ppc-opc.c:882 +#: ppc-opc.c:894 msgid "offset not between -8192 and 8191" msgstr "" -#: ppc-opc.c:910 +#: ppc-opc.c:922 msgid "ignoring least significant bits in branch offset" msgstr "" -#: ppc-opc.c:944 ppc-opc.c:981 +#: ppc-opc.c:956 ppc-opc.c:993 msgid "illegal bitmask" msgstr "" -#: ppc-opc.c:1054 +#: ppc-opc.c:1066 msgid "value out of range" msgstr "" -#: ppc-opc.c:1130 +#: ppc-opc.c:1142 msgid "index register in load range" msgstr "" -#: ppc-opc.c:1146 +#: ppc-opc.c:1158 msgid "invalid register operand when updating" msgstr "" #. Mark as non-valid instruction -#: sparc-dis.c:749 +#: sparc-dis.c:750 msgid "unknown" msgstr "" -#: sparc-dis.c:824 +#: sparc-dis.c:825 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" msgstr "" -#: sparc-dis.c:835 +#: sparc-dis.c:836 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n" msgstr "" -#: sparc-dis.c:884 +#: sparc-dis.c:885 #, c-format msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n" msgstr "" @@ -389,3 +412,31 @@ msgstr "" #: v850-opc.c:375 msgid "immediate value must be even" msgstr "Der Direktoperand muss gerade sein." + +#: xstormy16-asm.c:74 +msgid "Bad register in preincrement" +msgstr "" + +#: xstormy16-asm.c:79 +msgid "Bad register in postincrement" +msgstr "" + +#: xstormy16-asm.c:81 +msgid "Bad register name" +msgstr "Falscher Registername." + +#: xstormy16-asm.c:85 +msgid "Label conflicts with register name" +msgstr "" + +#: xstormy16-asm.c:89 +msgid "Label conflicts with `Rx'" +msgstr "" + +#: xstormy16-asm.c:91 +msgid "Bad immediate expression" +msgstr "" + +#: xstormy16-asm.c:120 +msgid "Small operand was not an immediate number" +msgstr "" diff --git a/opcodes/sparc-opc.c b/opcodes/sparc-opc.c index 5c06d01df14..00102323f2b 100644 --- a/opcodes/sparc-opc.c +++ b/opcodes/sparc-opc.c @@ -1440,25 +1440,25 @@ cond ("bz", "tz", CONDZ, F_CONDBR|F_ALIAS), /* for e */ FBRX(fop, F2(0, 5)|COND(mask), F2(~0, ~5)|COND(~(mask)), flags), /* v9 */ \ FBR(fop, F2(0, 6)|COND(mask), F2(~0, ~6)|COND(~(mask)), flags) -CONDFC ("fb", "cb", 0x8, 0), -CONDFCL ("fba", "cba", 0x8, F_ALIAS), -CONDFC ("fbe", "cb0", 0x9, 0), -CONDF ("fbz", 0x9, F_ALIAS), -CONDFC ("fbg", "cb2", 0x6, 0), -CONDFC ("fbge", "cb02", 0xb, 0), -CONDFC ("fbl", "cb1", 0x4, 0), -CONDFC ("fble", "cb01", 0xd, 0), -CONDFC ("fblg", "cb12", 0x2, 0), -CONDFCL ("fbn", "cbn", 0x0, 0), -CONDFC ("fbne", "cb123", 0x1, 0), -CONDF ("fbnz", 0x1, F_ALIAS), -CONDFC ("fbo", "cb012", 0xf, 0), -CONDFC ("fbu", "cb3", 0x7, 0), -CONDFC ("fbue", "cb03", 0xa, 0), -CONDFC ("fbug", "cb23", 0x5, 0), -CONDFC ("fbuge", "cb023", 0xc, 0), -CONDFC ("fbul", "cb13", 0x3, 0), -CONDFC ("fbule", "cb013", 0xe, 0), +CONDFC ("fb", "cb", 0x8, F_UNBR), +CONDFCL ("fba", "cba", 0x8, F_UNBR|F_ALIAS), +CONDFC ("fbe", "cb0", 0x9, F_CONDBR), +CONDF ("fbz", 0x9, F_CONDBR|F_ALIAS), +CONDFC ("fbg", "cb2", 0x6, F_CONDBR), +CONDFC ("fbge", "cb02", 0xb, F_CONDBR), +CONDFC ("fbl", "cb1", 0x4, F_CONDBR), +CONDFC ("fble", "cb01", 0xd, F_CONDBR), +CONDFC ("fblg", "cb12", 0x2, F_CONDBR), +CONDFCL ("fbn", "cbn", 0x0, F_UNBR), +CONDFC ("fbne", "cb123", 0x1, F_CONDBR), +CONDF ("fbnz", 0x1, F_CONDBR|F_ALIAS), +CONDFC ("fbo", "cb012", 0xf, F_CONDBR), +CONDFC ("fbu", "cb3", 0x7, F_CONDBR), +CONDFC ("fbue", "cb03", 0xa, F_CONDBR), +CONDFC ("fbug", "cb23", 0x5, F_CONDBR), +CONDFC ("fbuge", "cb023", 0xc, F_CONDBR), +CONDFC ("fbul", "cb13", 0x3, F_CONDBR), +CONDFC ("fbule", "cb013", 0xe, F_CONDBR), #undef CONDFC #undef CONDFCL