From b914ad8df0926c5872580bd498674622b2af9f64 Mon Sep 17 00:00:00 2001 From: bebbo Date: Mon, 13 Mar 2017 21:19:09 +0100 Subject: [PATCH] @M added devel1 modifications to starting base --- .project | 11 ++++++ Makefile.in | 2 +- Makefile.tpl | 2 +- bfd/amigaos.c | 1 + bfd/amigaoslink.c | 17 +++++---- bfd/aout-amiga.c | 2 ++ bfd/aoutx.h | 5 +-- bfd/archive.c | 1 + bfd/binary.c | 1 + bfd/configure | 2 +- bfd/configure.in | 2 +- bfd/format.c | 1 + bfd/ihex.c | 7 ++-- bfd/linker.c | 15 +++++--- bfd/reloc.c | 8 ++--- bfd/srec.c | 1 + bfd/stab-syms.c | 1 + bfd/tekhex.c | 1 + binutils/ar.c | 3 +- binutils/arlex.c | 1 + binutils/arparse.c | 1 + binutils/arsup.c | 1 + binutils/binemul.c | 1 + binutils/bucomm.c | 3 ++ binutils/ieee.c | 3 +- binutils/objdump.c | 1 + binutils/prdbg.c | 1 + binutils/rename.c | 1 + binutils/stabs.c | 11 +++--- gas/app.c | 25 +++++++------- gas/config/obj-amigahunk.c | 65 +++++++++++++++++++++++++++++++++++ gas/config/obj-aout.c | 68 ++++++++++++++++++++++++++++++++++++ gas/config/obj-elf.h | 4 +++ gas/config/tc-m68k.c | 4 ++- gas/read.c | 18 +++++++--- gprof/Makefile.in | 2 +- include/dis-asm.h | 1 + include/fopen-same.h | 12 +++---- ld/configure.tgt | 2 +- ld/emulparams/amiga.sh | 1 + ld/emulparams/amiga_bss.sh | 1 + ld/ldexp.c | 4 +-- ld/ldlang.c | 2 +- ld/ldlex.c | 2 +- ld/ldmain.c | 4 +-- libiberty/lrealpath.c | 4 +++ libiberty/pex-os2.c | 3 +- libiberty/pex-win32.c | 2 +- libiberty/physmem.c | 2 +- libiberty/rename.c | 2 +- libiberty/tmpnam.c | 2 +- libiberty/xstrerror.c | 2 +- ltconfig | 5 ++- opcodes/disassemble.c | 4 ++- opcodes/m68k-dis.c | 70 ++++++++++++++++++++++++++++++++++++-- 55 files changed, 344 insertions(+), 74 deletions(-) create mode 100644 .project diff --git a/.project b/.project new file mode 100644 index 0000000..417a705 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + amigaos-binutils-2.14 + + + + + + + + diff --git a/Makefile.in b/Makefile.in index 561dc76..d99e181 100644 --- a/Makefile.in +++ b/Makefile.in @@ -204,7 +204,7 @@ USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ # sub-makes. It lets flags be given on the command line while still # using the makeinfo from the object tree. # (Default to avoid splitting info files.) -MAKEINFOFLAGS = --no-split +MAKEINFOFLAGS = --no-split --force EXPECT = `if [ -f $$r/expect/expect ] ; \ then echo $$r/expect/expect ; \ diff --git a/Makefile.tpl b/Makefile.tpl index 571fa42..e09c83a 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -207,7 +207,7 @@ USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ # sub-makes. It lets flags be given on the command line while still # using the makeinfo from the object tree. # (Default to avoid splitting info files.) -MAKEINFOFLAGS = --no-split +MAKEINFOFLAGS = --no-split --force EXPECT = `if [ -f $$r/expect/expect ] ; \ then echo $$r/expect/expect ; \ diff --git a/bfd/amigaos.c b/bfd/amigaos.c index 9205781..0801d9a 100644 --- a/bfd/amigaos.c +++ b/bfd/amigaos.c @@ -117,6 +117,7 @@ BFD: rewrite of the disassemble functions. */ +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" diff --git a/bfd/amigaoslink.c b/bfd/amigaoslink.c index 888ef2c..8e69a46 100644 --- a/bfd/amigaoslink.c +++ b/bfd/amigaoslink.c @@ -409,9 +409,9 @@ amiga_perform_reloc (abfd, r, data, sec, obfd, error_message) sym=*(r->sym_ptr_ptr); - /* FIXME: XXX */ - if (0 && sym->udata.p) - sym = ((struct generic_link_hash_entry *) sym->udata.p)->sym; +// SBF: no idea what to fix here...?? /* FIXME: XXX */ +// if (0 && sym->udata.p) +// sym = ((struct generic_link_hash_entry *) sym->udata.p)->sym; target_section=sym->section; @@ -609,7 +609,12 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message) } else if (sec->output_section!=target_section->output_section) { - if ((target_section->output_section->flags&SEC_DATA)!=0) + // SBF: the if statement has been fixed, but the linker does no longer work. + // if ((target_section->output_section->flags&SEC_DATA)!=0) + // I replaced it with the old (obvious bogus) statement + // TODO: a better fix? + //if (target_section->output_section->flags & (SEC_DATA != 0)) + if (amiga_base_relative) goto baserel; /* Dirty, but no code duplication.. */ bfd_msg ("pc relative relocation out-of-range in section %s. " "Relocation was to symbol %s",sec->name,sym->name); @@ -624,7 +629,7 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message) { /* Same section, this is a pc relative hunk... */ DPRINT(5,("Reloc to same section...\n")); - relocation=-(r->address+sec->output_offset); + relocation=-(long)(r->address+sec->output_offset); } break; @@ -700,7 +705,7 @@ aout_perform_reloc (abfd, r, data, sec, obfd, error_message) - (AMIGA_DATA(target_section->output_section->owner))->a4init; /* if the symbol is in .bss, subtract the offset that gas has put into the opcode */ - if (target_section->index == 2) + if (target_section->index == 2 && sym->flags != 2) relocation -= adata(abfd).datasec->_raw_size; DPRINT(20,("symbol=%s (0x%lx)\nsection %s (0x%lx; %s; output=0x%lx)" "\nrelocation @0x%lx\n", sym->name, sym->value, diff --git a/bfd/aout-amiga.c b/bfd/aout-amiga.c index ced7584..f73ea99 100644 --- a/bfd/aout-amiga.c +++ b/bfd/aout-amiga.c @@ -18,6 +18,8 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "config.h" + #define TARGETNAME "a.out-amiga" #define MACHTYPE_OK(m) ((m)==M_UNKNOWN || (m)==M_68010 || (m)==M_68020) #define TARGET_IS_BIG_ENDIAN_P diff --git a/bfd/aoutx.h b/bfd/aoutx.h index f3faca6..5e5a3a1 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -118,6 +118,7 @@ DESCRIPTION #define KEEPIT udata.i +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "safe-ctype.h" @@ -998,7 +999,7 @@ adjust_z_magic (abfd, execp) text_pad = ((obj_textsec (abfd)->filepos - obj_textsec (abfd)->vma) & (adata (abfd).page_size - 1)); else - text_pad = ((- obj_textsec (abfd)->vma) + text_pad = ((- (signed)obj_textsec (abfd)->vma) & (adata (abfd).page_size - 1)); } @@ -4727,7 +4728,7 @@ aout_link_write_other_symbol (h, data) H_PUT_16 (output_bfd, 0, outsym.e_desc); indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, FALSE); - if (indx == - (bfd_size_type) 1) + if (indx == (bfd_size_type) -1) { /* FIXME: No way to handle errors. */ abort (); diff --git a/bfd/archive.c b/bfd/archive.c index 00045a3..d4f7340 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -127,6 +127,7 @@ DESCRIPTION " 18 " - Long name 18 characters long, extended pseudo-BSD. */ +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" diff --git a/bfd/binary.c b/bfd/binary.c index a27eb95..530238f 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ the file. objcopy cooperates by specially setting the start address to zero by default. */ +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "safe-ctype.h" diff --git a/bfd/configure b/bfd/configure index 232a366..3a1d3c4 100755 --- a/bfd/configure +++ b/bfd/configure @@ -3249,7 +3249,7 @@ fi # Define the identity of the package. PACKAGE=bfd - VERSION=2.14 + VERSION=2.14a cat >>confdefs.h <<_ACEOF diff --git a/bfd/configure.in b/bfd/configure.in index fa8eeec..3fedebe 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -7,7 +7,7 @@ AC_INIT(libbfd.c) AC_CANONICAL_SYSTEM AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.14) +AM_INIT_AUTOMAKE(bfd, 2.14a) # Uncomment the next line to remove the date from the reported bfd version #is_release=y diff --git a/bfd/format.c b/bfd/format.c index 6415b8d..65be3df 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -40,6 +40,7 @@ SECTION */ +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" diff --git a/bfd/ihex.c b/bfd/ihex.c index 2f4aa56..5440c93 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -119,6 +119,7 @@ The MRI compiler uses this, which is a repeat of type 5: 20..21 Carriage return, line feed */ +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" @@ -366,12 +367,12 @@ ihex_scan (abfd) chksum = len + addr + (addr >> 8) + type; for (i = 0; i < len; i++) chksum += HEX2 (buf + 2 * i); - if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i)) + if (((- (int)chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i)) { (*_bfd_error_handler) (_("%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"), bfd_archive_filename (abfd), lineno, - (- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i)); + (- (int)chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i)); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -788,7 +789,7 @@ ihex_write_record (abfd, count, addr, type, data) chksum += *data; } - TOHEX (p, (- chksum) & 0xff); + TOHEX (p, (- (int)chksum) & 0xff); p[2] = '\r'; p[3] = '\n'; diff --git a/bfd/linker.c b/bfd/linker.c index 375b61d..3be9b2a 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1621,14 +1621,19 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, break; case CDEF: + { /* We have found a definition for a symbol which was previously common. */ - BFD_ASSERT (h->type == bfd_link_hash_common); - if (! ((*info->callbacks->multiple_common) - (info, h->root.string, - h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_defined, (bfd_vma) 0))) + int rr = ((*info->callbacks->multiple_common) + (info, h->root.string, + h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, + abfd, bfd_link_hash_defined, (bfd_vma)0)); + BFD_ASSERT(h->type == bfd_link_hash_common); + if (!rr) return FALSE; + if (rr == 2) /* ignore duplicate symbol */ + break; + } /* Fall through. */ case DEF: case DEFW: diff --git a/bfd/reloc.c b/bfd/reloc.c index 7ebeb99..b4e9270 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -916,7 +916,7 @@ space consuming. For each target: case -2: { long x = bfd_get_32 (abfd, (bfd_byte *) data + octets); - relocation = -relocation; + relocation = -(long)relocation; DOIT (x); bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data + octets); } @@ -925,7 +925,7 @@ space consuming. For each target: case -1: { long x = bfd_get_16 (abfd, (bfd_byte *) data + octets); - relocation = -relocation; + relocation = -(long)relocation; DOIT (x); bfd_put_16 (abfd, (bfd_vma) x, (bfd_byte *) data + octets); } @@ -1300,7 +1300,7 @@ space consuming. For each target: case -2: { long x = bfd_get_32 (abfd, (bfd_byte *) data); - relocation = -relocation; + relocation = -(long)relocation; DOIT (x); bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data); } @@ -1409,7 +1409,7 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location) /* If the size is negative, negate RELOCATION. This isn't very general. */ if (howto->size < 0) - relocation = -relocation; + relocation = -(long)relocation; /* Get the value we are going to relocate. */ size = bfd_get_reloc_size (howto); diff --git a/bfd/srec.c b/bfd/srec.c index cd31907..ee59986 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -104,6 +104,7 @@ DESCRIPTION */ +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" diff --git a/bfd/stab-syms.c b/bfd/stab-syms.c index a685e31..a59c878 100644 --- a/bfd/stab-syms.c +++ b/bfd/stab-syms.c @@ -19,6 +19,7 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" #include "bfd.h" #define ARCH_SIZE 32 /* Value doesn't matter. */ diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 77b471a..b451413 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -67,6 +67,7 @@ The data can come out of order, and may be discontigous. This is a serial protocol, so big files are unlikely, so we keep a list of 8k chunks */ +#include "config.h" #include "bfd.h" #include "sysdep.h" #include "libbfd.h" diff --git a/binutils/ar.c b/binutils/ar.c index 9a6946e..656246a 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -26,6 +26,7 @@ when name truncated. No way to specify pos_end. Error messages should be more consistant. */ +#include "config.h" #include "bfd.h" #include "libiberty.h" #include "progress.h" @@ -351,7 +352,7 @@ static FILE *output_file = NULL; static bfd *output_bfd = NULL; static void -remove_output () +remove_output (void) { if (output_filename != NULL) { diff --git a/binutils/arlex.c b/binutils/arlex.c index 61704d7..1402d70 100644 --- a/binutils/arlex.c +++ b/binutils/arlex.c @@ -20,6 +20,7 @@ #include #include #include +#include /* end standard C headers. */ diff --git a/binutils/arparse.c b/binutils/arparse.c index 3093130..0258328 100644 --- a/binutils/arparse.c +++ b/binutils/arparse.c @@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ */ #define DONTDECLARE_MALLOC +#include "config.h" #include "bfd.h" #include "bucomm.h" #include "arsup.h" diff --git a/binutils/arsup.c b/binutils/arsup.c index b3e9672..c670f62 100644 --- a/binutils/arsup.c +++ b/binutils/arsup.c @@ -25,6 +25,7 @@ This file looks after requests from arparse.y, to provide the MRI style librarian command syntax + 1 word LIST. */ +#include "config.h" #include "bfd.h" #include "arsup.h" #include "libiberty.h" diff --git a/binutils/binemul.c b/binutils/binemul.c index 67aaba8..ae311ea 100644 --- a/binutils/binemul.c +++ b/binutils/binemul.c @@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" #include "binemul.h" extern bin_emulation_xfer_type bin_dummy_emulation; diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 237f934..66cb36a 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -22,6 +22,7 @@ /* We might put this in a library someday so it could be dynamically loaded, but for now it's not necessary. */ +#include "config.h" #include "bfd.h" #include "bfdver.h" #include "libiberty.h" @@ -34,9 +35,11 @@ #ifndef HAVE_TIME_T_IN_TIME_H #ifndef HAVE_TIME_T_IN_TYPES_H +#ifndef _TIME_T_DEFINED typedef long time_t; #endif #endif +#endif static const char * endian_string PARAMS ((enum bfd_endian)); static int display_target_list PARAMS ((void)); diff --git a/binutils/ieee.c b/binutils/ieee.c index c9340cb..29a22de 100644 --- a/binutils/ieee.c +++ b/binutils/ieee.c @@ -21,6 +21,7 @@ /* This file reads and writes IEEE-695 debugging information. */ +#include "config.h" #include #include @@ -3354,7 +3355,7 @@ ieee_read_reference (info, pp) { const bfd_byte *start; bfd_vma flags; - const char *class, *name; + const char *class = 0, *name; unsigned long classlen, namlen; debug_type *pslot; debug_type target; diff --git a/binutils/objdump.c b/binutils/objdump.c index 3c927bd..288bebb 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" #include "bfd.h" #include "bfdver.h" #include "progress.h" diff --git a/binutils/prdbg.c b/binutils/prdbg.c index b29eec6..22afc04 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -22,6 +22,7 @@ /* This file prints out the generic debugging information, by supplying a set of routines to debug_write. */ +#include "config.h" #include #include diff --git a/binutils/rename.c b/binutils/rename.c index 82185b6..5dca249 100644 --- a/binutils/rename.c +++ b/binutils/rename.c @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "config.h" #include "bfd.h" #include "bucomm.h" diff --git a/binutils/stabs.c b/binutils/stabs.c index 91eff59..9482b05 100644 --- a/binutils/stabs.c +++ b/binutils/stabs.c @@ -25,6 +25,7 @@ code. The job it does is somewhat different, because it is not trying to identify the correct address for anything. */ +#include "config.h" #include #include "bfd.h" @@ -333,7 +334,7 @@ parse_number (pp, poverflow) if (! overflow) { if (neg) - v = - v; + v = - (signed)v; return v; } } @@ -4170,7 +4171,7 @@ stab_demangle_qualified (minfo, pp, ptype) ++*pp; if (**pp == 't') { - char *name; + char *name = 0; if (! stab_demangle_template (minfo, pp, ptype != NULL ? &name : NULL)) @@ -4627,7 +4628,7 @@ stab_demangle_arg (minfo, pp, pargs, pcount, palloc) unsigned int *palloc; { const char *start; - debug_type type; + debug_type type = 0; start = *pp; if (! stab_demangle_type (minfo, pp, @@ -4753,7 +4754,7 @@ stab_demangle_type (minfo, pp, ptype) case 'F': /* A function. */ { - debug_type *args; + debug_type *args = 0; bfd_boolean varargs; ++*pp; @@ -5146,7 +5147,7 @@ stab_demangle_fund_type (minfo, pp, ptype) case 't': { - char *name; + char *name = 0; if (! stab_demangle_template (minfo, pp, ptype != NULL ? &name : NULL)) diff --git a/gas/app.c b/gas/app.c index f752962..f11def0 100644 --- a/gas/app.c +++ b/gas/app.c @@ -351,6 +351,8 @@ do_scrub_chars (get, tostart, tolen) char *fromend; int fromlen; register int ch, ch2 = 0; + /* Character that started the string we're working on. */ + static char quotechar; /*State 0: beginning of normal line 1: After first whitespace on line (flush more white) @@ -536,11 +538,8 @@ do_scrub_chars (get, tostart, tolen) for (s = from; s < fromend; s++) { ch = *s; - /* This condition must be changed if the type of any - other character can be LEX_IS_STRINGQUOTE. */ if (ch == '\\' - || ch == '"' - || ch == '\'' + || ch == quotechar || ch == '\n') break; } @@ -558,12 +557,12 @@ do_scrub_chars (get, tostart, tolen) ch = GET (); if (ch == EOF) { - as_warn (_("end of file in string; inserted '\"'")); + as_warn (_("end of file in string; '%c' inserted"), quotechar); state = old_state; UNGET ('\n'); - PUT ('"'); + PUT (quotechar); } - else if (lex[ch] == LEX_IS_STRINGQUOTE) + else if (ch == quotechar) { state = old_state; PUT (ch); @@ -603,8 +602,8 @@ do_scrub_chars (get, tostart, tolen) continue; case EOF: - as_warn (_("end of file in string; '\"' inserted")); - PUT ('"'); + as_warn (_("end of file in string; '%c' inserted"), quotechar); + PUT (quotechar); continue; case '"': @@ -638,10 +637,9 @@ do_scrub_chars (get, tostart, tolen) case 7: ch = GET (); + quotechar = ch; state = 5; old_state = 8; - if (ch == EOF) - goto fromeof; PUT (ch); continue; @@ -952,6 +950,7 @@ do_scrub_chars (get, tostart, tolen) break; case LEX_IS_STRINGQUOTE: + quotechar = ch; if (state == 10) { /* Preserve the whitespace in foo "bar". */ @@ -1279,6 +1278,8 @@ do_scrub_chars (get, tostart, tolen) case 1: *to++ = *from++; } } + if (to >= toend) + goto tofull; ch = GET (); } } @@ -1297,7 +1298,7 @@ do_scrub_chars (get, tostart, tolen) } else if (state == 9) { - if (lex[ch] != LEX_IS_SYMBOL_COMPONENT) + if (!IS_SYMBOL_COMPONENT (ch)) state = 3; } else if (state == 10) diff --git a/gas/config/obj-amigahunk.c b/gas/config/obj-amigahunk.c index 8755475..6c74aff 100644 --- a/gas/config/obj-amigahunk.c +++ b/gas/config/obj-amigahunk.c @@ -42,12 +42,25 @@ enum { static void obj_amiga_line PARAMS ((int)); static void obj_amiga_weak PARAMS ((int)); +static void obj_amiga_section PARAMS((int)); +static char * obj_amiga_section_name PARAMS ((void)); const pseudo_typeS obj_pseudo_table[] = { {"line", obj_amiga_line, 0}, /* source code line number */ {"weak", obj_amiga_weak, 0}, /* mark symbol as weak. */ + {"2byte", cons, 2}, + {"4byte", cons, 4}, + {"8byte", cons, 8}, + {"hidden", s_ignore, 0}, + {"local", s_ignore, 0}, + {"section", obj_amiga_section, 0}, + {"section.s", obj_amiga_section, 0}, + {"sect", obj_amiga_section, 0}, + {"sect.s", obj_amiga_section, 0}, + {"swbeg", s_ignore, 0}, + /* other stuff */ {"ABORT", s_abort, 0}, @@ -170,6 +183,58 @@ obj_amiga_frob_file_before_fix () #endif /* BFD_ASSEMBLER */ +/* Get name of section. */ +static char * +obj_amiga_section_name () +{ + char *name; + + SKIP_WHITESPACE (); + if (*input_line_pointer == '"') + { + int dummy; + + name = demand_copy_C_string (&dummy); + if (name == NULL) + { + ignore_rest_of_line (); + return NULL; + } + } + else + { + char *end = input_line_pointer; + + while (0 == strchr ("\n\t,; ", *end)) + end++; + if (end == input_line_pointer) + { + as_warn (_("missing name")); + ignore_rest_of_line (); + return NULL; + } + + name = xmalloc (end - input_line_pointer + 1); + memcpy (name, input_line_pointer, end - input_line_pointer); + name[end - input_line_pointer] = '\0'; + input_line_pointer = end; + } + SKIP_WHITESPACE (); + return name; +} + + +static void obj_amiga_section(int push) { + char const * name = obj_amiga_section_name(); + if (name == NULL) + return; + + if (0 == strcmp(".rodata", name)) + s_text(); + else + s_data(); +} + static void obj_amiga_line (ignore) int ignore ATTRIBUTE_UNUSED; diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index f823c74..abc915c 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -75,6 +75,8 @@ const segT N_TYPE_seg[N_TYPE + 2] = static void obj_aout_line PARAMS ((int)); static void obj_aout_weak PARAMS ((int)); static void obj_aout_type PARAMS ((int)); +static void obj_section PARAMS((int)); +static char * obj_section_name PARAMS ((void)); const pseudo_typeS aout_pseudo_table[] = { @@ -100,6 +102,17 @@ const pseudo_typeS aout_pseudo_table[] = {"optim", s_ignore, 0}, /* For sun386i cc (?) */ + {"2byte", cons, 2}, + {"4byte", cons, 4}, + {"8byte", cons, 8}, + {"hidden", s_ignore, 0}, + {"local", s_ignore, 0}, + {"section", obj_section, 0}, + {"section.s", obj_section, 0}, + {"sect", obj_section, 0}, + {"sect.s", obj_section, 0}, + {"swbeg", s_ignore, 0}, + /* other stuff */ {"ABORT", s_abort, 0}, @@ -229,6 +242,61 @@ obj_aout_frob_file_before_fix () #else /* ! BFD_ASSEMBLER */ +/* Get name of section. */ +static char * +obj_section_name () +{ + char *name; + + SKIP_WHITESPACE (); + if (*input_line_pointer == '"') + { + int dummy; + + name = demand_copy_C_string (&dummy); + if (name == NULL) + { + ignore_rest_of_line (); + return NULL; + } + } + else + { + char *end = input_line_pointer; + + while (0 == strchr ("\n\t,; ", *end)) + end++; + if (end == input_line_pointer) + { + as_warn (_("missing name")); + ignore_rest_of_line (); + return NULL; + } + + name = xmalloc (end - input_line_pointer + 1); + memcpy (name, input_line_pointer, end - input_line_pointer); + name[end - input_line_pointer] = '\0'; + input_line_pointer = end; + } + SKIP_WHITESPACE (); + return name; +} + + +static void obj_section(int push) { + char const * name = obj_section_name(); + if (name == NULL) + return; +//printf("section: %s\r\n", name); + if (0 == strcmp(".rodata", name) +//|| 0 == strncmp(".text", name, 5) + ) + s_text(push); + else + s_data(push); +} + + /* Relocation. */ /* diff --git a/gas/config/obj-elf.h b/gas/config/obj-elf.h index 0fa2ba6..98ed3e5 100644 --- a/gas/config/obj-elf.h +++ b/gas/config/obj-elf.h @@ -132,6 +132,10 @@ int elf_s_get_other PARAMS ((symbolS *)); (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V)) #endif +#ifndef S_GET_TYPE +#define S_GET_TYPE(S) (0) +#endif + extern asection *gdb_section; #ifndef obj_frob_file diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index ebedcb1..9e39c64 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -7034,7 +7034,9 @@ md_parse_option (c, arg) { int i; - if (arg[0] == 'c' && arg[1] == '6') + if (arg[0] == 'c' && arg[1] == 'p' && arg[2] == 'u' && arg[3] == '=') + arg += 4; + else if (arg[0] == 'c' && arg[1] == '6') arg++; for (i = 0; i < n_archs; i++) diff --git a/gas/read.c b/gas/read.c index 5f4626e..b4458eb 100644 --- a/gas/read.c +++ b/gas/read.c @@ -237,6 +237,9 @@ static segT get_known_segmented_expression PARAMS ((expressionS * expP)); static void pobegin PARAMS ((void)); static int get_line_sb PARAMS ((sb *)); static void generate_file_debug PARAMS ((void)); +void ignore_rest_of_line (void); +static void ignore_rest_of_line2 (int); + void read_begin () @@ -1425,7 +1428,8 @@ s_comm (ignore) #endif /* not OBJ_VMS */ know (symbolP->sy_frag == &zero_address_frag); - demand_empty_rest_of_line (); + ignore_rest_of_line2 (0); + // demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); @@ -3167,15 +3171,21 @@ demand_empty_rest_of_line () void ignore_rest_of_line () +{ + ignore_rest_of_line2(1); +} + +void +ignore_rest_of_line2 (int out) { /* For suspect lines: gives warning. */ if (!is_end_of_line[(unsigned char) *input_line_pointer]) { if (ISPRINT (*input_line_pointer)) - as_warn (_("rest of line ignored; first ignored character is `%c'"), + if (out) as_warn (_("rest of line ignored; first ignored character is `%c'"), *input_line_pointer); else - as_warn (_("rest of line ignored; first ignored character valued 0x%x"), + if (out) as_warn (_("rest of line ignored; first ignored character valued 0x%x"), *input_line_pointer); while (input_line_pointer < buffer_limit @@ -3355,7 +3365,7 @@ parse_repeat_cons PARAMS ((expressionS *exp, unsigned int nbytes)); static void cons_worker (nbytes, rva) - register int nbytes; /* 1=.byte, 2=.word, 4=.long. */ + register int nbytes; /* 1=.byte, 2=.word, 4=.long, 8=.8bytes. */ int rva; { int c; diff --git a/gprof/Makefile.in b/gprof/Makefile.in index 9dcd874..bd4bc6e 100644 --- a/gprof/Makefile.in +++ b/gprof/Makefile.in @@ -192,7 +192,7 @@ TODO acinclude.m4 aclocal.m4 configure configure.in gconfig.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best SOURCES = $(gprof_SOURCES) OBJECTS = $(gprof_OBJECTS) diff --git a/include/dis-asm.h b/include/dis-asm.h index 392cbf9..1676069 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -246,6 +246,7 @@ extern int print_insn_iq2000 PARAMS ((bfd_vma, disassemble_info *)); extern disassembler_ftype arc_get_disassembler PARAMS ((void *)); extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *)); +extern void print_m68k_disassembler_options PARAMS ((FILE *)); extern void print_mips_disassembler_options PARAMS ((FILE *)); extern void print_ppc_disassembler_options PARAMS ((FILE *)); extern void print_arm_disassembler_options PARAMS ((FILE *)); diff --git a/include/fopen-same.h b/include/fopen-same.h index 0f37529..63486e4 100644 --- a/include/fopen-same.h +++ b/include/fopen-same.h @@ -12,12 +12,12 @@ the application unable to be configured for both "same" and "binary" variant systems. */ -#define FOPEN_RB "r" -#define FOPEN_WB "w" -#define FOPEN_AB "a" -#define FOPEN_RUB "r+" -#define FOPEN_WUB "w+" -#define FOPEN_AUB "a+" +#define FOPEN_RB "rb" +#define FOPEN_WB "wb" +#define FOPEN_AB "ab" +#define FOPEN_RUB "r+b" +#define FOPEN_WUB "w+b" +#define FOPEN_AUB "a+b" #define FOPEN_RT "r" #define FOPEN_WT "w" diff --git a/ld/configure.tgt b/ld/configure.tgt index b7b4ffa..c62255c 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -341,7 +341,7 @@ sh64-*-elf*) m68k-sony-*) targ_emul=news ;; m68k-hp-bsd*) targ_emul=hp300bsd ;; m68*-motorola-sysv*) targ_emul=delta68 ;; -m68*-*-amigaos*) targ_emul=amiga ; targ_extra_emuls=amiga_bss;; +m68*-amigaos* | m68*-*-amigaos*) targ_emul=amiga ; targ_extra_emuls=amiga_bss;; m68*-*-aout) targ_emul=m68kaout ;; m68*-*-coff) targ_emul=m68kcoff ;; m68*-*-elf) targ_emul=m68kelf ;; diff --git a/ld/emulparams/amiga.sh b/ld/emulparams/amiga.sh index c2915d4..d7a440e 100644 --- a/ld/emulparams/amiga.sh +++ b/ld/emulparams/amiga.sh @@ -4,3 +4,4 @@ TEXT_START_ADDR=0x0 SEGMENT_SIZE=0x0 TEMPLATE_NAME=amiga ARCH=m68k +EMULATION_NAME=amiga \ No newline at end of file diff --git a/ld/emulparams/amiga_bss.sh b/ld/emulparams/amiga_bss.sh index 5405d73..6447307 100644 --- a/ld/emulparams/amiga_bss.sh +++ b/ld/emulparams/amiga_bss.sh @@ -4,3 +4,4 @@ TEXT_START_ADDR=0x0 SEGMENT_SIZE=0x0 TEMPLATE_NAME=amiga ARCH=m68k +EMULATION_NAME=amiga_bss \ No newline at end of file diff --git a/ld/ldexp.c b/ld/ldexp.c index 9227dd6..7786efe 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -307,7 +307,7 @@ fold_unary (tree, current_section, allocation_done, dot, dotp) case '-': make_abs (&result); - result.value = -result.value; + result.value = -(long)result.value; break; case NEXT: @@ -668,7 +668,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) bfd_vma dot; bfd_vma *dotp; { - etree_value_type result; + etree_value_type result = { 0, 0, 0, 0 }; if (tree == NULL) { diff --git a/ld/ldlang.c b/ld/ldlang.c index 8846917..4c67077 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3377,7 +3377,7 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax, a page could be saved in the data segment. */ bfd_vma first, last; - first = -exp_data_seg.base & (exp_data_seg.pagesize - 1); + first = -(long)exp_data_seg.base & (exp_data_seg.pagesize - 1); last = exp_data_seg.end & (exp_data_seg.pagesize - 1); if (first && last && ((exp_data_seg.base & ~(exp_data_seg.pagesize - 1)) diff --git a/ld/ldlex.c b/ld/ldlex.c index 0de7865..176a9c9 100644 --- a/ld/ldlex.c +++ b/ld/ldlex.c @@ -14,7 +14,7 @@ #endif /* First, we deal with platform-specific or compiler-specific issues. */ - +#include "config.h" /* begin standard C headers. */ #include #include diff --git a/ld/ldmain.c b/ld/ldmain.c index e0f1fa2..9d957dd 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -162,7 +162,7 @@ static struct bfd_link_callbacks link_callbacks = struct bfd_link_info link_info; static void -remove_output () +remove_output (void) { if (output_filename) { @@ -1018,7 +1018,7 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize) bfd_vma nsize; { if (! config.warn_common) - return TRUE; + return 2; if (ntype == bfd_link_hash_defined || ntype == bfd_link_hash_defweak diff --git a/libiberty/lrealpath.c b/libiberty/lrealpath.c index f9b930b..09f54ec 100644 --- a/libiberty/lrealpath.c +++ b/libiberty/lrealpath.c @@ -50,6 +50,10 @@ components will be simplified. The returned value will be allocated using #include #endif +#ifndef DIR_SEPARATOR_S +#define DIR_SEPARATOR_S "/" +#endif + /* On GNU libc systems the declaration is only visible with _GNU_SOURCE. */ #if defined(HAVE_CANONICALIZE_FILE_NAME) \ && defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME) diff --git a/libiberty/pex-os2.c b/libiberty/pex-os2.c index d9eacf1..11bc26a 100644 --- a/libiberty/pex-os2.c +++ b/libiberty/pex-os2.c @@ -67,6 +67,7 @@ pwait (pid, status, flags) { /* ??? Here's an opportunity to canonicalize the values in STATUS. Needed? */ - int pid = wait (status); + //int + pid = wait (status); return pid; } diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c index bd097a4..9000302 100644 --- a/libiberty/pex-win32.c +++ b/libiberty/pex-win32.c @@ -132,7 +132,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) char * const *argv; const char *this_pname; const char *temp_base; - char **errmsg_fmt, **errmsg_arg; + const char **errmsg_fmt, **errmsg_arg; int flags; { int pid; diff --git a/libiberty/physmem.c b/libiberty/physmem.c index 9185c12..817a726 100644 --- a/libiberty/physmem.c +++ b/libiberty/physmem.c @@ -152,7 +152,7 @@ physmem_total () #if defined _WIN32 { /* this works on windows */ PFN_MS_EX pfnex; - HMODULE h = GetModuleHandle ("kernel32.dll"); + HMODULE h = GetModuleHandleA ("kernel32.dll"); if (!h) return 0.0; diff --git a/libiberty/rename.c b/libiberty/rename.c index 399980a..6393100 100644 --- a/libiberty/rename.c +++ b/libiberty/rename.c @@ -12,10 +12,10 @@ exists, it is removed. */ -#include "ansidecl.h" #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "ansidecl.h" #include #ifdef HAVE_UNISTD_H #include diff --git a/libiberty/tmpnam.c b/libiberty/tmpnam.c index 406878c..767742b 100644 --- a/libiberty/tmpnam.c +++ b/libiberty/tmpnam.c @@ -11,7 +11,7 @@ not be used in new projects. Use @code{mkstemp} instead. @end deftypefn */ - +#include "config.h" #include #ifndef L_tmpnam diff --git a/libiberty/xstrerror.c b/libiberty/xstrerror.c index 9000d17..a253954 100644 --- a/libiberty/xstrerror.c +++ b/libiberty/xstrerror.c @@ -13,10 +13,10 @@ will never return a @code{NULL} pointer. */ +#include "config.h" #include #include "libiberty.h" -#include "config.h" #ifdef VMS #include diff --git a/ltconfig b/ltconfig index 3e19b48..7a4d635 100755 --- a/ltconfig +++ b/ltconfig @@ -1038,10 +1038,9 @@ aix4* | aix5*) ;; amigaos*) - library_names_spec='$libname.library $libname.a' + library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - #FIXME: finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - finish_eval='/bin/true'; + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 1408f39..f3be87a 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -391,6 +391,8 @@ disassembler_usage (stream) #ifdef ARCH_powerpc print_ppc_disassembler_options (stream); #endif - +#ifdef ARCH_m68k + print_m68k_disassembler_options (stream); +#endif return; } diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c index 643f3e9..99a8415 100644 --- a/opcodes/m68k-dis.c +++ b/opcodes/m68k-dis.c @@ -25,6 +25,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "opcode/m68k.h" +/* Extra info to pass to the disassembler address printing function. */ +struct objdump_disasm_info +{ + bfd *abfd; + asection *sec; + bfd_boolean require_sec; +}; + +/* Support display of symbols in baserel offsets. */ +static void +parse_disassembler_options (char *); + +static int dump_baserel; + /* Local function prototypes */ static int @@ -193,6 +207,14 @@ print_insn_m68k (memaddr, info) static int numopcodes[16]; static const struct m68k_opcode **opcodes[16]; + if (info->disassembler_options) + { + parse_disassembler_options (info->disassembler_options); + + /* To avoid repeated parsing of these options, we remove them here. */ + info->disassembler_options = NULL; + } + if (!opcodes[0]) { /* Speed up the matching by sorting the opcode table on the upper @@ -1312,7 +1334,7 @@ print_base (regno, disp, info) } else { - char buf[50]; + char buf[250]; if (regno == -2) (*info->fprintf_func) (info->stream, "@("); @@ -1321,7 +1343,51 @@ print_base (regno, disp, info) else (*info->fprintf_func) (info->stream, "%s@(", reg_names[regno]); - sprintf_vma (buf, disp); + /* Dump the symbol instead of the number*/ + if (dump_baserel && regno == 12) + { + static int offset; + + struct objdump_disasm_info *aux = + (struct objdump_disasm_info *) info->application_data; + asection * text = aux->sec; + aux->sec = text->next; + memset (buf, 0, sizeof(buf)); + + /* Try handling a4 set to 0 or set to -0x7ffe. + * TODO: search the correct offset via lea statement. + */ + if (disp & 0x80000000) + offset = 0x7ffe; + (*info->print_address_func) (disp + offset, info); + aux->sec = text; + } + else + sprintf_vma (buf, disp); (*info->fprintf_func) (info->stream, "%s", buf); } } + + +void print_m68k_disassembler_options PARAMS ((FILE * stream)) +{ + fprintf (stream, _("\n\ +The following m68k specific disassembler options are supported for use with\n\ +the -M switch:\n")); + fprintf (stream, " a4 Display labels for base relative offsets\n"); +} + +/* + * Support -M a4 + */ +static void +parse_disassembler_options (char * options) +{ + char *p; + + p = options; + while (*p && *p <= 32) + ++p; + + dump_baserel = !strncmp(p, "a4", 2); +}