diff -ruN binutils-2.19/bfd/ChangeLog binutils-2.19.1/bfd/ChangeLog --- binutils-2.19/bfd/ChangeLog 2008-10-16 15:20:48.000000000 +0200 +++ binutils-2.19.1/bfd/ChangeLog 2009-02-02 11:44:39.000000000 +0100 @@ -1,3 +1,43 @@ +2009-02-02 Tristan Gingold + + * configure.in: Bump version to 2.19.1 + * Makefile.am (RELEASE): Set. + * configure, Makefile.in: Regenerated. + +2009-01-14 Joseph Myers + + * elf32-arm.c (elf32_arm_final_link_relocate): Do not turn + branches to undefine weak symbols into branches to the next + instruction if creating PLT entries for those symbols. + +2008-12-23 Nick Clifton + + * Import this patch from the mainline: + 2008-11-10 Andreas Schwab + + PR 7011 + * elf.c (assign_file_positions_for_non_load_sections): Handle + PT_GNU_RELRO specially. + +2008-11-20 Alan Modra + + * elf32-ppc.c (allocate_dynrelocs): Always use tlsld_got for + TLS_LD even when symbol is used with other TLS reloc types. + (ppc_elf_relocate_section): Bypass symbol checks when using tlsld_got. + Leave addend zero on LD DTPMOD dynamic reloc. + +2008-11-17 Eric B. Weddington + + PR 7022 + * elf32-avr.c (bfd_elf_avr_final_write_processing): + Add missing break statements. + +2008-10-28 Tristan Gingold + + * configure.in: Bump version to 2.19.0 + * Makefile.am (RELEASE): Unset. + * configure, Makefile.in: Regenerated. + 2008-10-16 Tristan Gingold * configure.in: Bump version to 2.19 diff -ruN binutils-2.19/bfd/configure binutils-2.19.1/bfd/configure --- binutils-2.19/bfd/configure 2008-10-16 15:20:42.000000000 +0200 +++ binutils-2.19.1/bfd/configure 2009-02-02 11:44:37.000000000 +0100 @@ -3032,7 +3032,7 @@ # Define the identity of the package. PACKAGE=bfd - VERSION=2.19 + VERSION=2.19.1 cat >>confdefs.h <<_ACEOF diff -ruN binutils-2.19/bfd/configure.in binutils-2.19.1/bfd/configure.in --- binutils-2.19/bfd/configure.in 2008-10-16 15:20:34.000000000 +0200 +++ binutils-2.19.1/bfd/configure.in 2009-02-02 11:44:34.000000000 +0100 @@ -8,7 +8,7 @@ AC_CANONICAL_TARGET AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.19) +AM_INIT_AUTOMAKE(bfd, 2.19.1) dnl These must be called before LT_INIT, because it may want dnl to call AC_CHECK_PROG. diff -ruN binutils-2.19/bfd/doc/bfdver.texi binutils-2.19.1/bfd/doc/bfdver.texi --- binutils-2.19/bfd/doc/bfdver.texi 2008-10-16 15:45:29.000000000 +0200 +++ binutils-2.19.1/bfd/doc/bfdver.texi 2009-02-02 11:48:47.000000000 +0100 @@ -1,4 +1,4 @@ -@set VERSION 2.19 +@set VERSION 2.19.1 @set VERSION_PACKAGE (GNU Binutils) -@set UPDATED October 2008 +@set UPDATED February 2009 @set BUGURL @uref{http://www.sourceware.org/bugzilla/} diff -ruN binutils-2.19/bfd/elf32-arm.c binutils-2.19.1/bfd/elf32-arm.c --- binutils-2.19/bfd/elf32-arm.c 2008-08-26 16:40:18.000000000 +0200 +++ binutils-2.19.1/bfd/elf32-arm.c 2009-01-14 10:03:23.000000000 +0100 @@ -6381,8 +6381,9 @@ int thumb2 = using_thumb2 (globals); /* A branch to an undefined weak symbol is turned into a jump to - the next instruction. */ - if (h && h->root.type == bfd_link_hash_undefweak) + the next instruction unless a PLT entry will be created. */ + if (h && h->root.type == bfd_link_hash_undefweak + && !(splt != NULL && h->plt.offset != (bfd_vma) -1)) { bfd_put_16 (input_bfd, 0xe000, hit_data); bfd_put_16 (input_bfd, 0xbf00, hit_data + 2); diff -ruN binutils-2.19/bfd/elf32-avr.c binutils-2.19.1/bfd/elf32-avr.c --- binutils-2.19/bfd/elf32-avr.c 2008-08-09 07:35:12.000000000 +0200 +++ binutils-2.19.1/bfd/elf32-avr.c 2008-12-23 14:54:49.000000000 +0100 @@ -1298,6 +1298,7 @@ case bfd_mach_avr25: val = E_AVR_MACH_AVR25; + break; case bfd_mach_avr3: val = E_AVR_MACH_AVR3; @@ -1305,9 +1306,11 @@ case bfd_mach_avr31: val = E_AVR_MACH_AVR31; + break; case bfd_mach_avr35: val = E_AVR_MACH_AVR35; + break; case bfd_mach_avr4: val = E_AVR_MACH_AVR4; diff -ruN binutils-2.19/bfd/elf32-ppc.c binutils-2.19.1/bfd/elf32-ppc.c --- binutils-2.19/bfd/elf32-ppc.c 2008-10-02 10:07:16.000000000 +0200 +++ binutils-2.19.1/bfd/elf32-ppc.c 2008-12-23 14:54:49.000000000 +0100 @@ -4997,6 +4997,9 @@ eh = (struct ppc_elf_link_hash_entry *) h; if (eh->elf.got.refcount > 0) { + bfd_boolean dyn; + unsigned int need; + /* Make sure this symbol is output as a dynamic symbol. */ if (eh->elf.dynindx == -1 && !eh->elf.forced_local @@ -5006,30 +5009,32 @@ return FALSE; } - if (eh->tls_mask == (TLS_TLS | TLS_LD) - && !eh->elf.def_dynamic) - { - /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ - htab->tlsld_got.refcount += 1; - eh->elf.got.offset = (bfd_vma) -1; - } - else + need = 0; + if ((eh->tls_mask & TLS_TLS) != 0) { - bfd_boolean dyn; - unsigned int need = 0; - if ((eh->tls_mask & TLS_TLS) != 0) + if ((eh->tls_mask & TLS_LD) != 0) { - if ((eh->tls_mask & TLS_LD) != 0) - need += 8; - if ((eh->tls_mask & TLS_GD) != 0) + if (!eh->elf.def_dynamic) + /* We'll just use htab->tlsld_got.offset. This should + always be the case. It's a little odd if we have + a local dynamic reloc against a non-local symbol. */ + htab->tlsld_got.refcount += 1; + else need += 8; - if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0) - need += 4; - if ((eh->tls_mask & TLS_DTPREL) != 0) - need += 4; } - else + if ((eh->tls_mask & TLS_GD) != 0) + need += 8; + if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0) + need += 4; + if ((eh->tls_mask & TLS_DTPREL) != 0) need += 4; + } + else + need += 4; + if (need == 0) + eh->elf.got.offset = (bfd_vma) -1; + else + { eh->elf.got.offset = allocate_got (htab, need); dyn = htab->elf.dynamic_sections_created; if ((info->shared @@ -5039,7 +5044,8 @@ { /* All the entries we allocated need relocs. Except LD only needs one. */ - if ((eh->tls_mask & TLS_LD) != 0) + if ((eh->tls_mask & TLS_LD) != 0 + && eh->elf.def_dynamic) need -= 4; htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4); } @@ -5275,27 +5281,24 @@ for (; local_got < end_local_got; ++local_got, ++lgot_masks) if (*local_got > 0) { - if (*lgot_masks == (TLS_TLS | TLS_LD)) + unsigned int need = 0; + if ((*lgot_masks & TLS_TLS) != 0) { - /* If just an LD reloc, we'll just use - htab->tlsld_got.offset. */ - htab->tlsld_got.refcount += 1; - *local_got = (bfd_vma) -1; + if ((*lgot_masks & TLS_GD) != 0) + need += 8; + if ((*lgot_masks & TLS_LD) != 0) + htab->tlsld_got.refcount += 1; + if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0) + need += 4; + if ((*lgot_masks & TLS_DTPREL) != 0) + need += 4; } else + need += 4; + if (need == 0) + *local_got = (bfd_vma) -1; + else { - unsigned int need = 0; - if ((*lgot_masks & TLS_TLS) != 0) - { - if ((*lgot_masks & TLS_GD) != 0) - need += 8; - if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0) - need += 4; - if ((*lgot_masks & TLS_DTPREL) != 0) - need += 4; - } - else - need += 4; *local_got = allocate_got (htab, need); if (info->shared) htab->relgot->size += (need @@ -6560,7 +6563,8 @@ /* Generate relocs for the dynamic linker. */ if ((info->shared || indx != 0) - && (h == NULL + && (offp == &htab->tlsld_got.offset + || h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak)) { @@ -6591,7 +6595,7 @@ outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE); else outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT); - if (indx == 0) + if (indx == 0 && tls_ty != (TLS_TLS | TLS_LD)) { outrel.r_addend += relocation; if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL)) diff -ruN binutils-2.19/bfd/elf.c binutils-2.19.1/bfd/elf.c --- binutils-2.19/bfd/elf.c 2008-10-09 14:18:23.000000000 +0200 +++ binutils-2.19.1/bfd/elf.c 2008-12-23 14:54:48.000000000 +0100 @@ -4606,7 +4606,61 @@ m != NULL; m = m->next, p++) { - if (m->count != 0) + if (p->p_type == PT_GNU_RELRO) + { + const Elf_Internal_Phdr *lp; + + BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs); + + if (link_info != NULL) + { + /* During linking the range of the RELRO segment is passed + in link_info. */ + for (lp = phdrs; lp < phdrs + count; ++lp) + { + if (lp->p_type == PT_LOAD + && lp->p_vaddr >= link_info->relro_start + && lp->p_vaddr < link_info->relro_end + && lp->p_vaddr + lp->p_filesz >= link_info->relro_end) + break; + } + } + else + { + /* Otherwise we are copying an executable or shared + library, but we need to use the same linker logic. */ + for (lp = phdrs; lp < phdrs + count; ++lp) + { + if (lp->p_type == PT_LOAD + && lp->p_paddr == p->p_paddr) + break; + } + } + + if (lp < phdrs + count) + { + p->p_vaddr = lp->p_vaddr; + p->p_paddr = lp->p_paddr; + p->p_offset = lp->p_offset; + if (link_info != NULL) + p->p_filesz = link_info->relro_end - lp->p_vaddr; + else if (m->p_size_valid) + p->p_filesz = m->p_size; + else + abort (); + p->p_memsz = p->p_filesz; + p->p_align = 1; + p->p_flags = (lp->p_flags & ~PF_W); + } + else if (link_info != NULL) + { + memset (p, 0, sizeof *p); + p->p_type = PT_NULL; + } + else + abort (); + } + else if (m->count != 0) { if (p->p_type != PT_LOAD && (p->p_type != PT_NOTE @@ -4622,87 +4676,20 @@ p->p_filesz = sect->filepos - m->sections[0]->filepos; if (hdr->sh_type != SHT_NOBITS) p->p_filesz += hdr->sh_size; - - if (p->p_type == PT_GNU_RELRO) - { - /* When we get here, we are copying executable - or shared library. But we need to use the same - linker logic. */ - Elf_Internal_Phdr *lp; - - for (lp = phdrs; lp < phdrs + count; ++lp) - { - if (lp->p_type == PT_LOAD - && lp->p_paddr == p->p_paddr) - break; - } - - if (lp < phdrs + count) - { - /* We should use p_size if it is valid since it - may contain the first few bytes of the next - SEC_ALLOC section. */ - if (m->p_size_valid) - p->p_filesz = m->p_size; - else - abort (); - p->p_vaddr = lp->p_vaddr; - p->p_offset = lp->p_offset; - p->p_memsz = p->p_filesz; - p->p_align = 1; - } - else - abort (); - } - else - p->p_offset = m->sections[0]->filepos; + p->p_offset = m->sections[0]->filepos; } } - else + else if (m->includes_filehdr) { - if (m->includes_filehdr) - { - p->p_vaddr = filehdr_vaddr; - if (! m->p_paddr_valid) - p->p_paddr = filehdr_paddr; - } - else if (m->includes_phdrs) - { - p->p_vaddr = phdrs_vaddr; - if (! m->p_paddr_valid) - p->p_paddr = phdrs_paddr; - } - else if (p->p_type == PT_GNU_RELRO) - { - Elf_Internal_Phdr *lp; - - for (lp = phdrs; lp < phdrs + count; ++lp) - { - if (lp->p_type == PT_LOAD - && lp->p_vaddr <= link_info->relro_end - && lp->p_vaddr >= link_info->relro_start - && (lp->p_vaddr + lp->p_filesz - >= link_info->relro_end)) - break; - } - - if (lp < phdrs + count - && link_info->relro_end > lp->p_vaddr) - { - p->p_vaddr = lp->p_vaddr; - p->p_paddr = lp->p_paddr; - p->p_offset = lp->p_offset; - p->p_filesz = link_info->relro_end - lp->p_vaddr; - p->p_memsz = p->p_filesz; - p->p_align = 1; - p->p_flags = (lp->p_flags & ~PF_W); - } - else - { - memset (p, 0, sizeof *p); - p->p_type = PT_NULL; - } - } + p->p_vaddr = filehdr_vaddr; + if (! m->p_paddr_valid) + p->p_paddr = filehdr_paddr; + } + else if (m->includes_phdrs) + { + p->p_vaddr = phdrs_vaddr; + if (! m->p_paddr_valid) + p->p_paddr = phdrs_paddr; } } diff -ruN binutils-2.19/bfd/version.h binutils-2.19.1/bfd/version.h --- binutils-2.19/bfd/version.h 2008-10-16 14:51:57.000000000 +0200 +++ binutils-2.19.1/bfd/version.h 2009-02-02 11:09:26.000000000 +0100 @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20081016 +#define BFD_VERSION_DATE 20090202 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff -ruN binutils-2.19/binutils/ChangeLog binutils-2.19.1/binutils/ChangeLog --- binutils-2.19/binutils/ChangeLog 2008-10-02 10:07:16.000000000 +0200 +++ binutils-2.19.1/binutils/ChangeLog 2008-12-23 14:54:49.000000000 +0100 @@ -1,3 +1,16 @@ +2008-12-23 Nick Clifton + + * windmc.c (main): Use correct type for file length. + * dlltool.c (gen_exp_file): Likewise. + +2008-12-01 Nick Clifton + + PR 7044 + * dlltool.c (run): Use formatting string to avoid compile time + warning. + (gen_exp_file): Check return value from fread. + * windmc.c (main): Check return value from fread. + 2008-09-25 Richard Henderson * dwarf.c (size_of_encoded_value, get_encoded_value): Move up. diff -ruN binutils-2.19/binutils/dlltool.c binutils-2.19.1/binutils/dlltool.c --- binutils-2.19/binutils/dlltool.c 2008-07-30 06:34:56.000000000 +0200 +++ binutils-2.19.1/binutils/dlltool.c 2008-12-23 14:54:49.000000000 +0100 @@ -1206,7 +1206,7 @@ if (pid == -1) { - inform (strerror (errno)); + inform ("%s", strerror (errno)); fatal (errmsg_fmt, errmsg_arg); } @@ -1980,7 +1980,7 @@ int addr; long need[PAGE_SIZE]; long page_addr; - int numbytes; + bfd_size_type numbytes; int num_entries; long *copy; int j; @@ -1992,10 +1992,10 @@ numbytes = ftell (base_file); fseek (base_file, 0, SEEK_SET); copy = xmalloc (numbytes); - fread (copy, 1, numbytes, base_file); + if (fread (copy, 1, numbytes, base_file) < numbytes) + fatal (_("failed to read the number of entries from base file")); num_entries = numbytes / sizeof (long); - fprintf (f, "\t.section\t.reloc\n"); if (num_entries) { diff -ruN binutils-2.19/binutils/windmc.c binutils-2.19.1/binutils/windmc.c --- binutils-2.19/binutils/windmc.c 2008-07-30 06:34:56.000000000 +0200 +++ binutils-2.19.1/binutils/windmc.c 2008-12-23 14:54:49.000000000 +0100 @@ -1144,7 +1144,7 @@ unichar *u; rc_uint_type ul; char *buff; - long flen; + bfd_size_type flen; FILE *fp = fopen (input_filename, "rb"); if (!fp) @@ -1155,7 +1155,8 @@ fseek (fp, 0, SEEK_SET); buff = malloc (flen + 3); memset (buff, 0, flen + 3); - fread (buff, 1, flen, fp); + if (fread (buff, 1, flen, fp) < flen) + fatal (_("unable to read contents of %s"), input_filename); fclose (fp); if (mcset_text_in_is_unicode != 1) { diff -ruN binutils-2.19/gas/ChangeLog binutils-2.19.1/gas/ChangeLog --- binutils-2.19/gas/ChangeLog 2008-10-16 14:52:03.000000000 +0200 +++ binutils-2.19.1/gas/ChangeLog 2009-01-14 09:51:14.000000000 +0100 @@ -1,3 +1,29 @@ +2009-01-14 Jakub Jelinek + + * Makefile.am (ehopt.o): Add struc-symbol.h. + * Makefile.in: Regenerated. + * ehopt.c: Include struc-symbol.h. + (check_eh_frame): For very small O_constant DW_CFA_advance_loc4 + create correct DW_CFA_advance_loc. Handle O_subtract only + for code alignment factor 1, otherwise handle O_divide or + O_right_shift of O_subtract and O_constant. + (eh_frame_estimate_size_before_relax): Always divide by ca. + (eh_frame_convert_frag): Likewise. + +2009-01-14 John David Anglin + + * dw2gencfi.c (output_cfi_insn): Scale DW_CFA_advance_loc1, + DW_CFA_advance_loc2 and DW_CFA_advance_loc4 outputs. + +2009-01-08 Adam Nemet + + * config/tc-mips.c (NO_ISA_COP): New macro. + (COP_INSN): New macro. + (is_opcode_valid): Use them. + (macro) : Use them. Don't accept coprocessor load store + insns based on the ISA if CPU is NO_ISA_COP. + : Likewise for coprocessor operations. + 2008-10-09 Eric Botcazou * dw2gencfi.c (cfi_finish): Deal with md_fix_up_eh_frame. diff -ruN binutils-2.19/gas/config/tc-mips.c binutils-2.19.1/gas/config/tc-mips.c --- binutils-2.19/gas/config/tc-mips.c 2008-08-08 21:24:49.000000000 +0200 +++ binutils-2.19.1/gas/config/tc-mips.c 2009-01-14 09:49:59.000000000 +0100 @@ -514,12 +514,11 @@ /* Returns true for a (non floating-point) coprocessor instruction. Reading or writing the condition code is only possible on the coprocessors and these insns are not marked with INSN_COP. Thus for these insns use the - condition-code flags unless this is the floating-point coprocessor. */ + condition-code flags. */ #define COP_INSN(PINFO) \ (PINFO != INSN_MACRO \ - && (((PINFO) & INSN_COP) \ - || ((PINFO) & (INSN_READ_COND_CODE | INSN_WRITE_COND_CODE) \ - && ((PINFO) & (FP_S | FP_D)) == 0))) + && ((PINFO) & (FP_S | FP_D)) == 0 \ + && ((PINFO) & (INSN_COP | INSN_READ_COND_CODE | INSN_WRITE_COND_CODE))) /* MIPS PIC level. */ diff -ruN binutils-2.19/gas/dw2gencfi.c binutils-2.19.1/gas/dw2gencfi.c --- binutils-2.19/gas/dw2gencfi.c 2008-10-16 14:52:09.000000000 +0200 +++ binutils-2.19.1/gas/dw2gencfi.c 2009-01-14 09:50:17.000000000 +0100 @@ -1,5 +1,5 @@ /* dw2gencfi.c - Support for generating Dwarf2 CFI information. - Copyright 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Michal Ludvig This file is part of GAS, the GNU Assembler. @@ -972,20 +972,20 @@ if (scaled <= 0x3F) out_one (DW_CFA_advance_loc + scaled); - else if (delta <= 0xFF) + else if (scaled <= 0xFF) { out_one (DW_CFA_advance_loc1); - out_one (delta); + out_one (scaled); } - else if (delta <= 0xFFFF) + else if (scaled <= 0xFFFF) { out_one (DW_CFA_advance_loc2); - out_two (delta); + out_two (scaled); } else { out_one (DW_CFA_advance_loc4); - out_four (delta); + out_four (scaled); } } else diff -ruN binutils-2.19/gas/ehopt.c binutils-2.19.1/gas/ehopt.c --- binutils-2.19/gas/ehopt.c 2007-11-06 18:15:10.000000000 +0100 +++ binutils-2.19.1/gas/ehopt.c 2009-01-14 09:50:17.000000000 +0100 @@ -1,5 +1,6 @@ /* ehopt.c--optimize gcc exception frame information. - Copyright 1998, 2000, 2001, 2003, 2005, 2007 Free Software Foundation, Inc. + Copyright 1998, 2000, 2001, 2003, 2005, 2007, 2008 + Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GAS, the GNU Assembler. @@ -21,6 +22,7 @@ #include "as.h" #include "subsegs.h" +#include "struc-symbol.h" /* We include this ELF file, even though we may not be assembling for ELF, since the exception frame information is always in a format @@ -398,13 +400,10 @@ subtracted were in the same frag and the expression was reduced to a constant. We can do the optimization entirely in this function. */ - if (d->cie_info.code_alignment > 0 - && exp->X_add_number % d->cie_info.code_alignment == 0 - && exp->X_add_number / d->cie_info.code_alignment < 0x40) + if (exp->X_add_number < 0x40) { d->loc4_frag->fr_literal[d->loc4_fix] - = DW_CFA_advance_loc - | (exp->X_add_number / d->cie_info.code_alignment); + = DW_CFA_advance_loc | exp->X_add_number; /* No more bytes needed. */ return 1; } @@ -419,23 +418,39 @@ *pnbytes = 2; } } - else if (exp->X_op == O_subtract) + else if (exp->X_op == O_subtract && d->cie_info.code_alignment == 1) { /* This is a case we can optimize. The expression was not reduced, so we can not finish the optimization until the end of the assembly. We set up a variant frag which we handle later. */ - int fr_subtype; - - if (d->cie_info.code_alignment > 0) - fr_subtype = d->cie_info.code_alignment << 3; - else - fr_subtype = 0; - - frag_var (rs_cfa, 4, 0, fr_subtype, make_expr_symbol (exp), + frag_var (rs_cfa, 4, 0, 1 << 3, make_expr_symbol (exp), d->loc4_fix, (char *) d->loc4_frag); return 1; } + else if ((exp->X_op == O_divide + || exp->X_op == O_right_shift) + && d->cie_info.code_alignment > 1) + { + if (exp->X_add_symbol->bsym + && exp->X_op_symbol->bsym + && exp->X_add_symbol->sy_value.X_op == O_subtract + && exp->X_op_symbol->sy_value.X_op == O_constant + && ((exp->X_op == O_divide + ? exp->X_op_symbol->sy_value.X_add_number + : (offsetT) 1 << exp->X_op_symbol->sy_value.X_add_number) + == (offsetT) d->cie_info.code_alignment)) + { + /* This is a case we can optimize as well. The expression was + not reduced, so we can not finish the optimization until the + end of the assembly. We set up a variant frag which we + handle later. */ + frag_var (rs_cfa, 4, 0, d->cie_info.code_alignment << 3, + make_expr_symbol (&exp->X_add_symbol->sy_value), + d->loc4_fix, (char *) d->loc4_frag); + return 1; + } + } break; case state_error: @@ -459,7 +474,9 @@ diff = resolve_symbol_value (frag->fr_symbol); - if (ca > 0 && diff % ca == 0 && diff / ca < 0x40) + assert (ca > 0); + diff /= ca; + if (diff < 0x40) ret = 0; else if (diff < 0x100) ret = 1; @@ -496,21 +513,21 @@ { offsetT diff; fragS *loc4_frag; - int loc4_fix; + int loc4_fix, ca; loc4_frag = (fragS *) frag->fr_opcode; loc4_fix = (int) frag->fr_offset; diff = resolve_symbol_value (frag->fr_symbol); + ca = frag->fr_subtype >> 3; + assert (ca > 0); + diff /= ca; switch (frag->fr_subtype & 7) { case 0: - { - int ca = frag->fr_subtype >> 3; - assert (ca > 0 && diff % ca == 0 && diff / ca < 0x40); - loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc | (diff / ca); - } + assert (diff < 0x40); + loc4_frag->fr_literal[loc4_fix] = DW_CFA_advance_loc | diff; break; case 1: diff -ruN binutils-2.19/gas/Makefile.am binutils-2.19.1/gas/Makefile.am --- binutils-2.19/gas/Makefile.am 2008-10-02 10:07:17.000000000 +0200 +++ binutils-2.19.1/gas/Makefile.am 2009-01-14 09:50:17.000000000 +0100 @@ -2159,7 +2159,8 @@ dw2gencfi.o: dw2gencfi.c dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ subsegs.h $(INCDIR)/obstack.h ecoff.o: ecoff.c ecoff.h -ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h +ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h \ + struc-symbol.h expr.o: expr.c $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h flonum-copy.o: flonum-copy.c flonum-konst.o: flonum-konst.c diff -ruN binutils-2.19/gas/Makefile.in binutils-2.19.1/gas/Makefile.in --- binutils-2.19/gas/Makefile.in 2008-10-02 10:07:17.000000000 +0200 +++ binutils-2.19.1/gas/Makefile.in 2009-01-14 09:50:17.000000000 +0100 @@ -3002,7 +3002,8 @@ dw2gencfi.o: dw2gencfi.c dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ subsegs.h $(INCDIR)/obstack.h ecoff.o: ecoff.c ecoff.h -ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h +ehopt.o: ehopt.c subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/dwarf2.h \ + struc-symbol.h expr.o: expr.c $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h flonum-copy.o: flonum-copy.c flonum-konst.o: flonum-konst.c diff -ruN binutils-2.19/gas/testsuite/ChangeLog binutils-2.19.1/gas/testsuite/ChangeLog --- binutils-2.19/gas/testsuite/ChangeLog 2008-09-17 11:00:45.000000000 +0200 +++ binutils-2.19.1/gas/testsuite/ChangeLog 2009-01-14 09:49:59.000000000 +0100 @@ -1,3 +1,9 @@ +2009-01-08 Adam Nemet + + * gas/mips/mips1-fp.s, gas/mips/mips1-fp.d, gas/mips/mips1-fp.l: + New tests. + * gas/mips/mips.exp: Run them. + 2008-09-15 Alan Modra * gas/all/gas.exp: Don't run redef tests on a bunch of targets. diff -ruN binutils-2.19/gas/testsuite/gas/mips/mips1-fp.d binutils-2.19.1/gas/testsuite/gas/mips/mips1-fp.d --- binutils-2.19/gas/testsuite/gas/mips/mips1-fp.d 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/gas/testsuite/gas/mips/mips1-fp.d 2009-01-09 01:16:12.000000000 +0100 @@ -0,0 +1,12 @@ +#as: -32 +#objdump: -M reg-names=numeric -dr +#name: MIPS1 FP instructions + +.*: file format .* + +Disassembly of section .text: + +[0-9a-f]+ : +.*: 46041000 add.s \$f0,\$f2,\$f4 +.*: 44420000 cfc1 \$2,\$0 +#pass diff -ruN binutils-2.19/gas/testsuite/gas/mips/mips1-fp.l binutils-2.19.1/gas/testsuite/gas/mips/mips1-fp.l --- binutils-2.19/gas/testsuite/gas/mips/mips1-fp.l 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/gas/testsuite/gas/mips/mips1-fp.l 2009-01-09 01:16:12.000000000 +0100 @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:6: Error: opcode not supported on this processor: .* \(.*\) `add.s \$f0,\$f2,\$f4' +.*:7: Error: opcode not supported on this processor: .* \(.*\) `cfc1 \$2,\$0' diff -ruN binutils-2.19/gas/testsuite/gas/mips/mips1-fp.s binutils-2.19.1/gas/testsuite/gas/mips/mips1-fp.s --- binutils-2.19/gas/testsuite/gas/mips/mips1-fp.s 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/gas/testsuite/gas/mips/mips1-fp.s 2009-01-09 01:16:12.000000000 +0100 @@ -0,0 +1,7 @@ +# Source file used to test -mips1 fp instructions. + +# This is not a complete list of mips1 FP instructions. + +foo: + add.s $f0,$f2,$f4 + cfc1 $2,$0 diff -ruN binutils-2.19/gas/testsuite/gas/mips/mips.exp binutils-2.19.1/gas/testsuite/gas/mips/mips.exp --- binutils-2.19/gas/testsuite/gas/mips/mips.exp 2008-09-06 10:47:00.000000000 +0200 +++ binutils-2.19.1/gas/testsuite/gas/mips/mips.exp 2009-01-14 09:49:59.000000000 +0100 @@ -398,6 +398,9 @@ run_dump_test_arches "abs" [mips_arch_list_matching mips1] run_dump_test_arches "add" [mips_arch_list_matching mips1] run_dump_test_arches "and" [mips_arch_list_matching mips1] + run_dump_test_arches "mips1-fp" [mips_arch_list_matching mips1] + run_list_test_arches "mips1-fp" "-32 -msoft-float" \ + [mips_arch_list_matching mips1] run_dump_test "break20" run_dump_test "trap20" diff -ruN binutils-2.19/ld/ChangeLog binutils-2.19.1/ld/ChangeLog --- binutils-2.19/ld/ChangeLog 2008-10-09 14:18:31.000000000 +0200 +++ binutils-2.19.1/ld/ChangeLog 2009-02-02 11:31:31.000000000 +0100 @@ -1,826 +1,19 @@ -2008-10-05 Alan Modra +2009-02-02 Tristan Gingold - PR 6943 - * scripttempl/avr.sc (.bss): Set lma when relocating. - (.bss, .noinit): No need to set vma when relocating. - (.text, .bss, ,noinit): Set vma to zero when not relocating. + * deffilep.c: Add autogenerated file. + * deffilep.h: Ditto. -2008-09-30 Joseph Myers +2009-01-08 Dave Korn - * emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.opd - and .rela.branch_lt. +Backport bugfix from HEAD: -2008-09-29 Nick Clifton + 2009-01-03 Dave Korn - * po/vi.po: Updated Vietnamese translation. + * pe-dll.c (autofilter_liblist): Add entry for shared libgcc. + (libnamencmp): New function. + (auto_export): Use it in place of strncmp when filtering libraries. -2008-09-09 Peter Rosin (tiny change) - - * emultempl/pe.em (pe_find_data_imports): Add trailing newline - to warning message. - * emultempl/pep.em (pep_find_data_imports): Likewise. - -2008-09-09 Alan Modra - - * Makefile.am: Run "make dep-am". - * Makefile.in: Regenerate. - * po/ld.pot: Regenerate. - -2008-09-09 Alan Modra - - * emultempl/beos.em (gld${EMULATION_NAME}_place_orphan): Updated. - * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): Ditto. - -2008-09-08 Tristan Gingold - - * NEWS: Add a marker for the 2.19 features. - -2008-09-07 Alan Modra - - * ldlang.h (lang_output_section_find): Define. - (lang_output_section_statement_lookup): Update prototype. - * ldlang.c (lang_output_section_find, - lang_output_section_statement_lookup_1): Merge into.. - (lang_output_section_statement_lookup): ..here. Update all callers. - (process_insert_statements): Set constraint negative - for output section statements we might be inserting. Make error - fatal on not finding insertion section. - (lang_output_section_find): Rather than comparing - output_section_statement.constraint against -1, test whether - it is postive. - (lang_output_section_statement_lookup_1): Likewise. - (output_prev_sec_find, strip_excluded_output_sections): Likewise. - (lang_record_phdrs): Likewise. - * emultempl/elf32.em (output_rel_find): Likewise. - * NEWS: Mention INSERT. - -2008-08-26 Nick Clifton - - PR 6727 - * emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Scan all - input sections in all input bfds and always select the last - suitable one, so that interworking stubs are always processed - after all other input sections. - (arm_elf_before_allocation): Remove redundant use of - output_has_begun flag. - -2008-08-24 Alan Modra - - * configure.in: Update a number of obsolete autoconf macros. - * configure: Regenerate. - * aclocal.m4: Regenerate. - -2008-08-21 Jan Kratochvil - - PR ld/6833 - * ldexp.c (fold_binary ): Do not align - EXPLD.DATASEG.MIN_BASE. - * ldlang.c (lang_size_sections): New variable OLD_BASE. Rename - OLD_MIN_BASE to MIN_BASE with the former alignment from `ldexp.c'. - Use OLD_BASE now for the minimal base check after the base decrease by - the maximum alignment found. - -2008-08-17 Alan Modra - - PR 6478 - * ldcref.c (check_local_sym_xref): Use bfd_generic_link_read_symbols. - Don't free symbol pointer array. - (check_refs): Likewise. - * ldmain.c (warning_callback): Likewise. - * ldmisc.c (vfinfo): Likewise. - * pe-dll.c (process_def_file): Likewise. - (pe_walk_relocs_of_symbol, generate_reloc): Likewise. - * emultempl/pe.em (pe_find_data_imports): Likewise. - (gld_${EMULATION_NAME}_after_open): Likewise. - * emultempl/pep.em (pep_find_data_imports): Likewise. - (gld_${EMULATION_NAME}_after_open): Likewise. - * ldlang.h (lang_input_statement_type): Delete asymbols, symbol_count, - passive_position, closed. - * ldlang.c (new_afile): Don't set asymbols and symbol_count. - * ldmain.c (add_archive_element): xcalloc lang_input_statement_type. - -2008-08-15 Alan Modra - - PR 6526 - * configure.in: Invoke AC_USE_SYSTEM_EXTENSIONS. - * Makefile.in: Regenerate. - * aclocal.m4: Regenerate. - * config.in: Regenerate. - * configure: Regenerate. - -2008-08-09 Alan Modra - - PR 6753 - * ldmain.c (check_for_scripts_dir, set_scripts_dir): Delete. - (main): Don't set_scripts_dir here. - * ldfile.c (check_for_scripts_dir, find_scripts_dir): New functions, - largely based on ldmain.c versions. - (ldfile_find_command_file): Set up search in script dir here without - affecting library search. - * Makefile.am (ldmain.o): No need to define SCRIPTDIR. - (ldfile.o): New rule. - * Makefile.in: Regenerate. - -2008-08-08 Anatoly Sokolov - - * Makefile.am (ALL_EMULATIONS): Add eavr25.o, eavr31.o, eavr35.o, - and eavr51.o. - Add rules for eavr25.c, eavr31.c, eavr35.c, eavr51.c. - * Makefile.in: Regenerate. - * configure.tgt (avr-*-*, targ_extra_emuls): Add avr25, avr31, avr35 - and avr51. - * emulparams/avr25.sh: New file. - * emulparams/avr31.sh: New file. - * emulparams/avr35.sh: New file. - * emulparams/avr51.sh: New file. - -2008-08-08 Richard Sandiford - Daniel Jacobowitz - - * emulparams/elf32bmip.sh (GOT): Define, moving .got.plt to... - (OTHER_RELRO_SECTIONS, OTHER_READWRITE_SECTIONS): ...one of these - two variables. - * emulparams/elf32bmipn32-defs.sh: Likewise. - * emultempl/mipself.em: Include ldctor.h, elf/mips.h and elfxx-mips.h. - (is_mips_elf): New macro. - (stub_file, stub_bfd): New variables. - (hook_stub_info): New structure. - (hook_in_stub): New function. - (mips_add_stub_section): Likewise. - (mips_create_output_section_statements): Likewise. - (mips_before_allocation): Likewise. - (real_func): New variable. - (mips_for_each_input_file_wrapper): New function. - (mips_lang_for_each_input_file): Likewise. - (lang_for_each_input_file): Define. - (LDEMUL_BEFORE_ALLOCATION): Likewise. - (LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Likewise. - -2008-08-08 Alan Modra - - * ldfile.c (ldfile_open_file_search): Use concat. - (try_open): Don't use a fixed size pathname buffer. - (ldfile_find_command_file): Likewise. - * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive): If - using EXTRA_SHLIB_EXTENSION, don't open twice. - -2008-08-04 Alan Modra - - * Makefile.am (POTFILES.in): Set LC_ALL=C. - * Makefile.in: Regenerate. - * po/POTFILES.in: Regenerate. - -2008-08-03 Alan Modra - - * Makefile.am (spu_ovl.o): Merge rule into.. - (spu_ovl.o_c): ..this one. Only run cpp for spu target. - * Makefile.in: Regenerate. - -2008-08-02 Jan Kratochvil - - Include the spu_ovl ASCII form in the repository files. - * emultempl/spuelf.em: No longer use `bin2c', use now `spu_ovl.o_c'. - * Makefile.am (eelf32_spu.c): Depend now on `spu_ovl.o_c'. - ($(srcdir)/emultempl/spu_ovl.o_c): New target. - ($(srcdir)/emultempl/spu_ovl.o): Rename to... - (spu_ovl.o): ...this one. - * Makefile.in: Regenerate. - * emultempl/spu_ovl.o_c: New file. - * emultempl/spu_ovl.o: File removed. - -2008-07-31 Takashi Ono - - * pe-dll.c (generate_relocs): Don't generate relocs for - undefined weak symbols. - -2008-07-31 Jan Kratochvil - - * emultempl/spuelf.em: Abort on the missing required `spu_ovl.o'. - -2008-07-30 Alan Modra - - * emultempl/pe.em, emultempl/pep.em: Silence gcc warnings. - -2008-07-18 Joseph Myers - - * ld.texinfo (--no-wchar-size-warning): Document new ARM option. - * emultempl/armelf.em (no_wchar_size_warning): New. - (arm_elf_create_output_section_statements): Pass - no_wchar_size_warning to arm_elf_create_output_section_statements. - (OPTION_NO_WCHAR_SIZE_WARNING): New. - (PARSE_AND_LIST_LONGOPTS): Add no-wchar-size-warning. - (PARSE_AND_LIST_OPTIONS): List --no-wchar-size-warning. - (PARSE_AND_LIST_ARGS_CASES): Handle --no-wchar-size-warning. - -2008-07-15 Jie Zhang - - * emulparams/elf32bfinfd.sh (OTHER_SECTIONS): Define. - -2008-07-12 Craig Silverstein - - PR ld/6741 - * configure.in: Check for, and include, libz.a if it is present. - * configure: Regenerate. - * config.in: Regenerate. - -2008-07-12 Jie Zhang - - Revert - 2008-07-12 Jie Zhang - * Makefile.am (eelf32bfin.c): Depend on bfin.em. - (eelf32bfinfd.c): Likewise. - * Makefile.in: Regenerate. - * gen-doc.texi: Set Blackfin. - * ld.texinfo: Document --sep-code and Blackfin specific - options. - * ldmain.c (main): Initialize link_info.sep_code. - * lexsup.c (enum option_values): Add OPTION_SEP_CODE. - (ld_options[]): Add --sep-code. - (parse_args): Deal with --sep-code. - * emulparams/bfin.sh (EXTRA_EM_FILE): Define. - * emulparams/elf32bfinfd.sh (OTHER_SECTIONS): Define. - * emultempl/bfin.em: New file. - -2008-07-12 Jie Zhang - - * Makefile.am (eelf32bfin.c): Depend on bfin.em. - (eelf32bfinfd.c): Likewise. - * Makefile.in: Regenerate. - * gen-doc.texi: Set Blackfin. - * ld.texinfo: Document --sep-code and Blackfin specific - options. - * ldmain.c (main): Initialize link_info.sep_code. - * lexsup.c (enum option_values): Add OPTION_SEP_CODE. - (ld_options[]): Add --sep-code. - (parse_args): Deal with --sep-code. - * emulparams/bfin.sh (EXTRA_EM_FILE): Define. - * emulparams/elf32bfinfd.sh (OTHER_SECTIONS): Define. - * emultempl/bfin.em: New file. - -2008-07-09 Danny Smith - - *pe-dll.c (autofilter_symbolprefixlist): Excude all symbols - starting with ".". - Exclude "_IMPORT_DESCRIPTOR_". - (autofilter_symbolsuffixlist): Exclude "_NULL_THUNK_DATA". - (autofilter_symbollist_generic): Don't check for ".text". - Exclude "_NULL_IMPORT_DESCRIPTOR". - (autofilter_symbollist_i386): Likewise. - -2008-07-07 Alan Modra - - * emultempl/armelf.em (elf32_arm_add_stub_section): Use - bfd_make_section_with_flags. - * emultempl/avrelf.em (avr_elf_create_output_section_statements): - Likewise. - * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. - * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. - * emultempl/m68kcoff.em (gld${EMULATION_NAME}_after_open): Likewise. - * emultempl/m68kelf.em (m68k_elf_after_open): Likewise. - * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. - * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation): - Likewise. - -2008-07-06 Nathan Sidwell - - * ld.texinfo (File Commands): Document that INCLUDE can be used in - several different places. - * ldgram.y (statement, memory_spec, section): Allow INCLUDE. - (memory, memory_spec_list): Simplify BNF - (memory_spec_list_opt): New rule. - * ldlex.l (INCLUDE): Recognize in EXPRESSION. - -2008-06-20 Alan Modra - - * emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Make "can not - build overlay stubs" a fatal error. - -2008-06-17 Ralf Wildenhues - - * config.in: Regenerate. - * configure: Regenerate. - -2008-06-17 Alan Modra - - * emultempl/spuelf.em (extra_stack_space): New variable. - (gld${EMULATION_NAME}_finish): Pass it to spu_elf_check_vma. - (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS, - PARSE_AND_LIST_ARGS_CASES): Handle --extra-stack-space. - * emultempl/spu_ovl.S: Mask interrupts during dma and update of - overlay manager structures. - * emultempl/spu_ovl.o: Regenerate. - -2008-06-16 Hans-Peter Nilsson - - * ld.texinfo (@node MMIX): For the __.MMIX.start. prefix, only - mention it as being special for global symbols. - -2008-06-12 Nick Clifton - - * ldlang.c (print_output_section_statement): If the output section - statement has an update_dot_tree expression, apply it to - print_dot. - (print_input_section): Do not update print_dot if it would move - print_dot backwards. - (lang_do_assignments_1): If the output section statement has an - update_dot_tree expression apply it to dot. - -2008-06-07 Alan Modra - - * NEWS: Mention archive:path patterns. - * ld.texinfo: Likewise. - * ldlang.c: Formatting throughout. - (archive_path): Only assume "[A-Za-z]:" is a dos drive. - (input_statement_is_archive_path): New function, extracted from.. - (walk_wild): ..here. - (walk_wild_consider_section): Match archive:path here too. - (init_map_userdata, sort_def_symbol): Convert to ISO C. - * ldmain.c (main): Set link_info.path_separator. - * emultempl/spuelf.em (choose_target): Don't set it here. - -2008-06-06 Alan Modra - - * ldlang.c (name_match): New function. - (unique_section_p, walk_wild_consider_section): Use it here. - (walk_wild_section_general): And here. - (archive_path): New function. - (walk_wild): Match archive:path filespecs. - (open_input_bfds): Don't load archive:path files. - * emultempl/spuelf.em (choose_target): Set path_separator. - * emulparams/elf32_spu.sh: Add ._ea.* sections to ._ea output. - -2008-06-04 Nick Clifton - - * ld.texinfo (Orphan Sections): Fix texi typo. - -2008-06-04 Chris Metcalf - - * lexsup.c (option_values): Add OPTION_NO_WARN_FATAL. - (ld_options): Add entry for --no-fatal-warnings. - (parse_args): Handle OPTION_NO_WARN_FATAL. - * ld.texinfo (Options): Document new command line switch. - -2008-06-04 Alan Modra - - * emultempl/spuelf.em (spu_elf_relink): Correct --no-auto-overlay arg. - -2008-06-02 Nathan Sidwell - - * ldlang.c (closest_target_match): Skip generic big and little - endian ELF targets. - -2008-05-31 Evandro Menezes - - PR ld/6430 - * ld.h (enum sort_order): New. - * ldlang.c (lang_check: Fix comment. - (lang_common): Sort commons in ascending or descending order. - (lang_one_common): Likewise. - * lexsup.c (ld_options): Have --sort-common take an option - argument. - (parse_args): Handle argument to --sort-common. - * ld.texinfo (--sort-common): Document new optional argument. - * NEWS: Mention new feature. - -2008-05-28 Christophe Lyon - - * ld.texinfo: State that farcalls stubs are supported for ARM-EABI - only. - -2008-05-27 Kai Tietz - - * pe-dll.c (fill_edata): Make sure we calculate vma's in - type bfd_vma. - (generate_reloc): Likewise. - (pe_implied_import_dll): Likewise. - -2008-05-21 Nick Clifton - - PR ld/6519 - * ld.texinfo (Orphan Sections): Mention that the linker will - provide start and stop symbols for orphaned sections if their - names are valid C identifiers. - * NEWS: Add an addendum to the description of the linker feature - for providing orphan section start and end symbols. - -2008-05-21 Maxim Kuvyrkov - - * configure.in (--enable-got): New option. Handle it. - * configure: Regenerate. - * config.in: Regenerate. - * emultempl/m68kelf.em: (got_handling_target_default): New shell - variable. - (GOT_HANDLING_TARGET_DEFAULT): New macro. - (GOT_HANDLING_DEFAULT): New macro. Initialize it from configure - option if one was given. - (got_handling): New static variable. - (elf_m68k_create_output_section_statements): New static function - implementing hook. - (PARSE_AND_LIST_PROLOGUE): Define shell variable. - (OPTION_GOT): New macro. - (PARSE_AND_LIST_LONGOPTS): Define shell variable. Specify - --got option. - (got): New linker option. - (PARSE_AND_LIST_OPTIONS): Define shell variable. Print help string - for --got option. - (PARSE_AND_LIST_ARGS_CASES): Define shell variable. Handle --got - option. - * ld.texinfo: Document --got= option. - * gen-doc.texi: Add M68K. - * NEWS: Mention the new feature. - -2008-05-21 Evandro Menezes - - PR ld/6430 - * ld.texinfo (--sort-common): Correct documentation to indicate - that sorting is performed by alignment, not size, biggest - alignment first. - -2008-05-21 Christophe Lyon - Nick Clifton - - * ld.texinfo (ARM): Document --stub-group-size=N option. - Move description of --pic-veneer option into the ARM section. - * NEWS: Mention the support for long function calls. - -2008-05-15 Christophe Lyon - - * emultempl/armelf.em (build_section_lists): New function. - (stub_file): Define. - (need_laying_out): Define. - (group_size): Define. - (hook_stub_info): Define. - (hook_in_stub): New function. - (elf32_arm_add_stub_section): New function. - (gldarm_layout_sections_again): New function. - (gld${EMULATION_NAME}_finish): Replace arm_elf_finish(). Generate - stubs for long calls if needed. - (arm_elf_create_output_section_statements): create stub_file bfd. - (arm_for_each_input_file_wrapper): New function. - (arm_lang_for_each_input_file): New function. - (lang_for_each_input_file): Define. - (PARSE_AND_LIST_PROLOGUE): Add option token OPTION_STUBGROUP_SIZE. - (PARSE_AND_LIST_LONGOPTS): Add option stub-group-size. - (PARSE_AND_LIST_OPTIONS): Add option stub-group-size. - (PARSE_AND_LIST_ARGS_CASES): Add OPTION_STUBGROUP_SIZE case. - (LDEMUL_FINISH): Update to gld${EMULATION_NAME}_finish. - * lang.c (print_input_statement): Skip if bfd has - BFD_LINKER_CREATED. - -2008-05-14 Alan Modra - - * Makefile.in: Regenerate. - -2008-05-09 Kai Tietz - - ld/PR6502 - * emultempl/pep.em (compute_dll_image_base): Use bfd_vma instead - of long and change return type to bfd_vma. - (definfo): Change type of address from long to bfd_vma. - (set_pep_value): Replace strtoul to strtoull. - (gld_${EMULATION_NAME}_set_symbols): use bfd_vma instead of long.. - * pe-dll.c (pe_dll_generate_def_file): Use fprintf_vma to print - ImageBase. - (quick_reloc): Change argument address from int to bfd_size_type. - -2008-05-08 Tom Tromey - - * ld.texinfo (PowerPC64 ELF64): Fix typo. - -2008-05-08 Alan Modra - - * elf32_spu.sh (OTHER_SECTIONS): Add "._ea". - * elf32ppc.sh: If building with spu support, put ".data.spehandle" - sections at the start of ".data" and provide a symbol to locate - the directory of embedded spe programs. - -2008-05-08 Alan Modra - - * ldexp.c (exp_print_token): Add ABSOLUTE, MIN_K, ASSERT_K. Correct - MAX_K. - (fold_binary ): Set expld.result.section to - current section. Expand comment. Formatting. - (fold_name ): Set expld.result.section to current section. - -2008-04-28 Nathan Sidwell - - * ldlang.c (lang_size_sections_1): Don't check LMA overflow on - non-load sections. - -2008-04-25 Michael Frysinger - - * configure.tgt (bfin-*-linux-uclibc*): Set targ_emul to elf32bfinfd - and targ_extra_emuls to elf32bfin. - -2008-04-23 Paolo Bonzini - - * aclocal.m4: Regenerate. - * configure: Regenerate. - -2008-04-03 Kai Tietz - - * scripttempl/pep.sc: Align start of symbol __CTOR_LIST__. - -2008-04-08 Alan Modra - - * po/POTFILES.in: Regenerate. - -2008-04-08 Alan Modra - - * emultempl/spuelf.em (auto_overlay, auto_overlay_file, - auto_overlay_fixed, auto_overlay_reserved, my_argc, my_argv): New vars. - (spu_before_allocation): Warn on --auto-overlay and existing overlays. - (struct tflist, clean_tmp): Move. - (new_tmp_file): New function, extracted from.. - (embedded_spu_file): ..here. - (spu_elf_open_overlay_script, spu_elf_relink): New function. - (gld${EMULATION_NAME}_finish): Pass a bunch of --auto-overlay params. - Warn on --auto-overlay and zero local store. - (gld${EMULATION_NAME}_choose_target): New function to stash argv. - (OPTION_SPU_AUTO_OVERLAY, OPTION_SPU_AUTO_RELINK, - OPTION_SPU_OVERLAY_RODATA, OPTION_SPU_FIXED_SPACE, - OPTION_SPU_RESERVED_SPACE, OPTION_SPU_NO_AUTO_OVERLAY): Define. - (PARSE_AND_LIST_LONGOPTS): Add entries for new options. - (PARSE_AND_LIST_OPTIONS): Likewise. - (PARSE_AND_LIST_ARGS_CASES): Likewise. - (LDEMUL_CHOOSE_TARGET): Define. - -2008-04-03 Kai Tietz - - PR ld/6026 - * pe-dll.c (make_head): Fix iat and thunk addend offset. - -2008-03-31 Nick Clifton - - * po/fr.po: Updated French translation. - -2008-03-24 Ian Lance Taylor - - The sha1 code is now in libiberty. - * sha1.c: Remove. - * sha1.h: Remove. - * Makefile.am (CFILES): Remove sha1.c. - (HFILES): Remove sha1.h. - (OFILES): Remove sha1.o. - (ld_new_SOURCES): Remove sha1.c. - (sha1.o): Remove target. - * Makefile.in: Rebuild. - -2008-03-20 Alan Modra - - * emultempl/spuelf.em: Update calls to elf32-spu.c funcs. - -2008-03-17 Ralf Wildenhues - - * aclocal.m4: Regenerate. - * configure: Likewise. - * Makefile.in: Likewise. - -2008-03-14 Alan Modra - - * emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Protect - spu_elf_build_stubs with is_spu_target. - -2008-03-13 Alan Modra - - * Makefile.am: Run "make dep-am". - * Makefile.in: Regenerate. - * configure: Regenerate. - -2008-03-06 Joseph Myers - Roman Zippel - - * emulparams/m68kelf.sh (GENERATE_PIE_SCRIPT): Define. - (COMMONPAGESIZE): Define. - -2008-02-22 Nick Clifton - - PR ld/5785 - * ldlang.c (lang_size_sections_1): Honour the setting of an - lma_region even if there is no vma region set, or the vma region - is the same as the lma region. - -2008-02-18 Nick Clifton - - * scripttempl/armbpabi.sc (ENTRY): Do not define when performing a - relocatable link. - * scripttempl/elf32cr16.sc: Likewise. - * scripttempl/elf32cr16c.sc: Likewise. - * scripttempl/elf32crx.sc: Likewise. - * scripttempl/elf32sh-symbian.sc: Likewise. - * scripttempl/elf_chaos.sc: Likewise. - * scripttempl/elfd10v.sc: Likewise. - * scripttempl/elfi370.sc: Likewise. - * scripttempl/elfm68hc11.sc: Likewise. - * scripttempl/elfm68hc12.sc: Likewise. - * scripttempl/ip2k.sc: Likewise. - * scripttempl/iq2000.sc: Likewise. - * scripttempl/mep.sc: Likewise. - * scripttempl/v850.sc: Likewise. - * scripttempl/xstormy16.sc: Likewise. - -2008-02-16 Alan Modra - - PR ld/5761 - * ldexp.c (fold_name ): Check result of evaluating - load_base before calling make_abs. - -2008-02-15 Alan Modra - - * emultempl/alphaelf.em (alpha_after_open): Use elf_object_id. - * emultempl/hppaelf.em (hppaelf_create_output_section_statements): - Likewise. - * emultempl/ppc64elf.em (ppc_create_output_section_statements): - Likewise. - * emultempl/ppc32elf.em (is_ppc_elf32_vec): Delete. Replace all - uses with.. - (is_ppc_elf): ..this new macro. - -2008-02-15 Alan Modra - - * ldmain.h (output_bfd): Delete. - * ldmain.c (output_bfd): Delete. - Replace all occurrences of output_bfd with link_info.output_bfd. - * ldcref.c: Likewise. - * ldctor.c: Likewise. - * ldemul.c: Likewise. - * ldexp.c: Likewise. - * ldfile.c: Likewise. - * ldlang.c: Likewise. - * ldmisc.c: Likewise. - * ldwrite.c: Likewise. - * pe-dll.c: Likewise. - * emultempl/aix.em: Likewise. - * emultempl/alphaelf.em: Likewise. - * emultempl/armcoff.em: Likewise. - * emultempl/armelf.em: Likewise. - * emultempl/avrelf.em: Likewise. - * emultempl/beos.em: Likewise. - * emultempl/elf-generic.em: Likewise. - * emultempl/elf32.em: Likewise. - * emultempl/gld960.em: Likewise. - * emultempl/hppaelf.em: Likewise. - * emultempl/irix.em: Likewise. - * emultempl/linux.em: Likewise. - * emultempl/lnk960.em: Likewise. - * emultempl/m68hc1xelf.em: Likewise. - * emultempl/mmix-elfnmmo.em: Likewise. - * emultempl/mmo.em: Likewise. - * emultempl/pe.em: Likewise. - * emultempl/pep.em: Likewise. - * emultempl/ppc32elf.em: Likewise. - * emultempl/ppc64elf.em: Likewise. - * emultempl/scoreelf.em: Likewise. - * emultempl/sh64elf.em: Likewise. - * emultempl/spuelf.em: Likewise. - * emultempl/sunos.em: Likewise. - * emultempl/vanilla.em: Likewise. - * emultempl/vxworks.em: Likewise. - * emultempl/xtensaelf.em: Likewise. - * emultempl/z80.em: Likewise. - * ldlang.c (open_output): Don't return output, instead write - link_info_output_bfd directly. - * emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator - with link_info.output_bfd->xvec. - * emultempl/hppaelf.em: Likewise. - * emultempl/ppc32elf.em: Likewise. - * emultempl/ppc64elf.em: Likewise. - * emultempl/spuelf.em: Likewise. - -2008-02-07 Alan Modra - - * ldlang.c (new_afile): Don't pass unadorned NULL to concat. - * ldfile.c (ldfile_add_library_path): Likewise. - * emultempl/elf32.em (check_ld_elf_hints, check_ld_so_conf): Likewise. - * emultempl/lnk960.em (lnk960_before_parse): Likewise. - * emultempl/spuelf.em (embedded_spu_file): Likewise. - -2008-02-07 Alan Modra - - * emultempl/spu_ovl.S: Use low bit of _ovly_table.size as - a "present" bit rather than low bit of .buf. Correct indexing - into _ovly_buf_table. Use relative loads and stores to access - overlay manager local vars. - * emultempl/spu_ovl.o: Regenerate. - -2008-02-04 H.J. Lu - - PR 5715 - * configure: Regenerated. - -2008-01-31 Marc Gauthier - - * configure.tgt (xtensa*-*-*): Recognize processor variants. - -2008-01-28 Fabian Groffen - - * configure.tgt (x86_64-*-solaris2): Add support for this target. - -2008-01-28 Vincent Riviere - - PR ld/5652 - * genscripts.sh: Check for the existence of BASH_LINENO not just - the BASH shell before generating line numbers in the emulation - file. - -2008-01-28 Alan Modra - - * emultempl/spu_ovl.S: Rewrite. - * emultempl/spu_ovl.o: Regenerate. - * emultempl/spuelf.em (toe): Delete. - (spu_place_special_section): Add param to control section placement. - Adjust callers. - (spu_elf_load_ovl_mgr): Adjust for struct _spu_elf_section_data - changes. - (spu_before_allocation): Adjust spu_elf_size_stubs call. - (gld${EMULATION_NAME}_finish): Adjust spu_elf_build_stubs call. - -2008-01-25 H.J. Lu - - PR ld/5670 - * ldlang.c (process_insert_statements): Silence gcc 4.1 alias - warning. - -2008-01-25 Alan Modra - - * ld.texinfo (INSERT): Describe. - * ldgram.y (ldgram_in_script, ldgram_had_equals): Delete. - (INSERT_K, AFTER, BEFORE): Add as tokens. - (ifile_p1): Handle INSERT statements. - (saved_script_handle, force_make_executable): Move to.. - * ldmain.c: ..here. - (previous_script_handle): New global var. - * ldmain.h (saved_script_handle, force_make_executable): Declare. - (previous_script_handle): Likewise. - * ldlex.l (INSERT_K, AFTER, BEFORE): Add tokens. - * lexsup.c (parge_args <-T>): Set previous_script_handle. - * ldlang.c (lang_for_each_statement_worker): Handle insert statement. - (map_input_to_output_sections, print_statement): Likewise. - (lang_size_sections_1, lang_do_assignments_1): Likewise. - (insert_os_after): New function, extracted from.. - (lang_insert_orphan): ..here. - (process_insert_statements): New function. - (lang_process): Call it. - (lang_add_insert): New function. - * ldlang.h (lang_insert_statement_enum): New. - (lang_insert_statement_type): New. - (lang_statement_union_type): Add insert_statement. - (lang_add_insert): Declare. - -2008-01-18 Bob Wilson - - * scripttempl/elfxtensa.sc: Merge ENTRY and .note.gnu.build-id - changes from elf.sc. - -2008-01-16 Alan Modra - - * ldlang.c (lang_size_sections_1): Simplify SEC_NEVER_LOAD test. - -2008-01-16 Alan Modra - - * ldlang.h (lang_afile_asection_pair_statement_enum): Delete. - (lang_afile_asection_pair_statement_type): Delete. - (lang_statement_union_type): Delete afile_asection_pair_statement. - * ldlang.c (lang_insert_orphan): Delete case handling the above. - (map_input_to_output_sections, print_statement): Likewise. - -2008-01-15 Kaz Kojima - - * emulparams/shlelf_linux.sh (DATA_START_SYMBOLS): Use PROVIDE - with __data_start. - * emulparams/shelf_nbsd.sh (DATA_START_SYMBOLS): Likewise. - -2008-01-15 Alan Modra - - PR 5604 - * ldlang.c (lang_gc_sections): Move code to set SEC_KEEP on entry - syms to _bfd_elf_gc_keep. - * emultempl/ppc64elf.em (ppc_before_allocation): Don't call - ppc64_elf_edit_opd if no_opd_opt. - -2008-01-11 Tristan Gingold - Eric Botcazou - - * ldlang.c (lang_end): Warns if the entry point is not found when - --gc-sections. - Emit an error if no root is specified when --gc-sections -r. - * ld.texinfo (Options): Document that --gc-sections is compatible - with -r and -q. - * ldmain.c (main): Do not error out if -r and --gc-sections. - * scripttempl/elf.sc: Emit ENTRY command only if relocating. - -2008-01-10 Daniel Jacobowitz - - PR ld/5533 - * ldlang.c (lang_end): Issue a warning for a missing start symbol - of a shared library if the symbol was specified on the command - line. - -2008-01-10 Alan Modra - - * ld.texinfo (--gc-sections): Describe linker behaviour. - -For older changes see ChangeLog-2007 +For older changes see ChangeLog-2008 Local Variables: mode: change-log @@ -828,3 +21,4 @@ fill-column: 74 version-control: never End: + diff -ruN binutils-2.19/ld/ChangeLog-2008 binutils-2.19.1/ld/ChangeLog-2008 --- binutils-2.19/ld/ChangeLog-2008 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/ld/ChangeLog-2008 2009-01-08 15:39:46.000000000 +0100 @@ -0,0 +1,840 @@ +2008-12-23 Tristan Gingold + + * Makefile.am (EXTRA_DIST): Add deffilep.c and deffilep.h + * Makefile.in: Regenerate. + +2008-11-14 Alan Modra + + * Makefile.am (spu_ovl.o_c): Add missing line continuations. + * Makefile.in: Regenerate. + +2008-10-05 Alan Modra + + PR 6943 + * scripttempl/avr.sc (.bss): Set lma when relocating. + (.bss, .noinit): No need to set vma when relocating. + (.text, .bss, ,noinit): Set vma to zero when not relocating. + +2008-09-30 Joseph Myers + + * emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.opd + and .rela.branch_lt. + +2008-09-29 Nick Clifton + + * po/vi.po: Updated Vietnamese translation. + +2008-09-09 Peter Rosin (tiny change) + + * emultempl/pe.em (pe_find_data_imports): Add trailing newline + to warning message. + * emultempl/pep.em (pep_find_data_imports): Likewise. + +2008-09-09 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * po/ld.pot: Regenerate. + +2008-09-09 Alan Modra + + * emultempl/beos.em (gld${EMULATION_NAME}_place_orphan): Updated. + * emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): Ditto. + +2008-09-08 Tristan Gingold + + * NEWS: Add a marker for the 2.19 features. + +2008-09-07 Alan Modra + + * ldlang.h (lang_output_section_find): Define. + (lang_output_section_statement_lookup): Update prototype. + * ldlang.c (lang_output_section_find, + lang_output_section_statement_lookup_1): Merge into.. + (lang_output_section_statement_lookup): ..here. Update all callers. + (process_insert_statements): Set constraint negative + for output section statements we might be inserting. Make error + fatal on not finding insertion section. + (lang_output_section_find): Rather than comparing + output_section_statement.constraint against -1, test whether + it is postive. + (lang_output_section_statement_lookup_1): Likewise. + (output_prev_sec_find, strip_excluded_output_sections): Likewise. + (lang_record_phdrs): Likewise. + * emultempl/elf32.em (output_rel_find): Likewise. + * NEWS: Mention INSERT. + +2008-08-26 Nick Clifton + + PR 6727 + * emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Scan all + input sections in all input bfds and always select the last + suitable one, so that interworking stubs are always processed + after all other input sections. + (arm_elf_before_allocation): Remove redundant use of + output_has_begun flag. + +2008-08-24 Alan Modra + + * configure.in: Update a number of obsolete autoconf macros. + * configure: Regenerate. + * aclocal.m4: Regenerate. + +2008-08-21 Jan Kratochvil + + PR ld/6833 + * ldexp.c (fold_binary ): Do not align + EXPLD.DATASEG.MIN_BASE. + * ldlang.c (lang_size_sections): New variable OLD_BASE. Rename + OLD_MIN_BASE to MIN_BASE with the former alignment from `ldexp.c'. + Use OLD_BASE now for the minimal base check after the base decrease by + the maximum alignment found. + +2008-08-17 Alan Modra + + PR 6478 + * ldcref.c (check_local_sym_xref): Use bfd_generic_link_read_symbols. + Don't free symbol pointer array. + (check_refs): Likewise. + * ldmain.c (warning_callback): Likewise. + * ldmisc.c (vfinfo): Likewise. + * pe-dll.c (process_def_file): Likewise. + (pe_walk_relocs_of_symbol, generate_reloc): Likewise. + * emultempl/pe.em (pe_find_data_imports): Likewise. + (gld_${EMULATION_NAME}_after_open): Likewise. + * emultempl/pep.em (pep_find_data_imports): Likewise. + (gld_${EMULATION_NAME}_after_open): Likewise. + * ldlang.h (lang_input_statement_type): Delete asymbols, symbol_count, + passive_position, closed. + * ldlang.c (new_afile): Don't set asymbols and symbol_count. + * ldmain.c (add_archive_element): xcalloc lang_input_statement_type. + +2008-08-15 Alan Modra + + PR 6526 + * configure.in: Invoke AC_USE_SYSTEM_EXTENSIONS. + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * config.in: Regenerate. + * configure: Regenerate. + +2008-08-09 Alan Modra + + PR 6753 + * ldmain.c (check_for_scripts_dir, set_scripts_dir): Delete. + (main): Don't set_scripts_dir here. + * ldfile.c (check_for_scripts_dir, find_scripts_dir): New functions, + largely based on ldmain.c versions. + (ldfile_find_command_file): Set up search in script dir here without + affecting library search. + * Makefile.am (ldmain.o): No need to define SCRIPTDIR. + (ldfile.o): New rule. + * Makefile.in: Regenerate. + +2008-08-08 Anatoly Sokolov + + * Makefile.am (ALL_EMULATIONS): Add eavr25.o, eavr31.o, eavr35.o, + and eavr51.o. + Add rules for eavr25.c, eavr31.c, eavr35.c, eavr51.c. + * Makefile.in: Regenerate. + * configure.tgt (avr-*-*, targ_extra_emuls): Add avr25, avr31, avr35 + and avr51. + * emulparams/avr25.sh: New file. + * emulparams/avr31.sh: New file. + * emulparams/avr35.sh: New file. + * emulparams/avr51.sh: New file. + +2008-08-08 Richard Sandiford + Daniel Jacobowitz + + * emulparams/elf32bmip.sh (GOT): Define, moving .got.plt to... + (OTHER_RELRO_SECTIONS, OTHER_READWRITE_SECTIONS): ...one of these + two variables. + * emulparams/elf32bmipn32-defs.sh: Likewise. + * emultempl/mipself.em: Include ldctor.h, elf/mips.h and elfxx-mips.h. + (is_mips_elf): New macro. + (stub_file, stub_bfd): New variables. + (hook_stub_info): New structure. + (hook_in_stub): New function. + (mips_add_stub_section): Likewise. + (mips_create_output_section_statements): Likewise. + (mips_before_allocation): Likewise. + (real_func): New variable. + (mips_for_each_input_file_wrapper): New function. + (mips_lang_for_each_input_file): Likewise. + (lang_for_each_input_file): Define. + (LDEMUL_BEFORE_ALLOCATION): Likewise. + (LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Likewise. + +2008-08-08 Alan Modra + + * ldfile.c (ldfile_open_file_search): Use concat. + (try_open): Don't use a fixed size pathname buffer. + (ldfile_find_command_file): Likewise. + * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive): If + using EXTRA_SHLIB_EXTENSION, don't open twice. + +2008-08-04 Alan Modra + + * Makefile.am (POTFILES.in): Set LC_ALL=C. + * Makefile.in: Regenerate. + * po/POTFILES.in: Regenerate. + +2008-08-03 Alan Modra + + * Makefile.am (spu_ovl.o): Merge rule into.. + (spu_ovl.o_c): ..this one. Only run cpp for spu target. + * Makefile.in: Regenerate. + +2008-08-02 Jan Kratochvil + + Include the spu_ovl ASCII form in the repository files. + * emultempl/spuelf.em: No longer use `bin2c', use now `spu_ovl.o_c'. + * Makefile.am (eelf32_spu.c): Depend now on `spu_ovl.o_c'. + ($(srcdir)/emultempl/spu_ovl.o_c): New target. + ($(srcdir)/emultempl/spu_ovl.o): Rename to... + (spu_ovl.o): ...this one. + * Makefile.in: Regenerate. + * emultempl/spu_ovl.o_c: New file. + * emultempl/spu_ovl.o: File removed. + +2008-07-31 Takashi Ono + + * pe-dll.c (generate_relocs): Don't generate relocs for + undefined weak symbols. + +2008-07-31 Jan Kratochvil + + * emultempl/spuelf.em: Abort on the missing required `spu_ovl.o'. + +2008-07-30 Alan Modra + + * emultempl/pe.em, emultempl/pep.em: Silence gcc warnings. + +2008-07-18 Joseph Myers + + * ld.texinfo (--no-wchar-size-warning): Document new ARM option. + * emultempl/armelf.em (no_wchar_size_warning): New. + (arm_elf_create_output_section_statements): Pass + no_wchar_size_warning to arm_elf_create_output_section_statements. + (OPTION_NO_WCHAR_SIZE_WARNING): New. + (PARSE_AND_LIST_LONGOPTS): Add no-wchar-size-warning. + (PARSE_AND_LIST_OPTIONS): List --no-wchar-size-warning. + (PARSE_AND_LIST_ARGS_CASES): Handle --no-wchar-size-warning. + +2008-07-15 Jie Zhang + + * emulparams/elf32bfinfd.sh (OTHER_SECTIONS): Define. + +2008-07-12 Craig Silverstein + + PR ld/6741 + * configure.in: Check for, and include, libz.a if it is present. + * configure: Regenerate. + * config.in: Regenerate. + +2008-07-12 Jie Zhang + + Revert + 2008-07-12 Jie Zhang + * Makefile.am (eelf32bfin.c): Depend on bfin.em. + (eelf32bfinfd.c): Likewise. + * Makefile.in: Regenerate. + * gen-doc.texi: Set Blackfin. + * ld.texinfo: Document --sep-code and Blackfin specific + options. + * ldmain.c (main): Initialize link_info.sep_code. + * lexsup.c (enum option_values): Add OPTION_SEP_CODE. + (ld_options[]): Add --sep-code. + (parse_args): Deal with --sep-code. + * emulparams/bfin.sh (EXTRA_EM_FILE): Define. + * emulparams/elf32bfinfd.sh (OTHER_SECTIONS): Define. + * emultempl/bfin.em: New file. + +2008-07-12 Jie Zhang + + * Makefile.am (eelf32bfin.c): Depend on bfin.em. + (eelf32bfinfd.c): Likewise. + * Makefile.in: Regenerate. + * gen-doc.texi: Set Blackfin. + * ld.texinfo: Document --sep-code and Blackfin specific + options. + * ldmain.c (main): Initialize link_info.sep_code. + * lexsup.c (enum option_values): Add OPTION_SEP_CODE. + (ld_options[]): Add --sep-code. + (parse_args): Deal with --sep-code. + * emulparams/bfin.sh (EXTRA_EM_FILE): Define. + * emulparams/elf32bfinfd.sh (OTHER_SECTIONS): Define. + * emultempl/bfin.em: New file. + +2008-07-09 Danny Smith + + *pe-dll.c (autofilter_symbolprefixlist): Excude all symbols + starting with ".". + Exclude "_IMPORT_DESCRIPTOR_". + (autofilter_symbolsuffixlist): Exclude "_NULL_THUNK_DATA". + (autofilter_symbollist_generic): Don't check for ".text". + Exclude "_NULL_IMPORT_DESCRIPTOR". + (autofilter_symbollist_i386): Likewise. + +2008-07-07 Alan Modra + + * emultempl/armelf.em (elf32_arm_add_stub_section): Use + bfd_make_section_with_flags. + * emultempl/avrelf.em (avr_elf_create_output_section_statements): + Likewise. + * emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise. + * emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise. + * emultempl/m68kcoff.em (gld${EMULATION_NAME}_after_open): Likewise. + * emultempl/m68kelf.em (m68k_elf_after_open): Likewise. + * emultempl/ppc64elf.em (ppc_add_stub_section): Likewise. + * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation): + Likewise. + +2008-07-06 Nathan Sidwell + + * ld.texinfo (File Commands): Document that INCLUDE can be used in + several different places. + * ldgram.y (statement, memory_spec, section): Allow INCLUDE. + (memory, memory_spec_list): Simplify BNF + (memory_spec_list_opt): New rule. + * ldlex.l (INCLUDE): Recognize in EXPRESSION. + +2008-06-20 Alan Modra + + * emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Make "can not + build overlay stubs" a fatal error. + +2008-06-17 Ralf Wildenhues + + * config.in: Regenerate. + * configure: Regenerate. + +2008-06-17 Alan Modra + + * emultempl/spuelf.em (extra_stack_space): New variable. + (gld${EMULATION_NAME}_finish): Pass it to spu_elf_check_vma. + (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS, + PARSE_AND_LIST_ARGS_CASES): Handle --extra-stack-space. + * emultempl/spu_ovl.S: Mask interrupts during dma and update of + overlay manager structures. + * emultempl/spu_ovl.o: Regenerate. + +2008-06-16 Hans-Peter Nilsson + + * ld.texinfo (@node MMIX): For the __.MMIX.start. prefix, only + mention it as being special for global symbols. + +2008-06-12 Nick Clifton + + * ldlang.c (print_output_section_statement): If the output section + statement has an update_dot_tree expression, apply it to + print_dot. + (print_input_section): Do not update print_dot if it would move + print_dot backwards. + (lang_do_assignments_1): If the output section statement has an + update_dot_tree expression apply it to dot. + +2008-06-07 Alan Modra + + * NEWS: Mention archive:path patterns. + * ld.texinfo: Likewise. + * ldlang.c: Formatting throughout. + (archive_path): Only assume "[A-Za-z]:" is a dos drive. + (input_statement_is_archive_path): New function, extracted from.. + (walk_wild): ..here. + (walk_wild_consider_section): Match archive:path here too. + (init_map_userdata, sort_def_symbol): Convert to ISO C. + * ldmain.c (main): Set link_info.path_separator. + * emultempl/spuelf.em (choose_target): Don't set it here. + +2008-06-06 Alan Modra + + * ldlang.c (name_match): New function. + (unique_section_p, walk_wild_consider_section): Use it here. + (walk_wild_section_general): And here. + (archive_path): New function. + (walk_wild): Match archive:path filespecs. + (open_input_bfds): Don't load archive:path files. + * emultempl/spuelf.em (choose_target): Set path_separator. + * emulparams/elf32_spu.sh: Add ._ea.* sections to ._ea output. + +2008-06-04 Nick Clifton + + * ld.texinfo (Orphan Sections): Fix texi typo. + +2008-06-04 Chris Metcalf + + * lexsup.c (option_values): Add OPTION_NO_WARN_FATAL. + (ld_options): Add entry for --no-fatal-warnings. + (parse_args): Handle OPTION_NO_WARN_FATAL. + * ld.texinfo (Options): Document new command line switch. + +2008-06-04 Alan Modra + + * emultempl/spuelf.em (spu_elf_relink): Correct --no-auto-overlay arg. + +2008-06-02 Nathan Sidwell + + * ldlang.c (closest_target_match): Skip generic big and little + endian ELF targets. + +2008-05-31 Evandro Menezes + + PR ld/6430 + * ld.h (enum sort_order): New. + * ldlang.c (lang_check: Fix comment. + (lang_common): Sort commons in ascending or descending order. + (lang_one_common): Likewise. + * lexsup.c (ld_options): Have --sort-common take an option + argument. + (parse_args): Handle argument to --sort-common. + * ld.texinfo (--sort-common): Document new optional argument. + * NEWS: Mention new feature. + +2008-05-28 Christophe Lyon + + * ld.texinfo: State that farcalls stubs are supported for ARM-EABI + only. + +2008-05-27 Kai Tietz + + * pe-dll.c (fill_edata): Make sure we calculate vma's in + type bfd_vma. + (generate_reloc): Likewise. + (pe_implied_import_dll): Likewise. + +2008-05-21 Nick Clifton + + PR ld/6519 + * ld.texinfo (Orphan Sections): Mention that the linker will + provide start and stop symbols for orphaned sections if their + names are valid C identifiers. + * NEWS: Add an addendum to the description of the linker feature + for providing orphan section start and end symbols. + +2008-05-21 Maxim Kuvyrkov + + * configure.in (--enable-got): New option. Handle it. + * configure: Regenerate. + * config.in: Regenerate. + * emultempl/m68kelf.em: (got_handling_target_default): New shell + variable. + (GOT_HANDLING_TARGET_DEFAULT): New macro. + (GOT_HANDLING_DEFAULT): New macro. Initialize it from configure + option if one was given. + (got_handling): New static variable. + (elf_m68k_create_output_section_statements): New static function + implementing hook. + (PARSE_AND_LIST_PROLOGUE): Define shell variable. + (OPTION_GOT): New macro. + (PARSE_AND_LIST_LONGOPTS): Define shell variable. Specify + --got option. + (got): New linker option. + (PARSE_AND_LIST_OPTIONS): Define shell variable. Print help string + for --got option. + (PARSE_AND_LIST_ARGS_CASES): Define shell variable. Handle --got + option. + * ld.texinfo: Document --got= option. + * gen-doc.texi: Add M68K. + * NEWS: Mention the new feature. + +2008-05-21 Evandro Menezes + + PR ld/6430 + * ld.texinfo (--sort-common): Correct documentation to indicate + that sorting is performed by alignment, not size, biggest + alignment first. + +2008-05-21 Christophe Lyon + Nick Clifton + + * ld.texinfo (ARM): Document --stub-group-size=N option. + Move description of --pic-veneer option into the ARM section. + * NEWS: Mention the support for long function calls. + +2008-05-15 Christophe Lyon + + * emultempl/armelf.em (build_section_lists): New function. + (stub_file): Define. + (need_laying_out): Define. + (group_size): Define. + (hook_stub_info): Define. + (hook_in_stub): New function. + (elf32_arm_add_stub_section): New function. + (gldarm_layout_sections_again): New function. + (gld${EMULATION_NAME}_finish): Replace arm_elf_finish(). Generate + stubs for long calls if needed. + (arm_elf_create_output_section_statements): create stub_file bfd. + (arm_for_each_input_file_wrapper): New function. + (arm_lang_for_each_input_file): New function. + (lang_for_each_input_file): Define. + (PARSE_AND_LIST_PROLOGUE): Add option token OPTION_STUBGROUP_SIZE. + (PARSE_AND_LIST_LONGOPTS): Add option stub-group-size. + (PARSE_AND_LIST_OPTIONS): Add option stub-group-size. + (PARSE_AND_LIST_ARGS_CASES): Add OPTION_STUBGROUP_SIZE case. + (LDEMUL_FINISH): Update to gld${EMULATION_NAME}_finish. + * lang.c (print_input_statement): Skip if bfd has + BFD_LINKER_CREATED. + +2008-05-14 Alan Modra + + * Makefile.in: Regenerate. + +2008-05-09 Kai Tietz + + ld/PR6502 + * emultempl/pep.em (compute_dll_image_base): Use bfd_vma instead + of long and change return type to bfd_vma. + (definfo): Change type of address from long to bfd_vma. + (set_pep_value): Replace strtoul to strtoull. + (gld_${EMULATION_NAME}_set_symbols): use bfd_vma instead of long.. + * pe-dll.c (pe_dll_generate_def_file): Use fprintf_vma to print + ImageBase. + (quick_reloc): Change argument address from int to bfd_size_type. + +2008-05-08 Tom Tromey + + * ld.texinfo (PowerPC64 ELF64): Fix typo. + +2008-05-08 Alan Modra + + * elf32_spu.sh (OTHER_SECTIONS): Add "._ea". + * elf32ppc.sh: If building with spu support, put ".data.spehandle" + sections at the start of ".data" and provide a symbol to locate + the directory of embedded spe programs. + +2008-05-08 Alan Modra + + * ldexp.c (exp_print_token): Add ABSOLUTE, MIN_K, ASSERT_K. Correct + MAX_K. + (fold_binary ): Set expld.result.section to + current section. Expand comment. Formatting. + (fold_name ): Set expld.result.section to current section. + +2008-04-28 Nathan Sidwell + + * ldlang.c (lang_size_sections_1): Don't check LMA overflow on + non-load sections. + +2008-04-25 Michael Frysinger + + * configure.tgt (bfin-*-linux-uclibc*): Set targ_emul to elf32bfinfd + and targ_extra_emuls to elf32bfin. + +2008-04-23 Paolo Bonzini + + * aclocal.m4: Regenerate. + * configure: Regenerate. + +2008-04-03 Kai Tietz + + * scripttempl/pep.sc: Align start of symbol __CTOR_LIST__. + +2008-04-08 Alan Modra + + * po/POTFILES.in: Regenerate. + +2008-04-08 Alan Modra + + * emultempl/spuelf.em (auto_overlay, auto_overlay_file, + auto_overlay_fixed, auto_overlay_reserved, my_argc, my_argv): New vars. + (spu_before_allocation): Warn on --auto-overlay and existing overlays. + (struct tflist, clean_tmp): Move. + (new_tmp_file): New function, extracted from.. + (embedded_spu_file): ..here. + (spu_elf_open_overlay_script, spu_elf_relink): New function. + (gld${EMULATION_NAME}_finish): Pass a bunch of --auto-overlay params. + Warn on --auto-overlay and zero local store. + (gld${EMULATION_NAME}_choose_target): New function to stash argv. + (OPTION_SPU_AUTO_OVERLAY, OPTION_SPU_AUTO_RELINK, + OPTION_SPU_OVERLAY_RODATA, OPTION_SPU_FIXED_SPACE, + OPTION_SPU_RESERVED_SPACE, OPTION_SPU_NO_AUTO_OVERLAY): Define. + (PARSE_AND_LIST_LONGOPTS): Add entries for new options. + (PARSE_AND_LIST_OPTIONS): Likewise. + (PARSE_AND_LIST_ARGS_CASES): Likewise. + (LDEMUL_CHOOSE_TARGET): Define. + +2008-04-03 Kai Tietz + + PR ld/6026 + * pe-dll.c (make_head): Fix iat and thunk addend offset. + +2008-03-31 Nick Clifton + + * po/fr.po: Updated French translation. + +2008-03-24 Ian Lance Taylor + + The sha1 code is now in libiberty. + * sha1.c: Remove. + * sha1.h: Remove. + * Makefile.am (CFILES): Remove sha1.c. + (HFILES): Remove sha1.h. + (OFILES): Remove sha1.o. + (ld_new_SOURCES): Remove sha1.c. + (sha1.o): Remove target. + * Makefile.in: Rebuild. + +2008-03-20 Alan Modra + + * emultempl/spuelf.em: Update calls to elf32-spu.c funcs. + +2008-03-17 Ralf Wildenhues + + * aclocal.m4: Regenerate. + * configure: Likewise. + * Makefile.in: Likewise. + +2008-03-14 Alan Modra + + * emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Protect + spu_elf_build_stubs with is_spu_target. + +2008-03-13 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * configure: Regenerate. + +2008-03-06 Joseph Myers + Roman Zippel + + * emulparams/m68kelf.sh (GENERATE_PIE_SCRIPT): Define. + (COMMONPAGESIZE): Define. + +2008-02-22 Nick Clifton + + PR ld/5785 + * ldlang.c (lang_size_sections_1): Honour the setting of an + lma_region even if there is no vma region set, or the vma region + is the same as the lma region. + +2008-02-18 Nick Clifton + + * scripttempl/armbpabi.sc (ENTRY): Do not define when performing a + relocatable link. + * scripttempl/elf32cr16.sc: Likewise. + * scripttempl/elf32cr16c.sc: Likewise. + * scripttempl/elf32crx.sc: Likewise. + * scripttempl/elf32sh-symbian.sc: Likewise. + * scripttempl/elf_chaos.sc: Likewise. + * scripttempl/elfd10v.sc: Likewise. + * scripttempl/elfi370.sc: Likewise. + * scripttempl/elfm68hc11.sc: Likewise. + * scripttempl/elfm68hc12.sc: Likewise. + * scripttempl/ip2k.sc: Likewise. + * scripttempl/iq2000.sc: Likewise. + * scripttempl/mep.sc: Likewise. + * scripttempl/v850.sc: Likewise. + * scripttempl/xstormy16.sc: Likewise. + +2008-02-16 Alan Modra + + PR ld/5761 + * ldexp.c (fold_name ): Check result of evaluating + load_base before calling make_abs. + +2008-02-15 Alan Modra + + * emultempl/alphaelf.em (alpha_after_open): Use elf_object_id. + * emultempl/hppaelf.em (hppaelf_create_output_section_statements): + Likewise. + * emultempl/ppc64elf.em (ppc_create_output_section_statements): + Likewise. + * emultempl/ppc32elf.em (is_ppc_elf32_vec): Delete. Replace all + uses with.. + (is_ppc_elf): ..this new macro. + +2008-02-15 Alan Modra + + * ldmain.h (output_bfd): Delete. + * ldmain.c (output_bfd): Delete. + Replace all occurrences of output_bfd with link_info.output_bfd. + * ldcref.c: Likewise. + * ldctor.c: Likewise. + * ldemul.c: Likewise. + * ldexp.c: Likewise. + * ldfile.c: Likewise. + * ldlang.c: Likewise. + * ldmisc.c: Likewise. + * ldwrite.c: Likewise. + * pe-dll.c: Likewise. + * emultempl/aix.em: Likewise. + * emultempl/alphaelf.em: Likewise. + * emultempl/armcoff.em: Likewise. + * emultempl/armelf.em: Likewise. + * emultempl/avrelf.em: Likewise. + * emultempl/beos.em: Likewise. + * emultempl/elf-generic.em: Likewise. + * emultempl/elf32.em: Likewise. + * emultempl/gld960.em: Likewise. + * emultempl/hppaelf.em: Likewise. + * emultempl/irix.em: Likewise. + * emultempl/linux.em: Likewise. + * emultempl/lnk960.em: Likewise. + * emultempl/m68hc1xelf.em: Likewise. + * emultempl/mmix-elfnmmo.em: Likewise. + * emultempl/mmo.em: Likewise. + * emultempl/pe.em: Likewise. + * emultempl/pep.em: Likewise. + * emultempl/ppc32elf.em: Likewise. + * emultempl/ppc64elf.em: Likewise. + * emultempl/scoreelf.em: Likewise. + * emultempl/sh64elf.em: Likewise. + * emultempl/spuelf.em: Likewise. + * emultempl/sunos.em: Likewise. + * emultempl/vanilla.em: Likewise. + * emultempl/vxworks.em: Likewise. + * emultempl/xtensaelf.em: Likewise. + * emultempl/z80.em: Likewise. + * ldlang.c (open_output): Don't return output, instead write + link_info_output_bfd directly. + * emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator + with link_info.output_bfd->xvec. + * emultempl/hppaelf.em: Likewise. + * emultempl/ppc32elf.em: Likewise. + * emultempl/ppc64elf.em: Likewise. + * emultempl/spuelf.em: Likewise. + +2008-02-07 Alan Modra + + * ldlang.c (new_afile): Don't pass unadorned NULL to concat. + * ldfile.c (ldfile_add_library_path): Likewise. + * emultempl/elf32.em (check_ld_elf_hints, check_ld_so_conf): Likewise. + * emultempl/lnk960.em (lnk960_before_parse): Likewise. + * emultempl/spuelf.em (embedded_spu_file): Likewise. + +2008-02-07 Alan Modra + + * emultempl/spu_ovl.S: Use low bit of _ovly_table.size as + a "present" bit rather than low bit of .buf. Correct indexing + into _ovly_buf_table. Use relative loads and stores to access + overlay manager local vars. + * emultempl/spu_ovl.o: Regenerate. + +2008-02-04 H.J. Lu + + PR 5715 + * configure: Regenerated. + +2008-01-31 Marc Gauthier + + * configure.tgt (xtensa*-*-*): Recognize processor variants. + +2008-01-28 Fabian Groffen + + * configure.tgt (x86_64-*-solaris2): Add support for this target. + +2008-01-28 Vincent Riviere + + PR ld/5652 + * genscripts.sh: Check for the existence of BASH_LINENO not just + the BASH shell before generating line numbers in the emulation + file. + +2008-01-28 Alan Modra + + * emultempl/spu_ovl.S: Rewrite. + * emultempl/spu_ovl.o: Regenerate. + * emultempl/spuelf.em (toe): Delete. + (spu_place_special_section): Add param to control section placement. + Adjust callers. + (spu_elf_load_ovl_mgr): Adjust for struct _spu_elf_section_data + changes. + (spu_before_allocation): Adjust spu_elf_size_stubs call. + (gld${EMULATION_NAME}_finish): Adjust spu_elf_build_stubs call. + +2008-01-25 H.J. Lu + + PR ld/5670 + * ldlang.c (process_insert_statements): Silence gcc 4.1 alias + warning. + +2008-01-25 Alan Modra + + * ld.texinfo (INSERT): Describe. + * ldgram.y (ldgram_in_script, ldgram_had_equals): Delete. + (INSERT_K, AFTER, BEFORE): Add as tokens. + (ifile_p1): Handle INSERT statements. + (saved_script_handle, force_make_executable): Move to.. + * ldmain.c: ..here. + (previous_script_handle): New global var. + * ldmain.h (saved_script_handle, force_make_executable): Declare. + (previous_script_handle): Likewise. + * ldlex.l (INSERT_K, AFTER, BEFORE): Add tokens. + * lexsup.c (parge_args <-T>): Set previous_script_handle. + * ldlang.c (lang_for_each_statement_worker): Handle insert statement. + (map_input_to_output_sections, print_statement): Likewise. + (lang_size_sections_1, lang_do_assignments_1): Likewise. + (insert_os_after): New function, extracted from.. + (lang_insert_orphan): ..here. + (process_insert_statements): New function. + (lang_process): Call it. + (lang_add_insert): New function. + * ldlang.h (lang_insert_statement_enum): New. + (lang_insert_statement_type): New. + (lang_statement_union_type): Add insert_statement. + (lang_add_insert): Declare. + +2008-01-18 Bob Wilson + + * scripttempl/elfxtensa.sc: Merge ENTRY and .note.gnu.build-id + changes from elf.sc. + +2008-01-16 Alan Modra + + * ldlang.c (lang_size_sections_1): Simplify SEC_NEVER_LOAD test. + +2008-01-16 Alan Modra + + * ldlang.h (lang_afile_asection_pair_statement_enum): Delete. + (lang_afile_asection_pair_statement_type): Delete. + (lang_statement_union_type): Delete afile_asection_pair_statement. + * ldlang.c (lang_insert_orphan): Delete case handling the above. + (map_input_to_output_sections, print_statement): Likewise. + +2008-01-15 Kaz Kojima + + * emulparams/shlelf_linux.sh (DATA_START_SYMBOLS): Use PROVIDE + with __data_start. + * emulparams/shelf_nbsd.sh (DATA_START_SYMBOLS): Likewise. + +2008-01-15 Alan Modra + + PR 5604 + * ldlang.c (lang_gc_sections): Move code to set SEC_KEEP on entry + syms to _bfd_elf_gc_keep. + * emultempl/ppc64elf.em (ppc_before_allocation): Don't call + ppc64_elf_edit_opd if no_opd_opt. + +2008-01-11 Tristan Gingold + Eric Botcazou + + * ldlang.c (lang_end): Warns if the entry point is not found when + --gc-sections. + Emit an error if no root is specified when --gc-sections -r. + * ld.texinfo (Options): Document that --gc-sections is compatible + with -r and -q. + * ldmain.c (main): Do not error out if -r and --gc-sections. + * scripttempl/elf.sc: Emit ENTRY command only if relocating. + +2008-01-10 Daniel Jacobowitz + + PR ld/5533 + * ldlang.c (lang_end): Issue a warning for a missing start symbol + of a shared library if the symbol was specified on the command + line. + +2008-01-10 Alan Modra + + * ld.texinfo (--gc-sections): Describe linker behaviour. + +For older changes see ChangeLog-2007 + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff -ruN binutils-2.19/ld/deffilep.c binutils-2.19.1/ld/deffilep.c --- binutils-2.19/ld/deffilep.c 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/ld/deffilep.c 2009-01-14 10:33:13.000000000 +0100 @@ -0,0 +1,2686 @@ +/* A Bison parser, made by GNU Bison 2.1. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NAME = 258, + LIBRARY = 259, + DESCRIPTION = 260, + STACKSIZE = 261, + HEAPSIZE = 262, + CODE = 263, + DATAU = 264, + DATAL = 265, + SECTIONS = 266, + EXPORTS = 267, + IMPORTS = 268, + VERSIONK = 269, + BASE = 270, + CONSTANTU = 271, + CONSTANTL = 272, + PRIVATEU = 273, + PRIVATEL = 274, + READ = 275, + WRITE = 276, + EXECUTE = 277, + SHARED = 278, + NONAMEU = 279, + NONAMEL = 280, + DIRECTIVE = 281, + ID = 282, + NUMBER = 283 + }; +#endif +/* Tokens. */ +#define NAME 258 +#define LIBRARY 259 +#define DESCRIPTION 260 +#define STACKSIZE 261 +#define HEAPSIZE 262 +#define CODE 263 +#define DATAU 264 +#define DATAL 265 +#define SECTIONS 266 +#define EXPORTS 267 +#define IMPORTS 268 +#define VERSIONK 269 +#define BASE 270 +#define CONSTANTU 271 +#define CONSTANTL 272 +#define PRIVATEU 273 +#define PRIVATEL 274 +#define READ 275 +#define WRITE 276 +#define EXECUTE 277 +#define SHARED 278 +#define NONAMEU 279 +#define NONAMEL 280 +#define DIRECTIVE 281 +#define ID 282 +#define NUMBER 283 + + + + +/* Copy the first part of user declarations. */ +#line 1 "deffilep.y" + /* deffilep.y - parser for .def files */ + +/* Copyright 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007 + Free Software Foundation, Inc. + + This file is part of GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "libiberty.h" +#include "safe-ctype.h" +#include "bfd.h" +#include "ld.h" +#include "ldmisc.h" +#include "deffile.h" + +#define TRACE 0 + +#define ROUND_UP(a, b) (((a)+((b)-1))&~((b)-1)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), + as well as gratuitiously global symbol names, so we can have multiple + yacc generated parsers in ld. Note that these are only the variables + produced by yacc. If other parser generators (bison, byacc, etc) produce + additional global names that conflict at link time, then those parser + generators need to be fixed instead of adding those names to this list. */ + +#define yymaxdepth def_maxdepth +#define yyparse def_parse +#define yylex def_lex +#define yyerror def_error +#define yylval def_lval +#define yychar def_char +#define yydebug def_debug +#define yypact def_pact +#define yyr1 def_r1 +#define yyr2 def_r2 +#define yydef def_def +#define yychk def_chk +#define yypgo def_pgo +#define yyact def_act +#define yyexca def_exca +#define yyerrflag def_errflag +#define yynerrs def_nerrs +#define yyps def_ps +#define yypv def_pv +#define yys def_s +#define yy_yys def_yys +#define yystate def_state +#define yytmp def_tmp +#define yyv def_v +#define yy_yyv def_yyv +#define yyval def_val +#define yylloc def_lloc +#define yyreds def_reds /* With YYDEBUG defined. */ +#define yytoks def_toks /* With YYDEBUG defined. */ +#define yylhs def_yylhs +#define yylen def_yylen +#define yydefred def_yydefred +#define yydgoto def_yydgoto +#define yysindex def_yysindex +#define yyrindex def_yyrindex +#define yygindex def_yygindex +#define yytable def_yytable +#define yycheck def_yycheck + +static void def_description (const char *); +static void def_exports (const char *, const char *, int, int); +static void def_heapsize (int, int); +static void def_import (const char *, const char *, const char *, const char *, + int); +static void def_image_name (const char *, int, int); +static void def_section (const char *, int); +static void def_section_alt (const char *, const char *); +static void def_stacksize (int, int); +static void def_version (int, int); +static void def_directive (char *); +static int def_parse (void); +static int def_error (const char *); +static int def_lex (void); + +static int lex_forced_token = 0; +static const char *lex_parse_string = 0; +static const char *lex_parse_string_end = 0; + + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 102 "deffilep.y" +typedef union YYSTYPE { + char *id; + int number; +} YYSTYPE; +/* Line 196 of yacc.c. */ +#line 247 "deffilep.c" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 219 of yacc.c. */ +#line 259 "deffilep.c" + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined (__GNUC__) && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 40 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 121 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 33 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 20 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 63 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 96 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 283 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 31, 2, 29, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 30, 2, 2, 32, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned char yyprhs[] = +{ + 0, 0, 3, 6, 8, 12, 16, 19, 23, 27, + 30, 33, 36, 39, 42, 45, 50, 53, 54, 56, + 59, 65, 69, 70, 72, 74, 76, 78, 80, 82, + 84, 86, 89, 91, 99, 107, 113, 119, 125, 129, + 132, 134, 137, 140, 144, 146, 148, 149, 152, 153, + 155, 157, 159, 161, 163, 167, 168, 171, 172, 175, + 176, 180, 181, 183 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 34, 0, -1, 34, 35, -1, 35, -1, 3, 48, + 51, -1, 4, 48, 51, -1, 5, 27, -1, 6, + 28, 46, -1, 7, 28, 46, -1, 8, 44, -1, + 9, 44, -1, 11, 42, -1, 12, 36, -1, 13, + 40, -1, 14, 28, -1, 14, 28, 29, 28, -1, + 26, 27, -1, -1, 37, -1, 36, 37, -1, 52, + 50, 49, 45, 38, -1, 39, 45, 38, -1, -1, + 24, -1, 25, -1, 16, -1, 17, -1, 9, -1, + 10, -1, 18, -1, 19, -1, 40, 41, -1, 41, + -1, 27, 30, 27, 29, 27, 29, 27, -1, 27, + 30, 27, 29, 27, 29, 28, -1, 27, 30, 27, + 29, 27, -1, 27, 30, 27, 29, 28, -1, 27, + 29, 27, 29, 27, -1, 27, 29, 27, -1, 42, + 43, -1, 43, -1, 27, 44, -1, 27, 27, -1, + 44, 45, 47, -1, 47, -1, 31, -1, -1, 31, + 28, -1, -1, 20, -1, 21, -1, 22, -1, 23, + -1, 27, -1, 27, 29, 27, -1, -1, 32, 28, + -1, -1, 30, 52, -1, -1, 15, 30, 28, -1, + -1, 27, -1, 52, 29, 27, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned char yyrline[] = +{ + 0, 119, 119, 120, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 140, 142, 143, + 150, 157, 158, 161, 162, 163, 164, 165, 166, 167, + 168, 171, 172, 176, 177, 178, 179, 180, 181, 185, + 186, 190, 191, 195, 196, 200, 201, 203, 204, 208, + 209, 210, 211, 214, 215, 221, 225, 226, 230, 231, + 234, 235, 238, 239 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "NAME", "LIBRARY", "DESCRIPTION", + "STACKSIZE", "HEAPSIZE", "CODE", "DATAU", "DATAL", "SECTIONS", "EXPORTS", + "IMPORTS", "VERSIONK", "BASE", "CONSTANTU", "CONSTANTL", "PRIVATEU", + "PRIVATEL", "READ", "WRITE", "EXECUTE", "SHARED", "NONAMEU", "NONAMEL", + "DIRECTIVE", "ID", "NUMBER", "'.'", "'='", "','", "'@'", "$accept", + "start", "command", "explist", "expline", "exp_opt_list", "exp_opt", + "implist", "impline", "seclist", "secline", "attr_list", "opt_comma", + "opt_number", "attr", "opt_name", "opt_ordinal", "opt_equal_name", + "opt_base", "dot_name", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 46, + 61, 44, 64 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 33, 34, 34, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, + 37, 38, 38, 39, 39, 39, 39, 39, 39, 39, + 39, 40, 40, 41, 41, 41, 41, 41, 41, 42, + 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, + 47, 47, 47, 48, 48, 48, 49, 49, 50, 50, + 51, 51, 52, 52 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 2, 1, 3, 3, 2, 3, 3, 2, + 2, 2, 2, 2, 2, 4, 2, 0, 1, 2, + 5, 3, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 7, 7, 5, 5, 5, 3, 2, + 1, 2, 2, 3, 1, 1, 0, 2, 0, 1, + 1, 1, 1, 1, 3, 0, 2, 0, 2, 0, + 3, 0, 1, 3 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 0, 55, 55, 0, 0, 0, 0, 0, 0, 17, + 0, 0, 0, 0, 3, 53, 61, 61, 6, 48, + 48, 49, 50, 51, 52, 9, 44, 10, 0, 11, + 40, 62, 12, 18, 59, 0, 13, 32, 14, 16, + 1, 2, 0, 0, 4, 5, 0, 7, 8, 45, + 0, 42, 41, 39, 19, 0, 0, 57, 0, 0, + 31, 0, 54, 0, 47, 43, 63, 58, 0, 46, + 38, 0, 15, 60, 56, 22, 0, 0, 27, 28, + 25, 26, 29, 30, 23, 24, 20, 46, 37, 35, + 36, 22, 0, 21, 33, 34 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yysigned_char yydefgoto[] = +{ + -1, 13, 14, 32, 33, 86, 87, 36, 37, 29, + 30, 25, 50, 47, 26, 16, 69, 57, 44, 34 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -55 +static const yysigned_char yypact[] = +{ + 16, -9, -9, 5, 22, 29, 41, 41, 31, 32, + 38, 39, 42, 0, -55, 37, 53, 53, -55, 40, + 40, -55, -55, -55, -55, 18, -55, 18, 33, 31, + -55, -55, 32, -55, -28, -13, 38, -55, 43, -55, + -55, -55, 46, 44, -55, -55, 47, -55, -55, -55, + 41, -55, 18, -55, -55, 49, 32, 45, 51, 52, + -55, 54, -55, 55, -55, -55, -55, 56, 58, 50, + 59, 60, -55, -55, -55, 27, 57, 7, -55, -55, + -55, -55, -55, -55, -55, -55, -55, 50, -55, 61, + -55, 27, 20, -55, -55, -55 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yysigned_char yypgoto[] = +{ + -55, -55, 67, -55, 62, -21, -55, -55, 63, -55, + 64, 3, -54, 71, 48, 85, -55, -55, 75, 65 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -47 +static const yysigned_char yytable[] = +{ + 40, 55, 56, 1, 2, 3, 4, 5, 6, 7, + 27, 8, 9, 10, 11, 75, 58, 59, 15, 1, + 2, 3, 4, 5, 6, 7, 12, 8, 9, 10, + 11, 52, 18, 91, 89, 90, 78, 79, -46, -46, + -46, -46, 12, 80, 81, 82, 83, 94, 95, 49, + 19, 84, 85, 21, 22, 23, 24, 20, 28, 31, + 51, 21, 22, 23, 24, 35, 42, 38, 43, 39, + 93, 46, 61, 62, 63, 64, 66, 68, 70, 71, + 41, 49, 72, 73, 88, 55, 74, 17, 76, 77, + 92, 48, 45, 53, 54, 0, 0, 0, 65, 60, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67 +}; + +static const yysigned_char yycheck[] = +{ + 0, 29, 30, 3, 4, 5, 6, 7, 8, 9, + 7, 11, 12, 13, 14, 69, 29, 30, 27, 3, + 4, 5, 6, 7, 8, 9, 26, 11, 12, 13, + 14, 28, 27, 87, 27, 28, 9, 10, 20, 21, + 22, 23, 26, 16, 17, 18, 19, 27, 28, 31, + 28, 24, 25, 20, 21, 22, 23, 28, 27, 27, + 27, 20, 21, 22, 23, 27, 29, 28, 15, 27, + 91, 31, 29, 27, 30, 28, 27, 32, 27, 27, + 13, 31, 28, 28, 27, 29, 28, 2, 29, 29, + 29, 20, 17, 29, 32, -1, -1, -1, 50, 36, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 56 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 11, 12, + 13, 14, 26, 34, 35, 27, 48, 48, 27, 28, + 28, 20, 21, 22, 23, 44, 47, 44, 27, 42, + 43, 27, 36, 37, 52, 27, 40, 41, 28, 27, + 0, 35, 29, 15, 51, 51, 31, 46, 46, 31, + 45, 27, 44, 43, 37, 29, 30, 50, 29, 30, + 41, 29, 27, 30, 28, 47, 27, 52, 32, 49, + 27, 27, 28, 28, 28, 45, 29, 29, 9, 10, + 16, 17, 18, 19, 24, 25, 38, 39, 27, 27, + 28, 45, 29, 38, 27, 28 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif +{ + const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; +} +# endif +# endif + +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */ + + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else +int +yyparse () + ; +#endif +#endif +{ + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + short int *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short int *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a look-ahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to look-ahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; + + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 124 "deffilep.y" + { def_image_name ((yyvsp[-1].id), (yyvsp[0].number), 0); } + break; + + case 5: +#line 125 "deffilep.y" + { def_image_name ((yyvsp[-1].id), (yyvsp[0].number), 1); } + break; + + case 6: +#line 126 "deffilep.y" + { def_description ((yyvsp[0].id));} + break; + + case 7: +#line 127 "deffilep.y" + { def_stacksize ((yyvsp[-1].number), (yyvsp[0].number));} + break; + + case 8: +#line 128 "deffilep.y" + { def_heapsize ((yyvsp[-1].number), (yyvsp[0].number));} + break; + + case 9: +#line 129 "deffilep.y" + { def_section ("CODE", (yyvsp[0].number));} + break; + + case 10: +#line 130 "deffilep.y" + { def_section ("DATA", (yyvsp[0].number));} + break; + + case 14: +#line 134 "deffilep.y" + { def_version ((yyvsp[0].number), 0);} + break; + + case 15: +#line 135 "deffilep.y" + { def_version ((yyvsp[-2].number), (yyvsp[0].number));} + break; + + case 16: +#line 136 "deffilep.y" + { def_directive ((yyvsp[0].id));} + break; + + case 20: +#line 151 "deffilep.y" + { def_exports ((yyvsp[-4].id), (yyvsp[-3].id), (yyvsp[-2].number), (yyvsp[0].number)); } + break; + + case 21: +#line 157 "deffilep.y" + { (yyval.number) = (yyvsp[-2].number) | (yyvsp[0].number); } + break; + + case 22: +#line 158 "deffilep.y" + { (yyval.number) = 0; } + break; + + case 23: +#line 161 "deffilep.y" + { (yyval.number) = 1; } + break; + + case 24: +#line 162 "deffilep.y" + { (yyval.number) = 1; } + break; + + case 25: +#line 163 "deffilep.y" + { (yyval.number) = 2; } + break; + + case 26: +#line 164 "deffilep.y" + { (yyval.number) = 2; } + break; + + case 27: +#line 165 "deffilep.y" + { (yyval.number) = 4; } + break; + + case 28: +#line 166 "deffilep.y" + { (yyval.number) = 4; } + break; + + case 29: +#line 167 "deffilep.y" + { (yyval.number) = 8; } + break; + + case 30: +#line 168 "deffilep.y" + { (yyval.number) = 8; } + break; + + case 33: +#line 176 "deffilep.y" + { def_import ((yyvsp[-6].id), (yyvsp[-4].id), (yyvsp[-2].id), (yyvsp[0].id), -1); } + break; + + case 34: +#line 177 "deffilep.y" + { def_import ((yyvsp[-6].id), (yyvsp[-4].id), (yyvsp[-2].id), 0, (yyvsp[0].number)); } + break; + + case 35: +#line 178 "deffilep.y" + { def_import ((yyvsp[-4].id), (yyvsp[-2].id), 0, (yyvsp[0].id), -1); } + break; + + case 36: +#line 179 "deffilep.y" + { def_import ((yyvsp[-4].id), (yyvsp[-2].id), 0, 0, (yyvsp[0].number)); } + break; + + case 37: +#line 180 "deffilep.y" + { def_import ( 0, (yyvsp[-4].id), (yyvsp[-2].id), (yyvsp[0].id), -1); } + break; + + case 38: +#line 181 "deffilep.y" + { def_import ( 0, (yyvsp[-2].id), 0, (yyvsp[0].id), -1); } + break; + + case 41: +#line 190 "deffilep.y" + { def_section ((yyvsp[-1].id), (yyvsp[0].number));} + break; + + case 42: +#line 191 "deffilep.y" + { def_section_alt ((yyvsp[-1].id), (yyvsp[0].id));} + break; + + case 43: +#line 195 "deffilep.y" + { (yyval.number) = (yyvsp[-2].number) | (yyvsp[0].number); } + break; + + case 44: +#line 196 "deffilep.y" + { (yyval.number) = (yyvsp[0].number); } + break; + + case 47: +#line 203 "deffilep.y" + { (yyval.number)=(yyvsp[0].number);} + break; + + case 48: +#line 204 "deffilep.y" + { (yyval.number)=-1;} + break; + + case 49: +#line 208 "deffilep.y" + { (yyval.number) = 1;} + break; + + case 50: +#line 209 "deffilep.y" + { (yyval.number) = 2;} + break; + + case 51: +#line 210 "deffilep.y" + { (yyval.number)=4;} + break; + + case 52: +#line 211 "deffilep.y" + { (yyval.number)=8;} + break; + + case 53: +#line 214 "deffilep.y" + { (yyval.id) = (yyvsp[0].id); } + break; + + case 54: +#line 216 "deffilep.y" + { + char *name = xmalloc (strlen ((yyvsp[-2].id)) + 1 + strlen ((yyvsp[0].id)) + 1); + sprintf (name, "%s.%s", (yyvsp[-2].id), (yyvsp[0].id)); + (yyval.id) = name; + } + break; + + case 55: +#line 221 "deffilep.y" + { (yyval.id) = ""; } + break; + + case 56: +#line 225 "deffilep.y" + { (yyval.number) = (yyvsp[0].number);} + break; + + case 57: +#line 226 "deffilep.y" + { (yyval.number) = -1;} + break; + + case 58: +#line 230 "deffilep.y" + { (yyval.id) = (yyvsp[0].id); } + break; + + case 59: +#line 231 "deffilep.y" + { (yyval.id) = 0; } + break; + + case 60: +#line 234 "deffilep.y" + { (yyval.number) = (yyvsp[0].number);} + break; + + case 61: +#line 235 "deffilep.y" + { (yyval.number) = -1;} + break; + + case 62: +#line 238 "deffilep.y" + { (yyval.id) = (yyvsp[0].id); } + break; + + case 63: +#line 240 "deffilep.y" + { + char *name = xmalloc (strlen ((yyvsp[-2].id)) + 1 + strlen ((yyvsp[0].id)) + 1); + sprintf (name, "%s.%s", (yyvsp[-2].id), (yyvsp[0].id)); + (yyval.id) = name; + } + break; + + + default: break; + } + +/* Line 1126 of yacc.c. */ +#line 1588 "deffilep.c" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } + } + else +#endif /* YYERROR_VERBOSE */ + yyerror (YY_("syntax error")); + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (0) + goto yyerrorlab; + +yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK; + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; +} + + +#line 248 "deffilep.y" + + +/***************************************************************************** + API + *****************************************************************************/ + +static FILE *the_file; +static const char *def_filename; +static int linenumber; +static def_file *def; +static int saw_newline; + +struct directive + { + struct directive *next; + char *name; + int len; + }; + +static struct directive *directives = 0; + +def_file * +def_file_empty (void) +{ + def_file *rv = xmalloc (sizeof (def_file)); + memset (rv, 0, sizeof (def_file)); + rv->is_dll = -1; + rv->base_address = (bfd_vma) -1; + rv->stack_reserve = rv->stack_commit = -1; + rv->heap_reserve = rv->heap_commit = -1; + rv->version_major = rv->version_minor = -1; + return rv; +} + +def_file * +def_file_parse (const char *filename, def_file *add_to) +{ + struct directive *d; + + the_file = fopen (filename, "r"); + def_filename = filename; + linenumber = 1; + if (!the_file) + { + perror (filename); + return 0; + } + if (add_to) + { + def = add_to; + } + else + { + def = def_file_empty (); + } + + saw_newline = 1; + if (def_parse ()) + { + def_file_free (def); + fclose (the_file); + return 0; + } + + fclose (the_file); + + for (d = directives; d; d = d->next) + { +#if TRACE + printf ("Adding directive %08x `%s'\n", d->name, d->name); +#endif + def_file_add_directive (def, d->name, d->len); + } + + return def; +} + +void +def_file_free (def_file *def) +{ + int i; + + if (!def) + return; + if (def->name) + free (def->name); + if (def->description) + free (def->description); + + if (def->section_defs) + { + for (i = 0; i < def->num_section_defs; i++) + { + if (def->section_defs[i].name) + free (def->section_defs[i].name); + if (def->section_defs[i].class) + free (def->section_defs[i].class); + } + free (def->section_defs); + } + + if (def->exports) + { + for (i = 0; i < def->num_exports; i++) + { + if (def->exports[i].internal_name + && def->exports[i].internal_name != def->exports[i].name) + free (def->exports[i].internal_name); + if (def->exports[i].name) + free (def->exports[i].name); + } + free (def->exports); + } + + if (def->imports) + { + for (i = 0; i < def->num_imports; i++) + { + if (def->imports[i].internal_name + && def->imports[i].internal_name != def->imports[i].name) + free (def->imports[i].internal_name); + if (def->imports[i].name) + free (def->imports[i].name); + } + free (def->imports); + } + + while (def->modules) + { + def_file_module *m = def->modules; + def->modules = def->modules->next; + free (m); + } + + free (def); +} + +#ifdef DEF_FILE_PRINT +void +def_file_print (FILE *file, def_file *def) +{ + int i; + + fprintf (file, ">>>> def_file at 0x%08x\n", def); + if (def->name) + fprintf (file, " name: %s\n", def->name ? def->name : "(unspecified)"); + if (def->is_dll != -1) + fprintf (file, " is dll: %s\n", def->is_dll ? "yes" : "no"); + if (def->base_address != (bfd_vma) -1) + fprintf (file, " base address: 0x%08x\n", def->base_address); + if (def->description) + fprintf (file, " description: `%s'\n", def->description); + if (def->stack_reserve != -1) + fprintf (file, " stack reserve: 0x%08x\n", def->stack_reserve); + if (def->stack_commit != -1) + fprintf (file, " stack commit: 0x%08x\n", def->stack_commit); + if (def->heap_reserve != -1) + fprintf (file, " heap reserve: 0x%08x\n", def->heap_reserve); + if (def->heap_commit != -1) + fprintf (file, " heap commit: 0x%08x\n", def->heap_commit); + + if (def->num_section_defs > 0) + { + fprintf (file, " section defs:\n"); + + for (i = 0; i < def->num_section_defs; i++) + { + fprintf (file, " name: `%s', class: `%s', flags:", + def->section_defs[i].name, def->section_defs[i].class); + if (def->section_defs[i].flag_read) + fprintf (file, " R"); + if (def->section_defs[i].flag_write) + fprintf (file, " W"); + if (def->section_defs[i].flag_execute) + fprintf (file, " X"); + if (def->section_defs[i].flag_shared) + fprintf (file, " S"); + fprintf (file, "\n"); + } + } + + if (def->num_exports > 0) + { + fprintf (file, " exports:\n"); + + for (i = 0; i < def->num_exports; i++) + { + fprintf (file, " name: `%s', int: `%s', ordinal: %d, flags:", + def->exports[i].name, def->exports[i].internal_name, + def->exports[i].ordinal); + if (def->exports[i].flag_private) + fprintf (file, " P"); + if (def->exports[i].flag_constant) + fprintf (file, " C"); + if (def->exports[i].flag_noname) + fprintf (file, " N"); + if (def->exports[i].flag_data) + fprintf (file, " D"); + fprintf (file, "\n"); + } + } + + if (def->num_imports > 0) + { + fprintf (file, " imports:\n"); + + for (i = 0; i < def->num_imports; i++) + { + fprintf (file, " int: %s, from: `%s', name: `%s', ordinal: %d\n", + def->imports[i].internal_name, + def->imports[i].module, + def->imports[i].name, + def->imports[i].ordinal); + } + } + + if (def->version_major != -1) + fprintf (file, " version: %d.%d\n", def->version_major, def->version_minor); + + fprintf (file, "<<<< def_file at 0x%08x\n", def); +} +#endif + +def_file_export * +def_file_add_export (def_file *def, + const char *external_name, + const char *internal_name, + int ordinal) +{ + def_file_export *e; + int max_exports = ROUND_UP(def->num_exports, 32); + + if (def->num_exports >= max_exports) + { + max_exports = ROUND_UP(def->num_exports + 1, 32); + if (def->exports) + def->exports = xrealloc (def->exports, + max_exports * sizeof (def_file_export)); + else + def->exports = xmalloc (max_exports * sizeof (def_file_export)); + } + e = def->exports + def->num_exports; + memset (e, 0, sizeof (def_file_export)); + if (internal_name && !external_name) + external_name = internal_name; + if (external_name && !internal_name) + internal_name = external_name; + e->name = xstrdup (external_name); + e->internal_name = xstrdup (internal_name); + e->ordinal = ordinal; + def->num_exports++; + return e; +} + +def_file_module * +def_get_module (def_file *def, const char *name) +{ + def_file_module *s; + + for (s = def->modules; s; s = s->next) + if (strcmp (s->name, name) == 0) + return s; + + return NULL; +} + +static def_file_module * +def_stash_module (def_file *def, const char *name) +{ + def_file_module *s; + + if ((s = def_get_module (def, name)) != NULL) + return s; + s = xmalloc (sizeof (def_file_module) + strlen (name)); + s->next = def->modules; + def->modules = s; + s->user_data = 0; + strcpy (s->name, name); + return s; +} + +def_file_import * +def_file_add_import (def_file *def, + const char *name, + const char *module, + int ordinal, + const char *internal_name) +{ + def_file_import *i; + int max_imports = ROUND_UP (def->num_imports, 16); + + if (def->num_imports >= max_imports) + { + max_imports = ROUND_UP (def->num_imports+1, 16); + + if (def->imports) + def->imports = xrealloc (def->imports, + max_imports * sizeof (def_file_import)); + else + def->imports = xmalloc (max_imports * sizeof (def_file_import)); + } + i = def->imports + def->num_imports; + memset (i, 0, sizeof (def_file_import)); + if (name) + i->name = xstrdup (name); + if (module) + i->module = def_stash_module (def, module); + i->ordinal = ordinal; + if (internal_name) + i->internal_name = xstrdup (internal_name); + else + i->internal_name = i->name; + def->num_imports++; + + return i; +} + +struct +{ + char *param; + int token; +} +diropts[] = +{ + { "-heap", HEAPSIZE }, + { "-stack", STACKSIZE }, + { "-attr", SECTIONS }, + { "-export", EXPORTS }, + { 0, 0 } +}; + +void +def_file_add_directive (def_file *my_def, const char *param, int len) +{ + def_file *save_def = def; + const char *pend = param + len; + char * tend = (char *) param; + int i; + + def = my_def; + + while (param < pend) + { + while (param < pend + && (ISSPACE (*param) || *param == '\n' || *param == 0)) + param++; + + if (param == pend) + break; + + /* Scan forward until we encounter any of: + - the end of the buffer + - the start of a new option + - a newline seperating options + - a NUL seperating options. */ + for (tend = (char *) (param + 1); + (tend < pend + && !(ISSPACE (tend[-1]) && *tend == '-') + && *tend != '\n' && *tend != 0); + tend++) + ; + + for (i = 0; diropts[i].param; i++) + { + int len = strlen (diropts[i].param); + + if (tend - param >= len + && strncmp (param, diropts[i].param, len) == 0 + && (param[len] == ':' || param[len] == ' ')) + { + lex_parse_string_end = tend; + lex_parse_string = param + len + 1; + lex_forced_token = diropts[i].token; + saw_newline = 0; + if (def_parse ()) + continue; + break; + } + } + + if (!diropts[i].param) + { + char saved; + + saved = * tend; + * tend = 0; + /* xgettext:c-format */ + einfo (_("Warning: .drectve `%s' unrecognized\n"), param); + * tend = saved; + } + + lex_parse_string = 0; + param = tend; + } + + def = save_def; +} + +/* Parser Callbacks. */ + +static void +def_image_name (const char *name, int base, int is_dll) +{ + /* If a LIBRARY or NAME statement is specified without a name, there is nothing + to do here. We retain the output filename specified on command line. */ + if (*name) + { + const char* image_name = lbasename (name); + if (image_name != name) + einfo ("%s:%d: Warning: path components stripped from %s, '%s'\n", + def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", + name); + if (def->name) + free (def->name); + /* Append the default suffix, if none specified. */ + if (strchr (image_name, '.') == 0) + { + const char * suffix = is_dll ? ".dll" : ".exe"; + + def->name = xmalloc (strlen (image_name) + strlen (suffix) + 1); + sprintf (def->name, "%s%s", image_name, suffix); + } + else + def->name = xstrdup (image_name); + } + + /* Honor a BASE address statement, even if LIBRARY string is empty. */ + def->base_address = base; + def->is_dll = is_dll; +} + +static void +def_description (const char *text) +{ + int len = def->description ? strlen (def->description) : 0; + + len += strlen (text) + 1; + if (def->description) + { + def->description = xrealloc (def->description, len); + strcat (def->description, text); + } + else + { + def->description = xmalloc (len); + strcpy (def->description, text); + } +} + +static void +def_stacksize (int reserve, int commit) +{ + def->stack_reserve = reserve; + def->stack_commit = commit; +} + +static void +def_heapsize (int reserve, int commit) +{ + def->heap_reserve = reserve; + def->heap_commit = commit; +} + +static void +def_section (const char *name, int attr) +{ + def_file_section *s; + int max_sections = ROUND_UP (def->num_section_defs, 4); + + if (def->num_section_defs >= max_sections) + { + max_sections = ROUND_UP (def->num_section_defs+1, 4); + + if (def->section_defs) + def->section_defs = xrealloc (def->section_defs, + max_sections * sizeof (def_file_import)); + else + def->section_defs = xmalloc (max_sections * sizeof (def_file_import)); + } + s = def->section_defs + def->num_section_defs; + memset (s, 0, sizeof (def_file_section)); + s->name = xstrdup (name); + if (attr & 1) + s->flag_read = 1; + if (attr & 2) + s->flag_write = 1; + if (attr & 4) + s->flag_execute = 1; + if (attr & 8) + s->flag_shared = 1; + + def->num_section_defs++; +} + +static void +def_section_alt (const char *name, const char *attr) +{ + int aval = 0; + + for (; *attr; attr++) + { + switch (*attr) + { + case 'R': + case 'r': + aval |= 1; + break; + case 'W': + case 'w': + aval |= 2; + break; + case 'X': + case 'x': + aval |= 4; + break; + case 'S': + case 's': + aval |= 8; + break; + } + } + def_section (name, aval); +} + +static void +def_exports (const char *external_name, + const char *internal_name, + int ordinal, + int flags) +{ + def_file_export *dfe; + + if (!internal_name && external_name) + internal_name = external_name; +#if TRACE + printf ("def_exports, ext=%s int=%s\n", external_name, internal_name); +#endif + + dfe = def_file_add_export (def, external_name, internal_name, ordinal); + if (flags & 1) + dfe->flag_noname = 1; + if (flags & 2) + dfe->flag_constant = 1; + if (flags & 4) + dfe->flag_data = 1; + if (flags & 8) + dfe->flag_private = 1; +} + +static void +def_import (const char *internal_name, + const char *module, + const char *dllext, + const char *name, + int ordinal) +{ + char *buf = 0; + const char *ext = dllext ? dllext : "dll"; + + buf = xmalloc (strlen (module) + strlen (ext) + 2); + sprintf (buf, "%s.%s", module, ext); + module = buf; + + def_file_add_import (def, name, module, ordinal, internal_name); + if (buf) + free (buf); +} + +static void +def_version (int major, int minor) +{ + def->version_major = major; + def->version_minor = minor; +} + +static void +def_directive (char *str) +{ + struct directive *d = xmalloc (sizeof (struct directive)); + + d->next = directives; + directives = d; + d->name = xstrdup (str); + d->len = strlen (str); +} + +static int +def_error (const char *err) +{ + einfo ("%P: %s:%d: %s\n", + def_filename ? def_filename : "", linenumber, err); + return 0; +} + + +/* Lexical Scanner. */ + +#undef TRACE +#define TRACE 0 + +/* Never freed, but always reused as needed, so no real leak. */ +static char *buffer = 0; +static int buflen = 0; +static int bufptr = 0; + +static void +put_buf (char c) +{ + if (bufptr == buflen) + { + buflen += 50; /* overly reasonable, eh? */ + if (buffer) + buffer = xrealloc (buffer, buflen + 1); + else + buffer = xmalloc (buflen + 1); + } + buffer[bufptr++] = c; + buffer[bufptr] = 0; /* not optimal, but very convenient. */ +} + +static struct +{ + char *name; + int token; +} +tokens[] = +{ + { "BASE", BASE }, + { "CODE", CODE }, + { "CONSTANT", CONSTANTU }, + { "constant", CONSTANTL }, + { "DATA", DATAU }, + { "data", DATAL }, + { "DESCRIPTION", DESCRIPTION }, + { "DIRECTIVE", DIRECTIVE }, + { "EXECUTE", EXECUTE }, + { "EXPORTS", EXPORTS }, + { "HEAPSIZE", HEAPSIZE }, + { "IMPORTS", IMPORTS }, + { "LIBRARY", LIBRARY }, + { "NAME", NAME }, + { "NONAME", NONAMEU }, + { "noname", NONAMEL }, + { "PRIVATE", PRIVATEU }, + { "private", PRIVATEL }, + { "READ", READ }, + { "SECTIONS", SECTIONS }, + { "SEGMENTS", SECTIONS }, + { "SHARED", SHARED }, + { "STACKSIZE", STACKSIZE }, + { "VERSION", VERSIONK }, + { "WRITE", WRITE }, + { 0, 0 } +}; + +static int +def_getc (void) +{ + int rv; + + if (lex_parse_string) + { + if (lex_parse_string >= lex_parse_string_end) + rv = EOF; + else + rv = *lex_parse_string++; + } + else + { + rv = fgetc (the_file); + } + if (rv == '\n') + saw_newline = 1; + return rv; +} + +static int +def_ungetc (int c) +{ + if (lex_parse_string) + { + lex_parse_string--; + return c; + } + else + return ungetc (c, the_file); +} + +static int +def_lex (void) +{ + int c, i, q; + + if (lex_forced_token) + { + i = lex_forced_token; + lex_forced_token = 0; +#if TRACE + printf ("lex: forcing token %d\n", i); +#endif + return i; + } + + c = def_getc (); + + /* Trim leading whitespace. */ + while (c != EOF && (c == ' ' || c == '\t') && saw_newline) + c = def_getc (); + + if (c == EOF) + { +#if TRACE + printf ("lex: EOF\n"); +#endif + return 0; + } + + if (saw_newline && c == ';') + { + do + { + c = def_getc (); + } + while (c != EOF && c != '\n'); + if (c == '\n') + return def_lex (); + return 0; + } + + /* Must be something else. */ + saw_newline = 0; + + if (ISDIGIT (c)) + { + bufptr = 0; + while (c != EOF && (ISXDIGIT (c) || (c == 'x'))) + { + put_buf (c); + c = def_getc (); + } + if (c != EOF) + def_ungetc (c); + yylval.number = strtoul (buffer, 0, 0); +#if TRACE + printf ("lex: `%s' returns NUMBER %d\n", buffer, yylval.number); +#endif + return NUMBER; + } + + if (ISALPHA (c) || strchr ("$:-_?@", c)) + { + bufptr = 0; + q = c; + put_buf (c); + c = def_getc (); + + if (q == '@') + { + if (ISBLANK (c) ) /* '@' followed by whitespace. */ + return (q); + else if (ISDIGIT (c)) /* '@' followed by digit. */ + { + def_ungetc (c); + return (q); + } +#if TRACE + printf ("lex: @ returns itself\n"); +#endif + } + + while (c != EOF && (ISALNUM (c) || strchr ("$:-_?/@", c))) + { + put_buf (c); + c = def_getc (); + } + if (c != EOF) + def_ungetc (c); + if (ISALPHA (q)) /* Check for tokens. */ + { + for (i = 0; tokens[i].name; i++) + if (strcmp (tokens[i].name, buffer) == 0) + { +#if TRACE + printf ("lex: `%s' is a string token\n", buffer); +#endif + return tokens[i].token; + } + } +#if TRACE + printf ("lex: `%s' returns ID\n", buffer); +#endif + yylval.id = xstrdup (buffer); + return ID; + } + + if (c == '\'' || c == '"') + { + q = c; + c = def_getc (); + bufptr = 0; + + while (c != EOF && c != q) + { + put_buf (c); + c = def_getc (); + } + yylval.id = xstrdup (buffer); +#if TRACE + printf ("lex: `%s' returns ID\n", buffer); +#endif + return ID; + } + + if (c == '=' || c == '.' || c == ',') + { +#if TRACE + printf ("lex: `%c' returns itself\n", c); +#endif + return c; + } + + if (c == '\n') + { + linenumber++; + saw_newline = 1; + } + + /*printf ("lex: 0x%02x ignored\n", c); */ + return def_lex (); +} + diff -ruN binutils-2.19/ld/deffilep.h binutils-2.19.1/ld/deffilep.h --- binutils-2.19/ld/deffilep.h 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/ld/deffilep.h 2009-01-14 10:33:13.000000000 +0100 @@ -0,0 +1,107 @@ +/* A Bison parser, made by GNU Bison 2.1. */ + +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NAME = 258, + LIBRARY = 259, + DESCRIPTION = 260, + STACKSIZE = 261, + HEAPSIZE = 262, + CODE = 263, + DATAU = 264, + DATAL = 265, + SECTIONS = 266, + EXPORTS = 267, + IMPORTS = 268, + VERSIONK = 269, + BASE = 270, + CONSTANTU = 271, + CONSTANTL = 272, + PRIVATEU = 273, + PRIVATEL = 274, + READ = 275, + WRITE = 276, + EXECUTE = 277, + SHARED = 278, + NONAMEU = 279, + NONAMEL = 280, + DIRECTIVE = 281, + ID = 282, + NUMBER = 283 + }; +#endif +/* Tokens. */ +#define NAME 258 +#define LIBRARY 259 +#define DESCRIPTION 260 +#define STACKSIZE 261 +#define HEAPSIZE 262 +#define CODE 263 +#define DATAU 264 +#define DATAL 265 +#define SECTIONS 266 +#define EXPORTS 267 +#define IMPORTS 268 +#define VERSIONK 269 +#define BASE 270 +#define CONSTANTU 271 +#define CONSTANTL 272 +#define PRIVATEU 273 +#define PRIVATEL 274 +#define READ 275 +#define WRITE 276 +#define EXECUTE 277 +#define SHARED 278 +#define NONAMEU 279 +#define NONAMEL 280 +#define DIRECTIVE 281 +#define ID 282 +#define NUMBER 283 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 102 "deffilep.y" +typedef union YYSTYPE { + char *id; + int number; +} YYSTYPE; +/* Line 1447 of yacc.c. */ +#line 99 "deffilep.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +extern YYSTYPE yylval; + + + diff -ruN binutils-2.19/ld/Makefile.am binutils-2.19.1/ld/Makefile.am --- binutils-2.19/ld/Makefile.am 2008-09-09 10:02:19.000000000 +0200 +++ binutils-2.19.1/ld/Makefile.am 2008-12-23 14:54:51.000000000 +0100 @@ -758,9 +758,9 @@ $(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S if ../gas/as-new --version \ | grep 'target.*spu' >/dev/null 2>/dev/null; then \ - cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s + cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \ ../gas/as-new -o spu_ovl.o spu_ovl.s; \ - ../binutils/bin2c $@ + ../binutils/bin2c $@; \ fi eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \ $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} @@ -1914,7 +1914,8 @@ # Stuff that should be included in a distribution. The diststuff # target is run by the taz target in ../Makefile.in. -EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c $(man_MANS) +EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \ + deffilep.c deffilep.h $(man_MANS) diststuff: info $(EXTRA_DIST) all: info ld.1 diff -ruN binutils-2.19/ld/Makefile.in binutils-2.19.1/ld/Makefile.in --- binutils-2.19/ld/Makefile.in 2008-09-09 10:02:19.000000000 +0200 +++ binutils-2.19.1/ld/Makefile.in 2008-12-23 14:54:52.000000000 +0100 @@ -730,7 +730,9 @@ # Stuff that should be included in a distribution. The diststuff # target is run by the taz target in ../Makefile.in. -EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c $(man_MANS) +EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.o_c \ + deffilep.c deffilep.h $(man_MANS) + DISTCLEANFILES = tdirs site.exp site.bak stringify.sed $(am__append_1) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -1588,9 +1590,9 @@ $(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S if ../gas/as-new --version \ | grep 'target.*spu' >/dev/null 2>/dev/null; then \ - cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s + cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \ ../gas/as-new -o spu_ovl.o spu_ovl.s; \ - ../binutils/bin2c $@ + ../binutils/bin2c $@; \ fi eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \ $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} diff -ruN binutils-2.19/ld/pe-dll.c binutils-2.19.1/ld/pe-dll.c --- binutils-2.19/ld/pe-dll.c 2008-08-17 05:12:50.000000000 +0200 +++ binutils-2.19.1/ld/pe-dll.c 2009-01-14 09:50:00.000000000 +0100 @@ -1,6 +1,6 @@ /* Routines to help build PEI-format DLLs (Win32 etc) Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008 Free Software Foundation, Inc. + 2008, 2009 Free Software Foundation, Inc. Written by DJ Delorie This file is part of the GNU Binutils. @@ -314,6 +314,7 @@ { STRING_COMMA_LEN ("libcegcc") }, { STRING_COMMA_LEN ("libcygwin") }, { STRING_COMMA_LEN ("libgcc") }, + { STRING_COMMA_LEN ("libgcc_s") }, { STRING_COMMA_LEN ("libstdc++") }, { STRING_COMMA_LEN ("libmingw32") }, { STRING_COMMA_LEN ("libmingwex") }, @@ -324,6 +325,37 @@ { NULL, 0 } }; +/* Regardless of the suffix issue mentioned above, we must ensure that + we do not falsely match on a leading substring, such as when libtool + builds libstdc++ as a DLL using libsupc++convenience.a as an intermediate. + This routine ensures that the leading part of the name matches and that + it is followed by only an optional version suffix and a file extension, + returning zero if so or -1 if not. */ +static int libnamencmp (const char *libname, const autofilter_entry_type *afptr) +{ + if (strncmp (libname, afptr->name, afptr->len)) + return -1; + + libname += afptr->len; + + /* Be liberal in interpreting what counts as a version suffix; we + accept anything that has a dash to separate it from the name and + begins with a digit. */ + if (libname[0] == '-') + { + if (!ISDIGIT (*++libname)) + return -1; + /* Ensure the filename has an extension. */ + while (*++libname != '.') + if (!*libname) + return -1; + } + else if (libname[0] != '.') + return -1; + + return 0; +} + static const autofilter_entry_type autofilter_objlist[] = { { STRING_COMMA_LEN ("crt0.o") }, @@ -501,7 +533,7 @@ while (afptr->name) { - if (strncmp (libname, afptr->name, afptr->len) == 0 ) + if (libnamencmp (libname, afptr) == 0 ) return 0; afptr++; } diff -ruN binutils-2.19/ld/testsuite/ChangeLog binutils-2.19.1/ld/testsuite/ChangeLog --- binutils-2.19/ld/testsuite/ChangeLog 2008-10-02 12:08:04.000000000 +0200 +++ binutils-2.19.1/ld/testsuite/ChangeLog 2009-01-14 10:04:14.000000000 +0100 @@ -1,3 +1,8 @@ +2009-01-14 Joseph Myers + + * ld-arm/thumb2-bl-undefweak.d, ld-arm/thumb2-bl-undefweak.s: New. + * ld-arm/arm-elf.exp: Run thumb2-bl-undefweak test. + 2008-09-30 Alan Modra * ld-elf/extract-symbol-1sec.d: Correct section lma. diff -ruN binutils-2.19/ld/testsuite/ld-arm/arm-elf.exp binutils-2.19.1/ld/testsuite/ld-arm/arm-elf.exp --- binutils-2.19/ld/testsuite/ld-arm/arm-elf.exp 2008-08-26 13:46:41.000000000 +0200 +++ binutils-2.19.1/ld/testsuite/ld-arm/arm-elf.exp 2009-01-14 10:03:23.000000000 +0100 @@ -184,6 +184,7 @@ run_dump_test "group-relocs-ldr-bad" run_dump_test "group-relocs-ldrs-bad" run_dump_test "group-relocs-ldc-bad" +run_dump_test "thumb2-bl-undefweak" run_dump_test "emit-relocs1" # Exclude non-ARM-EABI targets. diff -ruN binutils-2.19/ld/testsuite/ld-arm/thumb2-bl-undefweak.d binutils-2.19.1/ld/testsuite/ld-arm/thumb2-bl-undefweak.d --- binutils-2.19/ld/testsuite/ld-arm/thumb2-bl-undefweak.d 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/ld/testsuite/ld-arm/thumb2-bl-undefweak.d 2009-01-14 10:03:23.000000000 +0100 @@ -0,0 +1,9 @@ +#source: thumb2-bl-undefweak.s +#as: +#ld: -shared +#objdump: -dr +#... +Disassembly of section .text: + +.* : + .*: .... .... blx ... diff -ruN binutils-2.19/ld/testsuite/ld-arm/thumb2-bl-undefweak.s binutils-2.19.1/ld/testsuite/ld-arm/thumb2-bl-undefweak.s --- binutils-2.19/ld/testsuite/ld-arm/thumb2-bl-undefweak.s 1970-01-01 01:00:00.000000000 +0100 +++ binutils-2.19.1/ld/testsuite/ld-arm/thumb2-bl-undefweak.s 2009-01-14 10:03:23.000000000 +0100 @@ -0,0 +1,10 @@ +@ Test that calls to undefined weak functions resolve to call through +@ the PLT in shared libraries. + + .arch armv7 + .syntax unified + .text + .thumb_func +foo: + bl bar + .weak bar diff -ruN binutils-2.19/md5.sum binutils-2.19.1/md5.sum --- binutils-2.19/md5.sum 2008-10-16 15:49:12.000000000 +0200 +++ binutils-2.19.1/md5.sum 2009-02-02 12:55:04.000000000 +0100 @@ -38,7 +38,7 @@ dbb0d89c90d6c0ec79eb003a5b63f923 bfd/ChangeLog-9899 d618facc3e8ce8bf3d02ba452e1be6ab bfd/MAINTAINERS 02230b383322ce93d12d75493b5e1e43 bfd/Makefile.in -f89440d4a53089529d031f604d9eddf8 bfd/configure +6c81c180924bd80f91d902512c258dd6 bfd/configure 6455e3c85b31e588ecb75f7d3c945c8d bfd/PORTING 2d6a5be3f5d1b33251fe9a8570e943d8 bfd/README cd26654c6eb30680694867e434e40044 bfd/TODO @@ -89,7 +89,7 @@ a8c2c8dd8cfb3224c942a7f58d9fa8a1 bfd/doc/bfdt.texi 4b33b6b08bb48adc10e22145f85589fb bfd/doc/archures.texi 2afdf80182d7d816eb993fe194d378a3 bfd/doc/cache.texi -f121095404aa26155d1eae244a168c73 bfd/doc/bfdver.texi +08f7405617d2e7599a3c3fae1bc06d3b bfd/doc/bfdver.texi 4bdaf36b0c11f0b77d1cc779bdb97c91 bfd/doc/core.texi c60b298f07f5a175f2325d48bd009bdb bfd/doc/elf.texi d41d8cd98f00b204e9800998ecf8427e bfd/doc/elfcode.texi @@ -153,7 +153,7 @@ 9638d42f61f8e51f100043a25939d1e0 bfd/compress.c 42fc088946ad7edf6ecc6164356375c8 bfd/config.bfd 35edceb888cfaaf5b24f541150485224 bfd/config.in -ec1762378d3d7e75f9981006554dc3cb bfd/ChangeLog +200140aca1c32a50a4141390290188d9 bfd/ChangeLog 35a4480c592584b75a828838b20938a0 bfd/po/da.gmo d900f09c506ad5057a3fddd39e3fab7c bfd/po/BLD-POTFILES.in bc54a6c80e6f68f624f5a6b4cebd6bf6 bfd/po/Make-in @@ -273,11 +273,11 @@ 80271019a0bbb737af67e29976d2e94e bfd/elf-strtab.c 66dfab58767be25c87a3f8297e52379d bfd/elf-vxworks.c fcece4ec5829cd7a597209c75aac00c8 bfd/elf-vxworks.h -961593019af8dd063c99a08990de738e bfd/elf.c +bbb7d34bd7df4c962123fb1913cae58f bfd/elf.c 42c1efc1918415fca01b5679c884cc7c bfd/elf32-am33lin.c 9d03e5cc8b0719b6fdb483746ba834a0 bfd/elf32-arc.c -6abe448f958aef3ee89575924a16a7d2 bfd/elf32-arm.c -04ee0bd26731f6f94c8d058936787fea bfd/elf32-avr.c +75efe1f0e2dc13c955ff4e51ee1d87c4 bfd/elf32-arm.c +34dab0e00420ee0e818692deeb8a500e bfd/elf32-avr.c f6846e8628e2f26f82fea28151906429 bfd/elf32-avr.h 47b944a44194867c3468ea69a23a3f3c bfd/elf32-bfin.c 3f892d5e165c6097e661b797515669ac bfd/elf32-cr16.c @@ -315,7 +315,7 @@ 12c4270a4084fed5b8b6fa038bd0cb3c bfd/elf32-openrisc.c 468e5e58c80e985dfbfa201ce07fe4ba bfd/elf32-or32.c 140b65ea1bdd039c81067900b5124da8 bfd/elf32-pj.c -2b94a73ad4a7fa5b7f839d8bb68f375d bfd/elf32-ppc.c +a2b5ff4c903a7addf095cf392ba28b70 bfd/elf32-ppc.c f854f7a23ce07444b5bed5d3a37c1e70 bfd/elf32-ppc.h d6bd27a534e198b868f6964885649d93 bfd/elf32-s390.c 69ca707013e419bd996194319a49abed bfd/elf32-score.c @@ -483,7 +483,7 @@ b8003ae4d166819093bf96bc13ad2023 bfd/vaxbsd.c 5bb97ac813578d24e257cd46d17809ba bfd/vaxnetbsd.c 54e368663e3a9ea8b03d0759110ecc23 bfd/versados.c -156cc1f23f2a67893e924c69d57edf2a bfd/version.h +0ffd3ad9e8377022756579cff3499920 bfd/version.h 5bd41598a2d2f1be4742692c5b0219b5 bfd/vms-gsd.c 4c6703ae91f6d82783c9f29266f26234 bfd/vms-hdr.c 2bb23ccf0263f7e4efe08764f00c3f29 bfd/vms-misc.c @@ -497,7 +497,7 @@ 11213bf58c2136189edd119d00671f00 bfd/xsym.h f86234230ea7107543f18b4abd37500b bfd/xtensa-isa.c 65bcd88cdd329e4d5f1e971822b19c0c bfd/xtensa-modules.c -36ac13941f12d18b863fdac7258a0165 bfd/configure.in +be82c858b8f95a5ea221e92212b027f4 bfd/configure.in 27593fe986db44e4f4d86da9a4893aeb binutils/doc/Makefile.am 6438a16c82585f3b8099ef4655c1511d binutils/doc/Makefile.in 9e959ec1aa21bd05f99da2a6ae069ae0 binutils/doc/binutils.texi @@ -552,7 +552,7 @@ 4c57a9a18cfc80f61d50b29eb703d561 binutils/po/zh_CN.gmo d66dc645567221704d9a96af2951ec0f binutils/po/zh_TW.gmo e531e05e52412093aba62e8529d3dd49 binutils/BRANCHES -ac9d44916b7e80ed9d3e0e2bab9c4020 binutils/ChangeLog +8bd4a7ba1d18dd35f9522e19675bcf0b binutils/ChangeLog 75f03b546abf41db936b3eae9ee79760 binutils/ChangeLog-0001 ac9c338a84bd8da1d3be610a39a75c38 binutils/ChangeLog-0203 e3940b38e6baee310a1565e098d2d9ba binutils/ChangeLog-2004 @@ -593,7 +593,7 @@ 258331420edaa38a130ec1fabe6943d7 binutils/deflex.l 289c16c03bd0a5635985188b7f12e6ea binutils/defparse.y 6a1aa45234cb503771f22ae15efc0f2c binutils/dep-in.sed -9849cecfb97702f80e4be783dab090ae binutils/dlltool.c +66e36721bc3fc0883212b6bf196c1bf4 binutils/dlltool.c 52e2e0a05ec5d5693ac0288e26527f9a binutils/dlltool.h 1de7fee09a3817d8e4fd6a411d5c1e55 binutils/dllwrap.c 99d1c87348048e2553e52f6f8b32288c binutils/dwarf.c @@ -645,7 +645,7 @@ 188dd4f5d4bc4c112c8c34fa75097068 binutils/unwind-ia64.h b888af63fcfda2fc8551893f9dfa80ed binutils/version.c 6f04a867b4162f787fb1781f3ae2a83a binutils/windint.h -da48a630357f20ce596c49aa51db4c6c binutils/windmc.c +f442d0fde84d288d0e36b4f6eb1a378f binutils/windmc.c 4a301e97590dbfcc2f7e9c2850ba1bff binutils/windmc.h ae273cc3da6ea43a6589d7ac12b07cd9 binutils/windres.c 906f283c22c019d009b11770338477aa binutils/windres.h @@ -1012,7 +1012,7 @@ 22dce6a65547b031a610f2d96397ea87 gas/config/tc-mcore.h 836e023d48ebbe074c47563c96410449 gas/config/tc-mep.c d6341517bf77615f1f1603df07c70206 gas/config/tc-mep.h -4b8fd5129a9475130a5da46be33e0707 gas/config/tc-mips.c +564c069931202e4aa35c09151640e956 gas/config/tc-mips.c 3098783bc1330f77ee4f1be440b21665 gas/config/tc-mips.h c33e919e0ccff6628d075be8eec5c679 gas/config/tc-mmix.c 6a251a02f0d127cbeee8303079cf71dc gas/config/tc-mmix.h @@ -1112,7 +1112,7 @@ ee8de9cf71dcc35a1d9bbd5ade4f0d76 gas/config/te-solaris.h 53db0ab868dc9516af2c5ab97a8450f0 gas/CONTRIBUTORS d32239bcb673463ab874e80d47fae504 gas/COPYING -b1a6614d2a9e48373a235aea1e1e9f28 gas/ChangeLog +40b2386af966022d09a9f169252e5d2b gas/ChangeLog ffefbc0a746d455b0fc30fcb92cf820b gas/ChangeLog-0001 7625b084c87a7ae4de541a6bbf88fe45 gas/ChangeLog-0203 7ee4a40be5732a4dc9b8f09dd534dffa gas/ChangeLog-2004 @@ -1123,14 +1123,15 @@ 2ca0a735423063fa9757a564336be2f4 gas/ChangeLog-9697 e6aed0ab8c1b1b6bcfdae6d97862b880 gas/ChangeLog-9899 d618facc3e8ce8bf3d02ba452e1be6ab gas/MAINTAINERS -941dd584ef99bf6460c22ec4b519faae gas/Makefile.am -1bbd663108d0b17867ad6d59743aa7d5 gas/Makefile.in +784551dc1ce033969244c93adeeed345 gas/Makefile.am +fa1f4c0314b1333991cc26be915be784 gas/Makefile.in 8578664879818304e4efcec982cd3235 gas/NEWS 7d90db3f78994d389f96376160c78e79 gas/README 41e29feacddfc18d0a64ae0084319697 gas/acinclude.m4 68031c11e9810aab73f345106d75bd19 gas/aclocal.m4 d77f26eb9c74f2ead15089b9f466f364 gas/app.c 47473dca8f94de2de0e5842b048036ea gas/as.c +e577cec29aa06ca106aff705214c2627 gas/ehopt.c ad6e009680755c9297d4af220cb80934 gas/as.h e25637964415c4475a64a2a5c7cb963b gas/asintl.h 51ce9f284ca1d90dad3041e03a10acac gas/atof-generic.c @@ -1146,13 +1147,12 @@ 6d0569055d44d0f97c1e1702be38e606 gas/debug.c 12c785802f870b496877bd8b942c5e8b gas/dep-in.sed fdc62a08d3bf358495e7dddb6f080eb0 gas/depend.c -7da98b30cd4adad9e30add76a227a665 gas/dw2gencfi.c +638044fda26b7ee7fe916ebc1a87b679 gas/dw2gencfi.c 8acc6efe425696861ed82e7d2b8a55a0 gas/dw2gencfi.h 1090ab888a8b42a2c0d7b6807fc2fd02 gas/dwarf2dbg.c 368bb77dc23c4424d2c3c19fd031c54a gas/dwarf2dbg.h ba1768a2d3538f62f58b76fc870b474a gas/ecoff.c 077dc984642d5b66395d3d85249b2b3a gas/ecoff.h -1bc821d0399dae0a77ad71d522a77844 gas/ehopt.c 62f89aeb49cf28cd661a466f9fdd3919 gas/emul-target.h d13c448bddd9d0dc1ffe5888097bcfa7 gas/emul.h f79d4ceffae31de00d79c372f2b65bf9 gas/expr.c @@ -1259,7 +1259,7 @@ 3e890a0b3ab0fdf3474873d5627b21f4 gas/po/rw.gmo f921f25b46f5eda454485a4af9286c90 gas/po/tr.gmo d38e4c9dc972ad516087cf19392d2971 gas/testsuite/config/default.exp -8fc921fecd46403209a002c09d1e981c gas/testsuite/ChangeLog +23bdc615e8e2679ddd94f77693519edb gas/testsuite/ChangeLog 8f4c98fe241e3d57b357137c666fd4ba gas/testsuite/ChangeLog-2004 444eafe82d4d0b3264a408b1fe8b1d2e gas/testsuite/ChangeLog-2005 a89405fc1bad7bc620fc00b28bd62f6c gas/testsuite/ChangeLog-2006 @@ -3857,7 +3857,7 @@ 066c4e7b6705e4be69dee6e1a61e6aa7 gas/testsuite/gas/mips/mips-macro-ill-sfp.s 9a0679f3fa2f92660a5cb12924e0b843 gas/testsuite/gas/mips/mips-no-jalx.l 262aacb1cd28ab8a0f73b85c9608e970 gas/testsuite/gas/mips/mips-no-jalx.s -0382655135964f23baf671b7273da2b9 gas/testsuite/gas/mips/mips.exp +6116ea7a387caca4c6f1331abf88093e gas/testsuite/gas/mips/mips.exp 69fcac4647653e47e7cdb109987121cf gas/testsuite/gas/mips/mips16-64.d 8a910bdd6955f163b663eba25217605b gas/testsuite/gas/mips/mips16-dwarf2-n32.d d1849362896f01c1adf09da894f75c5f gas/testsuite/gas/mips/mips16-dwarf2.d @@ -4061,6 +4061,9 @@ 3e2660b36dd36e1e9b6f89dc54f33109 gas/testsuite/gas/mips/vxworks1-xgot.d 49d8ecc14ff63470df46a1a1a006e6a8 gas/testsuite/gas/mips/vxworks1.d c967b7a1e8670a369febcfcd753e2278 gas/testsuite/gas/mips/vxworks1.s +5b9be032bfcb7a310ff6dba99146380d gas/testsuite/gas/mips/mips1-fp.d +2867b7b4f1e06f673fff3b9f4c1d601e gas/testsuite/gas/mips/mips1-fp.l +670af8eb95b87df0e913a4ff9891a9c7 gas/testsuite/gas/mips/mips1-fp.s 8c4fbc467f6b4539cd2cb9be8da3c582 gas/testsuite/gas/mmix/hex.d 128cd247dc9b5fc1e4095be0175c68b3 gas/testsuite/gas/mmix/1cjmp1b-n.d 74c43d2897673eba56f848f3c9e582e9 gas/testsuite/gas/mmix/1cjmp1b-r.d @@ -5977,8 +5980,8 @@ 8958c5b05a66e6b252f6978095132f7c ld/ChangeLog-9197 b73f002c7cc445237e97e9ed358922e6 ld/ChangeLog-9899 d618facc3e8ce8bf3d02ba452e1be6ab ld/MAINTAINERS -4e996c19ddfd2cee4718eb5e3f31d1ed ld/Makefile.am -d7636d258004bd7de8d8f87cef379a24 ld/Makefile.in +599dbc69ee73a07f11a8bc0406c0ae29 ld/Makefile.am +bb1e45a7bc2efbbc64af72472bd50235 ld/Makefile.in e954f1ba8a25e139a4ecf0177a95c4de ld/NEWS 305f3d03c641bc73c2e6ba871fdfe318 ld/README 01627b664c7e61ab5dc202bb72913e0a ld/TODO @@ -6025,7 +6028,7 @@ e0afa136ebca428a02d73634d400123a ld/lexsup.c bcecc8bf83c852461eb6f6293a2c127f ld/mri.c 2d7a70e6e87dc5b02179e9914072e159 ld/mri.h -894114cceeb8987ca06e92f8dbf1ab78 ld/pe-dll.c +281d5dca5d8adfeb7db55326809729c0 ld/pe-dll.c 24bcf7b5f997a062e45964f52ac80deb ld/pe-dll.h ef8588556fc0d6274b2a7f7411f65160 ld/pep-dll.c 480eb6237bd999e46fcace4b4645430b ld/pep-dll.h @@ -6188,7 +6191,7 @@ 40b944db8315cb484a442a7e3447da39 ld/scripttempl/z80.sc 474b1c82cd04327e7433dd108c93e239 ld/scripttempl/z8000.sc 5f37c4ba4c48fb62bb707eca0c00b661 ld/testsuite/config/default.exp -f3fb6f22ecf0a5dc75173c14a1b59572 ld/testsuite/ChangeLog +b8fd6f616aac8c01900479ea5c6488d6 ld/testsuite/ChangeLog 43821ec3e01aa56c69d031c9cb7aaac6 ld/testsuite/ChangeLog-2004 0593940197fddd34e72d34ad4681e18d ld/testsuite/ChangeLog-2005 13ed49b06cc49649e67f1df2f524946a ld/testsuite/ChangeLog-2006 @@ -6214,6 +6217,7 @@ fa4f4d2a9aa095262c026d8b386826ce ld/testsuite/ld-alpha/tlspic.td 66fa8fd9968bb830ab985fbaf9e9a7b2 ld/testsuite/ld-alpha/tlspic1.s 1be6d8e1547c710f7bc12028c6522832 ld/testsuite/ld-alpha/tlspic2.s +aa7513b9ec64663af4a705c1af066e47 ld/testsuite/ld-arm/arm-elf.exp 9968654653057bdde83f830c1f7755a3 ld/testsuite/ld-arm/arm-app-abs32.d 565634b571c9c9e088fb3416a62705f0 ld/testsuite/ld-arm/arm-app-abs32.r abe5df1b29a8c0085e2b425276030a2b ld/testsuite/ld-arm/arm-app-abs32.s @@ -6227,7 +6231,6 @@ 1eb65e01cb3f72a9a9f674a0a23bfe43 ld/testsuite/ld-arm/arm-call1.s 9135ee4b605fc6176c978325ff45c6e9 ld/testsuite/ld-arm/arm-call2.s 08422e7338327f170663ee64993d2d15 ld/testsuite/ld-arm/arm-dyn.ld -9f524abb2915abe164cd40a81fcdd222 ld/testsuite/ld-arm/arm-elf.exp 1481ec66c92fa741fa4612c5bc5b33d6 ld/testsuite/ld-arm/arm-lib-plt32.d a167e469316cdd1ed8af41301205f0a0 ld/testsuite/ld-arm/arm-lib-plt32.r 72d35e1785ba54a876601fb0dbeeab24 ld/testsuite/ld-arm/arm-lib-plt32.s @@ -6392,6 +6395,8 @@ 165ed1561458c0973255f985be876845 ld/testsuite/ld-arm/vxworks2-static.sd e191cf28ec5e3f69a0d89dd051130471 ld/testsuite/ld-arm/vxworks2.s 7afb4e2fc8be35ad985dcb2e21b7cbef ld/testsuite/ld-arm/vxworks2.sd +1a510d271e9f75413c8bdc4c64ac5e5a ld/testsuite/ld-arm/thumb2-bl-undefweak.d +ba0a6eb7d3d568f8fe1d9293b5420aea ld/testsuite/ld-arm/thumb2-bl-undefweak.s 36694f46c8326776e26979232de2ab01 ld/testsuite/ld-auto-import/auto-import.exp 870d0c9532413d40575e2e793eaf0f48 ld/testsuite/ld-auto-import/client.c bc025b399dc1bf0e5fe050e08b235dff ld/testsuite/ld-auto-import/dll.c @@ -8761,13 +8766,16 @@ 74dc12cdbe5ac4b2c634e5dc8b770127 ld/testsuite/ld-xtensa/tlspic2.s 2f4d300c622bfb7444899f021a279fae ld/testsuite/ld-xtensa/xtensa.exp c2ffc8c8d78958ade52fb4757efb7c31 ld/testsuite/lib/ld-lib.exp -303bfcb49745b0e5c215baa3e838ec32 ld/ChangeLog +ad7d93108b3f5fa4cad1416f0b2220f7 ld/ChangeLog cca300ff00d329ce550f14830aa9e1dd ld/ld.1 9c4a0cca6be74361714e3a547f7bed6d ld/configdoc.texi 174343e2b48cf513d62e4586516c43b0 ld/ld.info fd6b00f11daf5e5650fd128689f3b064 ld/ldgram.c 90d28d55191b9f0eebb32bb5ae307667 ld/ldgram.h 717bc6b97e7ee275a941ff92ecd5661c ld/ldlex.c +90ca79eb95e07bbb0e4834ada28af642 ld/ChangeLog-2008 +3391be4f995d3a8da3ba9a33e9a04ed3 ld/deffilep.c +aef9d5440e015f7f562802969aa25f0f ld/deffilep.h bed73a98fd3178ecd9433e0f6a3ed214 libiberty/vsnprintf.c a916467b91076e631dd8edb7424769c7 libiberty/COPYING.LIB 90aff50fda4ce60348a63b3daecca6b9 libiberty/ChangeLog @@ -8922,7 +8930,7 @@ fbe2467afef81c41c166173adeb0ee20 mkdep 64e8ff72710e830f15a347863b848c7d mkinstalldirs a20215c156b06261d944ae7f30a3b75c move-if-change -b1fe8bde9666640fd5a3d7bf6c7d824a opcodes/ChangeLog +3725f912737a5047d022681c0a5255af opcodes/ChangeLog 1b4b8646bdc7ad5a2f9071d8ac8b024e opcodes/ChangeLog-0001 83ac14eead5eda1862cc926b82d35cea opcodes/ChangeLog-0203 d4cca6dd9882292b6f2e17604bed6cbd opcodes/ChangeLog-2004 @@ -9055,7 +9063,7 @@ b9c537f04116c50ff96c3bb6018fda24 opcodes/m32r-opinst.c e9cf6f7e3d7b2fe30060886214c4310b opcodes/m68hc11-dis.c ad9c9708644da65234eefff9c4612b8b opcodes/m68hc11-opc.c -df98e1f9eb054585aa8d49850e427ad9 opcodes/m68k-dis.c +1c0815132b46f5f6141969dce98d97b4 opcodes/m68k-dis.c dae7dd85a2570046068493d3315602f7 opcodes/m68k-opc.c cfd5f3ab32dee93a9ef1bcfb3fc07e40 opcodes/m88k-dis.c d129eed92c6947db4372b285656ef9a1 opcodes/makefile.vms @@ -9129,7 +9137,7 @@ 7c044dbd081ea712eb68d6fbffe19b00 opcodes/pj-dis.c 5b71b88cadcb5a40b87df9d7c96a1aff opcodes/pj-opc.c 1dbeb625202737009ad1a5b8bed7463c opcodes/ppc-dis.c -d168b9afcac0fe2ae4ff51891a0d1eec opcodes/ppc-opc.c +b3a8e5efaf195dcedea501b0a2920776 opcodes/ppc-opc.c 5a13b780c32dedded8a1cb7e0efed557 opcodes/s390-dis.c e6994596680f9f334d974420c3e41c5d opcodes/s390-mkopc.c 6a1d982f2e1406f6e64090e85019fed4 opcodes/s390-opc.c diff -ruN binutils-2.19/opcodes/ChangeLog binutils-2.19.1/opcodes/ChangeLog --- binutils-2.19/opcodes/ChangeLog 2008-10-02 10:07:19.000000000 +0200 +++ binutils-2.19.1/opcodes/ChangeLog 2008-12-23 14:54:52.000000000 +0100 @@ -1,3 +1,20 @@ +2008-11-27 Alan Modra + + * ppc-opc.c (extract_sprg): Correct operand range check. + +2008-11-26 Andreas Schwab + + * m68k-dis.c (NEXTBYTE, NEXTWORD, NEXTLONG, NEXTULONG, NEXTSINGLE) + (NEXTDOUBLE, NEXTEXTEND, NEXTPACKED): Fix error handling. + (save_printer, save_print_address): Remove. + (fetch_data): Don't use them. + (match_insn_m68k): Always restore printing functions. + (print_insn_m68k): Don't save/restore printing functions. + +2008-11-25 Nick Clifton + + * m68k-dis.c: Rewrite to remove use of setjmp/longjmp. + 2008-09-29 Nick Clifton * po/vi.po: Updated Vietnamese translation. diff -ruN binutils-2.19/opcodes/m68k-dis.c binutils-2.19.1/opcodes/m68k-dis.c --- binutils-2.19/opcodes/m68k-dis.c 2007-09-27 13:14:10.000000000 +0200 +++ binutils-2.19.1/opcodes/m68k-dis.c 2008-12-23 14:54:52.000000000 +0100 @@ -60,46 +60,103 @@ #endif /* Get a 1 byte signed integer. */ -#define NEXTBYTE(p) (p += 2, FETCH_DATA (info, p), COERCE_SIGNED_CHAR(p[-1])) +#define NEXTBYTE(p, val) \ + do \ + { \ + p += 2; \ + if (!FETCH_DATA (info, p)) \ + return -3; \ + val = COERCE_SIGNED_CHAR (p[-1]); \ + } \ + while (0) /* Get a 2 byte signed integer. */ #define COERCE16(x) ((int) (((x) ^ 0x8000) - 0x8000)) -#define NEXTWORD(p) \ - (p += 2, FETCH_DATA (info, p), \ - COERCE16 ((p[-2] << 8) + p[-1])) + +#define NEXTWORD(p, val, ret_val) \ + do \ + { \ + p += 2; \ + if (!FETCH_DATA (info, p)) \ + return ret_val; \ + val = COERCE16 ((p[-2] << 8) + p[-1]); \ + } \ + while (0) /* Get a 4 byte signed integer. */ #define COERCE32(x) ((bfd_signed_vma) ((x) ^ 0x80000000) - 0x80000000) -#define NEXTLONG(p) \ - (p += 4, FETCH_DATA (info, p), \ - (COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]))) + +#define NEXTLONG(p, val, ret_val) \ + do \ + { \ + p += 4; \ + if (!FETCH_DATA (info, p)) \ + return ret_val; \ + val = COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \ + } \ + while (0) /* Get a 4 byte unsigned integer. */ -#define NEXTULONG(p) \ - (p += 4, FETCH_DATA (info, p), \ - (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1])) +#define NEXTULONG(p, val) \ + do \ + { \ + p += 4; \ + if (!FETCH_DATA (info, p)) \ + return -3; \ + val = (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \ + } \ + while (0) /* Get a single precision float. */ -#define NEXTSINGLE(val, p) \ - (p += 4, FETCH_DATA (info, p), \ - floatformat_to_double (&floatformat_ieee_single_big, (char *) p - 4, &val)) +#define NEXTSINGLE(val, p) \ + do \ + { \ + p += 4; \ + if (!FETCH_DATA (info, p)) \ + return -3; \ + floatformat_to_double (& floatformat_ieee_single_big, \ + (char *) p - 4, & val); \ + } \ + while (0) /* Get a double precision float. */ -#define NEXTDOUBLE(val, p) \ - (p += 8, FETCH_DATA (info, p), \ - floatformat_to_double (&floatformat_ieee_double_big, (char *) p - 8, &val)) +#define NEXTDOUBLE(val, p) \ + do \ + { \ + p += 8; \ + if (!FETCH_DATA (info, p)) \ + return -3; \ + floatformat_to_double (& floatformat_ieee_double_big, \ + (char *) p - 8, & val); \ + } \ + while (0) /* Get an extended precision float. */ -#define NEXTEXTEND(val, p) \ - (p += 12, FETCH_DATA (info, p), \ - floatformat_to_double (&floatformat_m68881_ext, (char *) p - 12, &val)) +#define NEXTEXTEND(val, p) \ + do \ + { \ + p += 12; \ + if (!FETCH_DATA (info, p)) \ + return -3; \ + floatformat_to_double (& floatformat_m68881_ext, \ + (char *) p - 12, & val); \ + } \ + while (0) /* Need a function to convert from packed to double precision. Actually, it's easier to print a packed number than a double anyway, so maybe there should be a special case to handle this... */ -#define NEXTPACKED(p) \ - (p += 12, FETCH_DATA (info, p), 0.0) +#define NEXTPACKED(p, val) \ + do \ + { \ + p += 12; \ + if (!FETCH_DATA (info, p)) \ + return -3; \ + val = 0.0; \ + } \ + while (0) + /* Maximum length of an instruction. */ #define MAXLEN 22 @@ -112,12 +169,10 @@ bfd_byte *max_fetched; bfd_byte the_buffer[MAXLEN]; bfd_vma insn_start; - jmp_buf bailout; }; /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) - to ADDR (exclusive) are valid. Returns 1 for success, longjmps - on error. */ + to ADDR (exclusive) are valid. Returns 1 for success, 0 on error. */ #define FETCH_DATA(info, addr) \ ((addr) <= ((struct private *) (info->private_data))->max_fetched \ ? 1 : fetch_data ((info), (addr))) @@ -136,7 +191,7 @@ if (status != 0) { (*info->memory_error_func) (status, start, info); - longjmp (priv->bailout, 1); + return 0; } else priv->max_fetched = addr; @@ -161,7 +216,8 @@ /* Fetch BITS bits from a position in the instruction specified by CODE. CODE is a "place to put an argument", or 'x' for a destination that is a general address (mode and register). - BUFFER contains the instruction. */ + BUFFER contains the instruction. + Returns -1 on failure. */ static int fetch_arg (unsigned char *buffer, @@ -216,64 +272,75 @@ break; case 'k': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[3] >> 4); break; case 'C': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = buffer[3]; break; case '1': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 12; break; case '2': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 6; break; case '3': case 'j': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; break; case '4': - FETCH_DATA (info, buffer + 5); + if (! FETCH_DATA (info, buffer + 5)) + return -1; val = (buffer[4] << 8) + buffer[5]; val >>= 12; break; case '5': - FETCH_DATA (info, buffer + 5); + if (! FETCH_DATA (info, buffer + 5)) + return -1; val = (buffer[4] << 8) + buffer[5]; val >>= 6; break; case '6': - FETCH_DATA (info, buffer + 5); + if (! FETCH_DATA (info, buffer + 5)) + return -1; val = (buffer[4] << 8) + buffer[5]; break; case '7': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 7; break; case '8': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 10; break; case '9': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] << 8) + buffer[3]; val >>= 5; break; @@ -283,7 +350,8 @@ break; case 'E': - FETCH_DATA (info, buffer + 3); + if (! FETCH_DATA (info, buffer + 3)) + return -1; val = (buffer[2] >> 1); break; @@ -450,7 +518,8 @@ /* Print an indexed argument. The base register is BASEREG (-1 for pc). P points to extension word, in buffer. - ADDR is the nominal core address of that extension word. */ + ADDR is the nominal core address of that extension word. + Returns NULL upon error. */ static unsigned char * print_indexed (int basereg, @@ -465,7 +534,7 @@ char buf[40]; char vmabuf[50]; - word = NEXTWORD (p); + NEXTWORD (p, word, NULL); /* Generate the text for the index register. Where this will be output is not yet determined. */ @@ -503,10 +572,10 @@ switch ((word >> 4) & 3) { case 2: - base_disp = NEXTWORD (p); + NEXTWORD (p, base_disp, NULL); break; case 3: - base_disp = NEXTLONG (p); + NEXTLONG (p, base_disp, NULL); } if (basereg == -1) base_disp += addr; @@ -526,10 +595,10 @@ switch (word & 3) { case 2: - outer_disp = NEXTWORD (p); + NEXTWORD (p, outer_disp, NULL); break; case 3: - outer_disp = NEXTLONG (p); + NEXTLONG (p, outer_disp, NULL); } print_base (basereg, base_disp, info); @@ -547,9 +616,18 @@ return p; } +#define FETCH_ARG(size, val) \ + do \ + { \ + val = fetch_arg (buffer, place, size, info); \ + if (val < 0) \ + return -3; \ + } \ + while (0) + /* Returns number of bytes "eaten" by the operand, or return -1 if an invalid operand was found, or -2 if - an opcode tabe error was found. + an opcode tabe error was found or -3 to simply abort. ADDR is the pc for this arg to be relative to. */ static int @@ -575,23 +653,21 @@ case 'c': /* Cache identifier. */ { static char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" }; - val = fetch_arg (buffer, place, 2, info); - (*info->fprintf_func) (info->stream, cacheFieldName[val]); + FETCH_ARG (2, val); + (*info->fprintf_func) (info->stream, cacheFieldName[val]); break; } case 'a': /* Address register indirect only. Cf. case '+'. */ { - (*info->fprintf_func) - (info->stream, - "%s@", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s@", reg_names[val + 8]); break; } case '_': /* 32-bit absolute address for move16. */ { - uval = NEXTULONG (p); + NEXTULONG (p, uval); (*info->print_address_func) (uval, info); break; } @@ -643,7 +719,7 @@ /* Fido added these. */ {"%cac", 0xffe}, {"%mbo", 0xfff}}; - val = fetch_arg (buffer, place, 12, info); + FETCH_ARG (12, val); for (regno = sizeof names / sizeof names[0] - 1; regno >= 0; regno--) if (names[regno].value == val) { @@ -656,7 +732,7 @@ break; case 'Q': - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); /* 0 means 8, except for the bkpt instruction... */ if (val == 0 && d[1] != 's') val = 8; @@ -664,7 +740,7 @@ break; case 'x': - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); /* 0 means -1. */ if (val == 0) val = -1; @@ -672,12 +748,12 @@ break; case 'j': - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); (*info->fprintf_func) (info->stream, "#%d", val+1); break; case 'K': - val = fetch_arg (buffer, place, 9, info); + FETCH_ARG (9, val); (*info->fprintf_func) (info->stream, "#%d", val); break; @@ -685,12 +761,13 @@ if (place == 'h') { static char *const scalefactor_name[] = { "<<", ">>" }; - val = fetch_arg (buffer, place, 1, info); + + FETCH_ARG (1, val); (*info->fprintf_func) (info->stream, scalefactor_name[val]); } else { - val = fetch_arg (buffer, place, 8, info); + FETCH_ARG (8, val); if (val & 0x80) val = val - 0x100; (*info->fprintf_func) (info->stream, "#%d", val); @@ -698,29 +775,27 @@ break; case 'T': - val = fetch_arg (buffer, place, 4, info); + FETCH_ARG (4, val); (*info->fprintf_func) (info->stream, "#%d", val); break; case 'D': - (*info->fprintf_func) (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 3, info)]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s", reg_names[val]); break; case 'A': - (*info->fprintf_func) - (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 3, info) + 010]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s", reg_names[val + 010]); break; case 'R': - (*info->fprintf_func) - (info->stream, "%s", - reg_names[fetch_arg (buffer, place, 4, info)]); + FETCH_ARG (4, val); + (*info->fprintf_func) (info->stream, "%s", reg_names[val]); break; case 'r': - regno = fetch_arg (buffer, place, 4, info); + FETCH_ARG (4, regno); if (regno > 7) (*info->fprintf_func) (info->stream, "%s@", reg_names[regno]); else @@ -728,13 +803,12 @@ break; case 'F': - (*info->fprintf_func) - (info->stream, "%%fp%d", - fetch_arg (buffer, place, 3, info)); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%%fp%d", val); break; case 'O': - val = fetch_arg (buffer, place, 6, info); + FETCH_ARG (6, val); if (val & 0x20) (*info->fprintf_func) (info->stream, "%s", reg_names[val & 7]); else @@ -742,78 +816,78 @@ break; case '+': - (*info->fprintf_func) - (info->stream, "%s@+", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s@+", reg_names[val + 8]); break; case '-': - (*info->fprintf_func) - (info->stream, "%s@-", - reg_names[fetch_arg (buffer, place, 3, info) + 8]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s@-", reg_names[val + 8]); break; case 'k': if (place == 'k') - (*info->fprintf_func) - (info->stream, "{%s}", - reg_names[fetch_arg (buffer, place, 3, info)]); + { + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "{%s}", reg_names[val]); + } else if (place == 'C') { - val = fetch_arg (buffer, place, 7, info); + FETCH_ARG (7, val); if (val > 63) /* This is a signed constant. */ val -= 128; (*info->fprintf_func) (info->stream, "{#%d}", val); } else - return -2; + return -1; break; case '#': case '^': p1 = buffer + (*d == '#' ? 2 : 4); if (place == 's') - val = fetch_arg (buffer, place, 4, info); + FETCH_ARG (4, val); else if (place == 'C') - val = fetch_arg (buffer, place, 7, info); + FETCH_ARG (7, val); else if (place == '8') - val = fetch_arg (buffer, place, 3, info); + FETCH_ARG (3, val); else if (place == '3') - val = fetch_arg (buffer, place, 8, info); + FETCH_ARG (8, val); else if (place == 'b') - val = NEXTBYTE (p1); + NEXTBYTE (p1, val); else if (place == 'w' || place == 'W') - val = NEXTWORD (p1); + NEXTWORD (p1, val, -3); else if (place == 'l') - val = NEXTLONG (p1); + NEXTLONG (p1, val, -3); else return -2; + (*info->fprintf_func) (info->stream, "#%d", val); break; case 'B': if (place == 'b') - disp = NEXTBYTE (p); + NEXTBYTE (p, disp); else if (place == 'B') disp = COERCE_SIGNED_CHAR (buffer[1]); else if (place == 'w' || place == 'W') - disp = NEXTWORD (p); + NEXTWORD (p, disp, -3); else if (place == 'l' || place == 'L' || place == 'C') - disp = NEXTLONG (p); + NEXTLONG (p, disp, -3); else if (place == 'g') { - disp = NEXTBYTE (buffer); + NEXTBYTE (buffer, disp); if (disp == 0) - disp = NEXTWORD (p); + NEXTWORD (p, disp, -3); else if (disp == -1) - disp = NEXTLONG (p); + NEXTLONG (p, disp, -3); } else if (place == 'c') { if (buffer[1] & 0x40) /* If bit six is one, long offset. */ - disp = NEXTLONG (p); + NEXTLONG (p, disp, -3); else - disp = NEXTWORD (p); + NEXTWORD (p, disp, -3); } else return -2; @@ -822,29 +896,32 @@ break; case 'd': - val = NEXTWORD (p); - (*info->fprintf_func) - (info->stream, "%s@(%d)", - reg_names[fetch_arg (buffer, place, 3, info) + 8], val); - break; + { + int val1; + + NEXTWORD (p, val, -3); + FETCH_ARG (3, val1); + (*info->fprintf_func) (info->stream, "%s@(%d)", reg_names[val1 + 8], val); + break; + } case 's': - (*info->fprintf_func) (info->stream, "%s", - fpcr_names[fetch_arg (buffer, place, 3, info)]); + FETCH_ARG (3, val); + (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]); break; case 'e': - val = fetch_arg(buffer, place, 2, info); + FETCH_ARG (2, val); (*info->fprintf_func) (info->stream, "%%acc%d", val); break; case 'g': - val = fetch_arg(buffer, place, 1, info); - (*info->fprintf_func) (info->stream, "%%accext%s", val==0 ? "01" : "23"); + FETCH_ARG (1, val); + (*info->fprintf_func) (info->stream, "%%accext%s", val == 0 ? "01" : "23"); break; case 'i': - val = fetch_arg(buffer, place, 2, info); + FETCH_ARG (2, val); if (val == 1) (*info->fprintf_func) (info->stream, "<<"); else if (val == 3) @@ -856,7 +933,8 @@ case 'I': /* Get coprocessor ID... */ val = fetch_arg (buffer, 'd', 3, info); - + if (val < 0) + return -3; if (val != 1) /* Unusual coprocessor ID? */ (*info->fprintf_func) (info->stream, "(cpid=%d) ", val); break; @@ -888,10 +966,16 @@ if (place == 'd') { val = fetch_arg (buffer, 'x', 6, info); + if (val < 0) + return -3; val = ((val & 7) << 3) + ((val >> 3) & 7); } else - val = fetch_arg (buffer, 's', 6, info); + { + val = fetch_arg (buffer, 's', 6, info); + if (val < 0) + return -3; + } /* If the is invalid for *d, then reject this match. */ if (!m68k_valid_ea (*d, val)) @@ -923,29 +1007,31 @@ break; case 5: - val = NEXTWORD (p); + NEXTWORD (p, val, -3); (*info->fprintf_func) (info->stream, "%s@(%d)", regname, val); break; case 6: p = print_indexed (regno, p, addr, info); + if (p == NULL) + return -3; break; case 7: switch (val & 7) { case 0: - val = NEXTWORD (p); + NEXTWORD (p, val, -3); (*info->print_address_func) (val, info); break; case 1: - uval = NEXTULONG (p); + NEXTULONG (p, uval); (*info->print_address_func) (uval, info); break; case 2: - val = NEXTWORD (p); + NEXTWORD (p, val, -3); (*info->fprintf_func) (info->stream, "%%pc@("); (*info->print_address_func) (addr + val, info); (*info->fprintf_func) (info->stream, ")"); @@ -953,6 +1039,8 @@ case 3: p = print_indexed (-1, p, addr, info); + if (p == NULL) + return -3; break; case 4: @@ -960,17 +1048,17 @@ switch (place) { case 'b': - val = NEXTBYTE (p); + NEXTBYTE (p, val); flt_p = 0; break; case 'w': - val = NEXTWORD (p); + NEXTWORD (p, val, -3); flt_p = 0; break; case 'l': - val = NEXTLONG (p); + NEXTLONG (p, val, -3); flt_p = 0; break; @@ -987,7 +1075,7 @@ break; case 'p': - flval = NEXTPACKED (p); + NEXTPACKED (p, flval); break; default: @@ -1009,7 +1097,7 @@ mask bit and if set, add a '&' to the arg. */ if (place == '/') { - val = fetch_arg (buffer, place, 1, info); + FETCH_ARG (1, val); if (val) info->fprintf_func (info->stream, "&"); } @@ -1021,7 +1109,7 @@ { char doneany; p1 = buffer + 2; - val = NEXTWORD (p1); + NEXTWORD (p1, val, -3); /* Move the pointer ahead if this point is farther ahead than the last. */ p = p1 > p ? p1 : p; @@ -1062,7 +1150,8 @@ { /* `fmovem' insn. */ char doneany; - val = fetch_arg (buffer, place, 8, info); + + FETCH_ARG (8, val); if (val == 0) { (*info->fprintf_func) (info->stream, "#0"); @@ -1096,10 +1185,9 @@ } else if (place == '8') { + FETCH_ARG (3, val); /* fmoveml for FP status registers. */ - (*info->fprintf_func) (info->stream, "%s", - fpcr_names[fetch_arg (buffer, place, 3, - info)]); + (*info->fprintf_func) (info->stream, "%s", fpcr_names[val]); } else return -2; @@ -1115,9 +1203,10 @@ case '2': case '3': { - int val = fetch_arg (buffer, place, 5, info); + int val; char *name = 0; + FETCH_ARG (5, val); switch (val) { case 2: name = "%tt0"; break; @@ -1152,8 +1241,9 @@ case 'f': { - int fc = fetch_arg (buffer, place, 5, info); + int fc; + FETCH_ARG (5, fc); if (fc == 1) (*info->fprintf_func) (info->stream, "%%dfc"); else if (fc == 0) @@ -1170,8 +1260,9 @@ case 't': { - int level = fetch_arg (buffer, place, 3, info); + int level; + FETCH_ARG (3, level); (*info->fprintf_func) (info->stream, "%d", level); } break; @@ -1179,8 +1270,9 @@ case 'u': { short is_upper = 0; - int reg = fetch_arg (buffer, place, 5, info); + int reg; + FETCH_ARG (5, reg); if (reg & 0x10) { is_upper = 1; @@ -1303,7 +1395,7 @@ if (eaten >= 0) p += eaten; - else if (eaten == -1) + else if (eaten == -1 || eaten == -3) { info->fprintf_func = save_printer; info->print_address_func = save_print_address; @@ -1318,7 +1410,7 @@ info->fprintf_func (info->stream, /* xgettext:c-format */ _("\n"), - best->name, best->args); + best->name, best->args); return 2; } } @@ -1439,6 +1531,8 @@ if (d[0] == 's' && d[1] == '8') { val = fetch_arg (buffer, d[1], 3, info); + if (val < 0) + return 0; if ((val & (val - 1)) != 0) break; } @@ -1479,13 +1573,7 @@ bfd_byte *buffer = priv.the_buffer; - /* Save these printing functions in case we need to restore them - later. */ - fprintf_ftype save_printer = info->fprintf_func; - void (* save_print_address) (bfd_vma, struct disassemble_info *) - = info->print_address_func; - - info->private_data = (PTR) &priv; + info->private_data = & priv; /* Tell objdump to use two bytes per chunk and six bytes per line for displaying raw data. */ info->bytes_per_chunk = 2; @@ -1494,49 +1582,23 @@ priv.max_fetched = priv.the_buffer; priv.insn_start = memaddr; - if (setjmp (priv.bailout) != 0) - { - /* longjmp may be called while these printing functions are - temporarily replaced with dummy functions. Restore them - before we leave. - - Admittedly, this save-and-restore operation is somewhat ugly - in that we are exposing the fact that match_insn_m68k - temporarily replaces insn->fprintf_func and - insn->print_address_func. Perhaps, a real fix is to report a - FETCH_DATA failure with a return value of some sort, without - using setjmp/longjmp. A better fix may be to teach the m68k - disassembler do its job without temporarily replacing - insn->fprintf_func and insn->print_address_func, but that's a - task for another day. */ - info->fprintf_func = save_printer; - info->print_address_func = save_print_address; - - /* Error return. */ - return -1; - } - arch_mask = bfd_m68k_mach_to_features (info->mach); if (!arch_mask) { /* First try printing an m680x0 instruction. Try printing a Coldfire one if that fails. */ val = m68k_scan_mask (memaddr, info, m68k_mask); - if (val) - return val; - - val = m68k_scan_mask (memaddr, info, mcf_mask); - if (val) - return val; + if (val == 0) + val = m68k_scan_mask (memaddr, info, mcf_mask); } else { val = m68k_scan_mask (memaddr, info, arch_mask); - if (val) - return val; } - /* Handle undefined instructions. */ - info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]); - return 2; + if (val == 0) + /* Handle undefined instructions. */ + info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]); + + return val ? val : 2; } diff -ruN binutils-2.19/opcodes/ppc-opc.c binutils-2.19.1/opcodes/ppc-opc.c --- binutils-2.19/opcodes/ppc-opc.c 2008-08-14 15:56:00.000000000 +0200 +++ binutils-2.19.1/opcodes/ppc-opc.c 2008-12-23 14:54:52.000000000 +0100 @@ -1281,10 +1281,10 @@ /* mfsprg can use 260..263 and 272..279. mtsprg only uses spr 272..279 If not BOOKE or 405, then both use only 272..275. */ - if (val <= 3 - || (val < 0x10 && (insn & 0x100) != 0) - || (val - 0x10 > 3 - && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_403)) == 0)) + if ((val - 0x10 > 3 && (dialect & (PPC_OPCODE_BOOKE | PPC_OPCODE_405)) == 0) + || (val - 0x10 > 7 && (insn & 0x100) != 0) + || val <= 3 + || (val & 8) != 0) *invalid = 1; return val & 7; }