This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patches for tic54x target (includes TI COFF support)


These patches (and new files) implement support for the TI c54x
processor.  Included is support for targets with bytes that are not
necessarily 8 bits wide, and support for TI's flavor of COFF.

I'd like some input on the octets vs bytes issue, which Ian has some
valid concerns about.  These patches elucidate many of the ambiguous
uses of host octets vs target bytes (which in this case are 16 bits, not
8 bits), but probably not all.  I've modified those places that are
actually used by most targets which care about non-octet target bytes.
Forcing all targets to pay attention is overkill, and I think I've hit
all the general code.  What is missing is a general guide for how to
implement new "general" code so that it doesn't break targets that
depend on non-octet bytes.

The new tic54x files I'll post separately, since the test suite is
rather large.

Tim Wall
twall at cygnus dot com



? bfd/coff-tic54x.c
? bfd/cpu-tic54x.c
? gas/config/tc-tic54x.c
? gas/config/tc-tic54x.h
? gas/doc/c-tic54x.texi
? gas/testsuite/gas/tic54x
? include/coff/ti.h
? include/coff/tic54x.h
? include/opcode/tic54x.h
? ld/emulparams/tic54xcoff.sh
? ld/emultempl/ticoff.em
? ld/scripttempl/tic54xcoff.sc
? opcodes/tic54x-dis.c
? opcodes/tic54x-opc.c
Index: config.sub
===================================================================
RCS file: /cvs/binutils/binutils/config.sub,v
retrieving revision 1.5
diff -c -3 -p -r1.5 config.sub
*** config.sub	1999/09/04 16:52:13	1.5
--- config.sub	2000/01/10 16:45:42
*************** case $basic_machine in
*** 205,211 ****
  	      | mipstx39-* | mipstx39el-* | mcore-* \
  	      | f301-* | arm*-* | t3e-* \
  	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
! 	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* )
  		;;
  	# Recognize the various machine names and aliases which stand
  	# for a CPU type and a company and sometimes even an OS.
--- 205,212 ----
  	      | mipstx39-* | mipstx39el-* | mcore-* \
  	      | f301-* | arm*-* | t3e-* \
  	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
! 	      | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
! 	      | tic54x-* | c54x-*)
  		;;
  	# Recognize the various machine names and aliases which stand
  	# for a CPU type and a company and sometimes even an OS.
*************** case $basic_machine in
*** 719,724 ****
--- 720,729 ----
  	symmetry)
  		basic_machine=i386-sequent
  		os=-dynix
+ 		;;
+         tic54x | c54x*)
+ 		basic_machine=tic54x-unknown
+ 		os=-coff
  		;;
  	t3e)
  		basic_machine=t3e-cray
Index: configure.in
===================================================================
RCS file: /cvs/binutils/binutils/configure.in,v
retrieving revision 1.5
diff -c -3 -p -r1.5 configure.in
*** configure.in	1999/08/27 10:42:58	1.5
--- configure.in	2000/01/10 16:45:44
*************** case "${target}" in
*** 593,598 ****
--- 593,601 ----
    c4x-*-*)
      noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss"
      ;;
+   c54x*-*-* | tic54x-*-*)
+     noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx target-libgloss gcc gdb newlib"
+     ;;
    thumb-*-coff)
      noconfigdirs="$noconfigdirs target-libgloss"
      ;;
Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/binutils/binutils/bfd/Makefile.am,v
retrieving revision 1.10
diff -c -3 -p -r1.10 Makefile.am
*** Makefile.am	1999/09/11 23:37:28	1.10
--- Makefile.am	2000/01/10 16:46:01
*************** ALL_MACHINES = \
*** 64,69 ****
--- 64,70 ----
  	cpu-sh.lo \
  	cpu-sparc.lo \
  	cpu-tic30.lo \
+ 	cpu-tic54x.lo \
  	cpu-tic80.lo \
  	cpu-v850.lo \
  	cpu-vax.lo \
*************** ALL_MACHINES_CFILES = \
*** 99,104 ****
--- 100,106 ----
  	cpu-sh.c \
  	cpu-sparc.c \
  	cpu-tic30.c \
+ 	cpu-tic54x.c \
  	cpu-tic80.c \
  	cpu-v850.c \
  	cpu-vax.c \
*************** BFD32_BACKENDS = \
*** 141,146 ****
--- 143,149 ----
  	coff-stgo32.lo \
  	coff-svm68k.lo \
  	coff-tic30.lo \
+ 	coff-tic54x.lo \
  	coff-tic80.lo \
  	coff-u68k.lo \
  	coff-we32k.lo \
*************** BFD32_BACKENDS_CFILES = \
*** 266,271 ****
--- 269,275 ----
  	coff-stgo32.c \
  	coff-svm68k.c \
  	coff-tic30.c \
+ 	coff-tic54x.c \
  	coff-tic80.c \
  	coff-u68k.c \
  	coff-we32k.c \
*************** cpu-sh.lo: cpu-sh.c
*** 706,711 ****
--- 710,716 ----
  cpu-sparc.lo: cpu-sparc.c
  cpu-tic30.lo: cpu-tic30.c
  cpu-tic80.lo: cpu-tic80.c
+ cpu-tic54x.lo: cpu-tic54x.c
  cpu-v850.lo: cpu-v850.c
  cpu-vax.lo: cpu-vax.c
  cpu-we32k.lo: cpu-we32k.c
*************** coff-svm68k.lo: coff-svm68k.c coff-m68k.
*** 799,804 ****
--- 804,811 ----
  coff-tic30.lo: coff-tic30.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic30.h \
    $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
  coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic80.h \
+   $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+ coff-tic54x.lo: coff-tic54x.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h \
    $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
  coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \
    $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
Index: bfd/Makefile.in
===================================================================
RCS file: /cvs/binutils/binutils/bfd/Makefile.in,v
retrieving revision 1.11
diff -c -3 -p -r1.11 Makefile.in
*** Makefile.in	1999/09/11 23:37:28	1.11
--- Makefile.in	2000/01/10 16:46:04
*************** ALL_MACHINES = \
*** 181,186 ****
--- 181,187 ----
  	cpu-sh.lo \
  	cpu-sparc.lo \
  	cpu-tic30.lo \
+ 	cpu-tic54x.lo \
  	cpu-tic80.lo \
  	cpu-v850.lo \
  	cpu-vax.lo \
*************** ALL_MACHINES_CFILES = \
*** 217,222 ****
--- 218,224 ----
  	cpu-sh.c \
  	cpu-sparc.c \
  	cpu-tic30.c \
+ 	cpu-tic54x.c \
  	cpu-tic80.c \
  	cpu-v850.c \
  	cpu-vax.c \
*************** BFD32_BACKENDS = \
*** 260,265 ****
--- 262,268 ----
  	coff-stgo32.lo \
  	coff-svm68k.lo \
  	coff-tic30.lo \
+ 	coff-tic54x.lo \
  	coff-tic80.lo \
  	coff-u68k.lo \
  	coff-we32k.lo \
*************** BFD32_BACKENDS_CFILES = \
*** 386,391 ****
--- 389,395 ----
  	coff-stgo32.c \
  	coff-svm68k.c \
  	coff-tic30.c \
+ 	coff-tic54x.c \
  	coff-tic80.c \
  	coff-u68k.c \
  	coff-we32k.c \
*************** cpu-sh.lo: cpu-sh.c
*** 1236,1241 ****
--- 1240,1246 ----
  cpu-sparc.lo: cpu-sparc.c
  cpu-tic30.lo: cpu-tic30.c
  cpu-tic80.lo: cpu-tic80.c
+ cpu-tic54x.lo: cpu-tic54x.c
  cpu-v850.lo: cpu-v850.c
  cpu-vax.lo: cpu-vax.c
  cpu-we32k.lo: cpu-we32k.c
*************** coff-tic30.lo: coff-tic30.c $(INCDIR)/bf
*** 1330,1335 ****
--- 1335,1343 ----
    $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
  coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic80.h \
    $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
+ coff-tic54x.lo: coff-tic54x.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/ti.h \
+   $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/internal.h \
+   libcoff.h coffcode.h coffswap.h
  coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \
    $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
    coffcode.h coffswap.h
Index: bfd/archures.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/archures.c,v
retrieving revision 1.6
diff -c -3 -p -r1.6 archures.c
*** archures.c	1999/12/01 10:14:02	1.6
--- archures.c	2000/01/10 16:46:05
*************** DESCRIPTION
*** 175,180 ****
--- 175,181 ----
  .  bfd_arch_ns32k,     {* National Semiconductors ns32000 *}
  .  bfd_arch_w65,       {* WDC 65816 *}
  .  bfd_arch_tic30,     {* Texas Instruments TMS320C30 *}
+ .  bfd_arch_tic54x,    {* Texas Instruments TMS320C54X *}
  .  bfd_arch_tic80,     {* TI TMS320c80 (MVP) *}
  .  bfd_arch_v850,      {* NEC V850 *}
  .#define bfd_mach_v850          0
*************** extern const bfd_arch_info_type bfd_pj_a
*** 255,260 ****
--- 256,262 ----
  extern const bfd_arch_info_type bfd_sh_arch;
  extern const bfd_arch_info_type bfd_sparc_arch;
  extern const bfd_arch_info_type bfd_tic30_arch;
+ extern const bfd_arch_info_type bfd_tic54x_arch;
  extern const bfd_arch_info_type bfd_tic80_arch;
  extern const bfd_arch_info_type bfd_vax_arch;
  extern const bfd_arch_info_type bfd_we32k_arch;
*************** static const bfd_arch_info_type * const 
*** 293,298 ****
--- 295,301 ----
    &bfd_sh_arch,
    &bfd_sparc_arch,
    &bfd_tic30_arch,
+   &bfd_tic54x_arch,
    &bfd_tic80_arch,
    &bfd_vax_arch,
    &bfd_we32k_arch,
*************** bfd_printable_arch_mach (arch, machine)
*** 903,905 ****
--- 906,959 ----
        return ap->printable_name;
      return "UNKNOWN!";
  }
+ 
+ /*
+ FUNCTION
+ 	bfd_octets_per_byte
+ 
+ SYNOPSIS
+ 	int bfd_octets_per_byte(bfd *abfd);
+ 
+ DESCRIPTION
+ 	Return the number of host (8-bit) bytes per target byte (minimum
+         addressable unit).  In most cases, this will be one, but some DSP
+         targets have 16, 32, or even 48 bits per byte.
+ 
+ */
+ 
+ int
+ bfd_octets_per_byte (abfd)
+      bfd *abfd;
+ {
+     return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd), 
+                                           bfd_get_mach (abfd));
+ }
+ 
+ /*
+ FUNCTION
+ 	bfd_arch_mach_octets_per_byte
+ 
+ SYNOPSIS
+ 	int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
+                                           unsigned long machine);
+ 
+ DESCRIPTION
+ 	Return the number of octets per byte (minimum
+         addressable unit).  In most cases, this will be one, but some DSP
+         targets have 16, 32, or even 48 bits per byte.
+         
+         This routine is provided for those cases where a bfd * is not
+         available
+ */
+ 
+ int
+ bfd_arch_mach_octets_per_byte (arch, mach)
+     enum bfd_architecture arch;
+     unsigned long mach;
+ {
+     const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);
+     if (ap)
+       return ap->bits_per_byte / 8;
+     return 1;
+ }
+ 
Index: bfd/bfd-in.h
===================================================================
RCS file: /cvs/binutils/binutils/bfd/bfd-in.h,v
retrieving revision 1.5
diff -c -3 -p -r1.5 bfd-in.h
*** bfd-in.h	1999/07/12 11:06:02	1.5
--- bfd-in.h	2000/01/10 16:46:07
*************** typedef enum bfd_format {
*** 253,258 ****
--- 253,261 ----
  /* This flag indicates that the BFD contents are actually cached in
     memory.  If this is set, iostream points to a bfd_in_memory struct.  */
  #define BFD_IN_MEMORY 0x800
+ 
+ /* The sections in this BFD specify a memory page */
+ #define HAS_LOAD_PAGE 0x1000
  
  /* symbols and relocation */
  
*************** typedef struct sec *sec_ptr;
*** 313,318 ****
--- 316,322 ----
  #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
  #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
  #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
+ #define bfd_get_section_load_page(bfd, ptr) ((ptr)->load_page)
  #define bfd_section_name(bfd, ptr) ((ptr)->name)
  #define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
  #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
*************** typedef struct sec *sec_ptr;
*** 325,330 ****
--- 329,335 ----
  
  #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
  #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
+ #define bfd_set_section_load_page(bfd, ptr, val) ((ptr)->load_page = (val), true)
  #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
  
  typedef struct stat stat_type; 
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/binutils/binutils/bfd/bfd-in2.h,v
retrieving revision 1.27
diff -c -3 -p -r1.27 bfd-in2.h
*** bfd-in2.h	1999/12/10 18:51:34	1.27
--- bfd-in2.h	2000/01/10 16:46:15
*************** typedef enum bfd_format {
*** 253,258 ****
--- 253,261 ----
  /* This flag indicates that the BFD contents are actually cached in
     memory.  If this is set, iostream points to a bfd_in_memory struct.  */
  #define BFD_IN_MEMORY 0x800
+ 
+ /* The sections in this BFD specify a memory page */
+ #define HAS_LOAD_PAGE 0x1000
  
  /* symbols and relocation */
  
*************** typedef struct sec *sec_ptr;
*** 313,318 ****
--- 316,322 ----
  #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
  #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
  #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
+ #define bfd_get_section_load_page(bfd, ptr) ((ptr)->load_page)
  #define bfd_section_name(bfd, ptr) ((ptr)->name)
  #define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
  #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
*************** typedef struct sec *sec_ptr;
*** 325,330 ****
--- 329,335 ----
  
  #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
  #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
+ #define bfd_set_section_load_page(bfd, ptr, val) ((ptr)->load_page = (val), true)
  #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
  
  typedef struct stat stat_type; 
*************** typedef struct sec
*** 1033,1038 ****
--- 1038,1052 ----
            executables or shared objects.  */
  #define SEC_SHARED 0x4000000
  
+         /* This section should be blocked (weak alignment).  Guarantees a
+           section will not cross a page boundary if smaller than a page, or
+           be aligned on a page boundary if >= a page.  */
+ #define SEC_BLOCK 0x8000000
+ 
+         /* Conditionally link this section; link only if there are no
+           references found to any symbol in the section */
+ #define SEC_CLINK 0x10000000
+ 
          /*  End of section flags.  */
  
          /* Some internal packed boolean fields.  */
*************** typedef struct sec
*** 1066,1071 ****
--- 1080,1091 ----
  
     bfd_vma lma;
  
+          /*  The memory page of the section (for TI COFF, usually PROG or DATA)
+            Needed on targets with a multiple address space.  The
+            file flag HAS_LOAD_PAGE should be set if this field is used.  */
+ 
+    int load_page;
+ 
           /* The size of the section in bytes, as it will be output.
             contains a value even if the section has no contents (e.g., the
             size of <<.bss>>). This will be filled in after relocation */
*************** typedef struct sec
*** 1080,1087 ****
  
           /* If this section is going to be output, then this value is the
             offset into the output section of the first byte in the input
!            section. E.g., if this was going to start at the 100th byte in
!            the output section, this value would be 100. */
  
     bfd_vma output_offset;
  
--- 1100,1108 ----
  
           /* If this section is going to be output, then this value is the
             offset into the output section of the first byte in the input
!            section. E.g., in most cases, if this was going to start at the
!            100th byte in the output section, this value would be 100; if
!            bfd_octets_per_byte were "2", this value would be 50. */
  
     bfd_vma output_offset;
  
*************** enum bfd_architecture 
*** 1363,1368 ****
--- 1384,1390 ----
    bfd_arch_ns32k,      /* National Semiconductors ns32000 */
    bfd_arch_w65,        /* WDC 65816 */
    bfd_arch_tic30,      /* Texas Instruments TMS320C30 */
+   bfd_arch_tic54x,     /* Texas Instruments TMS320C54X */
    bfd_arch_tic80,      /* TI TMS320c80 (MVP) */
    bfd_arch_v850,       /* NEC V850 */
  #define bfd_mach_v850          0
*************** enum bfd_architecture 
*** 1376,1382 ****
    bfd_arch_mn10200,    /* Matsushita MN10200 */
    bfd_arch_mn10300,    /* Matsushita MN10300 */
  #define bfd_mach_mn10300               300
! #define bfd_mach_am33               330
    bfd_arch_fr30,
  #define bfd_mach_fr30          0x46523330
    bfd_arch_mcore,
--- 1398,1404 ----
    bfd_arch_mn10200,    /* Matsushita MN10200 */
    bfd_arch_mn10300,    /* Matsushita MN10300 */
  #define bfd_mach_mn10300               300
! #define bfd_mach_am33          330
    bfd_arch_fr30,
  #define bfd_mach_fr30          0x46523330
    bfd_arch_mcore,
*************** const char *
*** 1446,1451 ****
--- 1468,1480 ----
  bfd_printable_arch_mach
   PARAMS ((enum bfd_architecture arch, unsigned long machine));
  
+ int 
+ bfd_octets_per_byte PARAMS ((bfd *abfd));
+ 
+ int 
+ bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
+     unsigned long machine));
+ 
  typedef enum bfd_reloc_status
  {
          /* No errors detected */
*************** instruction. */
*** 2206,2211 ****
--- 2235,2264 ----
  significant 8 bits of a 24 bit word are placed into the least
  significant 8 bits of the opcode. */
    BFD_RELOC_TIC30_LDP,
+ 
+ /* This is a 7bit reloc for the tms320c54x, where the least
+ significant 7 bits of a 16 bit word are placed into the least
+ significant 7 bits of the opcode. */
+   BFD_RELOC_TIC54X_PARTLS7,
+ 
+ /* This is a 9bit DP reloc for the tms320c54x, where the most
+ significant 9 bits of a 16 bit word are placed into the least
+ significant 9 bits of the opcode. */
+   BFD_RELOC_TIC54X_PARTMS9,
+ 
+ /* This is an extended address 23-bit reloc for the tms320c54x. */
+   BFD_RELOC_TIC54X_23,
+ 
+ /* This is a 16-bit reloc for the tms320c54x, where the least 
+ significant 16 bits of a 23-bit extended address are placed into 
+ the opcode. */
+   BFD_RELOC_TIC54X_16_OF_23,
+ 
+ /* This is a reloc for the tms320c54x, where the most
+ significant 7 bits of a 23-bit extended address are placed into 
+ the opcode. */
+   BFD_RELOC_TIC54X_MS7_OF_23,
+ 
  
  /* This is a 48 bit reloc for the FR30 that stores 32 bits. */
    BFD_RELOC_FR30_48,
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/binutils/binutils/bfd/coffcode.h,v
retrieving revision 1.26
diff -c -3 -p -r1.26 coffcode.h
*** coffcode.h	1999/09/13 23:55:22	1.26
--- coffcode.h	2000/01/10 16:46:26
*************** sec_to_styp_flags (sec_name, sec_flags)
*** 398,404 ****
--- 398,408 ----
      }
    else if (!strncmp (sec_name, ".stab", 5))
      {
+ #ifdef COFF_ALIGN_IN_S_FLAGS
+       styp_flags = STYP_DSECT;
+ #else
        styp_flags = STYP_INFO;
+ #endif
      }
  #ifdef RS6000COFF_C
    else if (!strcmp (sec_name, _PAD))
*************** sec_to_styp_flags (sec_name, sec_flags)
*** 510,515 ****
--- 514,529 ----
    if (sec_flags & SEC_SHARED)
      styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful */
  
+ #ifdef STYP_CLINK
+   if (sec_flags & SEC_CLINK)
+     styp_flags |= STYP_CLINK;
+ #endif
+ 
+ #ifdef STYP_BLOCK
+   if (sec_flags & SEC_BLOCK)
+     styp_flags |= STYP_BLOCK;
+ #endif
+ 
    return styp_flags; 
  }
  
*************** styp_to_sec_flags (abfd, hdr, name, sect
*** 533,538 ****
--- 547,562 ----
    long styp_flags = internal_s->s_flags;
    flagword sec_flags = 0;
  
+ #ifdef STYP_BLOCK
+   if (styp_flags & STYP_BLOCK)
+       sec_flags |= SEC_BLOCK;
+ #endif  
+ 
+ #ifdef STYP_CLINK
+   if (styp_flags & STYP_CLINK)
+       sec_flags |= SEC_CLINK;
+ #endif  
+ 
  #ifdef STYP_NOLOAD
    if (styp_flags & STYP_NOLOAD)
      {
*************** coff_set_alignment_hook (abfd, section, 
*** 1500,1508 ****
        break;
  #endif
  #ifdef TIC80COFF
!   /* TI tools hijack bits 8-11 for the alignment */
    i = (hdr->s_flags >> 8) & 0xF ;
  #endif
    section->alignment_power = i;
  }
  
--- 1524,1535 ----
        break;
  #endif
  #ifdef TIC80COFF
!   /* TI tools puts the alignment power in bits 8-11 */
    i = (hdr->s_flags >> 8) & 0xF ;
  #endif
+ #ifdef COFF_DECODE_ALIGNMENT
+   i = COFF_DECODE_ALIGNMENT(hdr->s_flags);
+ #endif
    section->alignment_power = i;
  }
  
*************** coff_set_arch_mach_hook (abfd, filehdr)
*** 1997,2002 ****
--- 2024,2059 ----
        break;
  #endif
  
+ #ifdef TICOFF0MAGIC
+ #ifdef TICOFF_TARGET_ARCH
+       /* this TI COFF section should be used by all new TI COFF v0 targets */
+     case TICOFF0MAGIC:
+       arch = TICOFF_TARGET_ARCH;
+       break;
+ #endif
+ #endif
+ 
+ #ifdef TICOFF1MAGIC
+       /* this TI COFF section should be used by all new TI COFF v1/2 targets */
+       /* TI COFF1 and COFF2 use the target_id field to specify which arch */
+     case TICOFF1MAGIC:
+     case TICOFF2MAGIC:
+       switch (internal_f->f_target_id)
+         {
+ #ifdef TI_TARGET_ID
+         case TI_TARGET_ID:
+           arch = TICOFF_TARGET_ARCH;
+           break;
+ #endif
+         default:
+           (*_bfd_error_handler)
+             (_("Unrecognized TI COFF target id '0x%x'"), 
+              internal_f->f_target_id);
+           break;
+         }
+       break;
+ #endif
+ 
  #ifdef TIC80_ARCH_MAGIC
      case TIC80_ARCH_MAGIC:
        arch = bfd_arch_tic80;
*************** coff_write_relocs (abfd, first_undef)
*** 2268,2274 ****
--- 2325,2335 ----
  #endif
  	    if (q->sym_ptr_ptr)
  	      {
+ #ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P
+                 if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P(q,s))
+ #else
  		if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr)
+ #endif
  		  /* This is a relocation relative to the absolute symbol.  */
  		  n.r_symndx = -1;
  		else
*************** coff_set_flags (abfd, magicp, flagsp)
*** 2384,2389 ****
--- 2445,2477 ----
        *magicp = TIC30MAGIC;
        return true;
  #endif
+ 
+ #ifdef TICOFF_DEFAULT_MAGIC
+     case TICOFF_TARGET_ARCH:
+       /* if there's no indication of which version we want, use the default */
+       if (!abfd->xvec )
+         *magicp = TICOFF_DEFAULT_MAGIC;
+       else
+         {
+           /* we may want to output in a different COFF version */
+           switch (abfd->xvec->name[4])
+             {
+             case '0':
+               *magicp = TICOFF0MAGIC;
+               break;
+             case '1':
+               *magicp = TICOFF1MAGIC;
+               break;
+             case '2':
+               *magicp = TICOFF2MAGIC;
+               break;
+             default:
+               return false;
+             }
+         }
+       return true;
+ #endif
+ 
  #ifdef TIC80_ARCH_MAGIC
      case bfd_arch_tic80:
        *magicp = TIC80_ARCH_MAGIC;
*************** sort_by_secaddr (arg1, arg2)
*** 2603,2609 ****
  #ifndef I960
  #define ALIGN_SECTIONS_IN_FILE
  #endif
! #ifdef TIC80COFF
  #undef ALIGN_SECTIONS_IN_FILE
  #endif
  
--- 2691,2697 ----
  #ifndef I960
  #define ALIGN_SECTIONS_IN_FILE
  #endif
! #if defined(TIC80COFF) || defined(TICOFF)
  #undef ALIGN_SECTIONS_IN_FILE
  #endif
  
*************** coff_compute_section_file_positions (abf
*** 2688,2701 ****
      sofar += SMALL_AOUTSZ;
  #endif
  
!   sofar += abfd->section_count * SCNHSZ;
  
  #ifdef RS6000COFF_C
    /* XCOFF handles overflows in the reloc and line number count fields
       by allocating a new section header to hold the correct counts.  */
    for (current = abfd->sections; current != NULL; current = current->next)
      if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff)
!       sofar += SCNHSZ;
  #endif
  
  #ifdef COFF_IMAGE_WITH_PE
--- 2776,2789 ----
      sofar += SMALL_AOUTSZ;
  #endif
  
!   sofar += abfd->section_count * bfd_coff_scnhsz (abfd);
  
  #ifdef RS6000COFF_C
    /* XCOFF handles overflows in the reloc and line number count fields
       by allocating a new section header to hold the correct counts.  */
    for (current = abfd->sections; current != NULL; current = current->next)
      if (current->reloc_count >= 0xffff || current->lineno_count >= 0xffff)
!       sofar += bfd_coff_scnhsz (abfd);
  #endif
  
  #ifdef COFF_IMAGE_WITH_PE
*************** coff_write_object_contents (abfd)
*** 3125,3130 ****
--- 3213,3219 ----
  #endif
        section.s_vaddr = current->vma;
        section.s_paddr = current->lma;
+       section.s_page = current->load_page; 
        section.s_size =  current->_raw_size;
  
  #ifdef COFF_WITH_PE
*************** coff_write_object_contents (abfd)
*** 3195,3204 ****
        section.s_align = (current->alignment_power
  			 ? 1 << current->alignment_power
  			 : 0);
! #else
! #ifdef TIC80COFF
        section.s_flags |= (current->alignment_power & 0xF) << 8;
  #endif
  #endif
  
  #ifdef COFF_IMAGE_WITH_PE
--- 3284,3296 ----
        section.s_align = (current->alignment_power
  			 ? 1 << current->alignment_power
  			 : 0);
! #endif
! #ifdef TIC80COFF 
!       /* TI COFF puts the alignment power in bits 8-11 of the flags */
        section.s_flags |= (current->alignment_power & 0xF) << 8;
  #endif
+ #ifdef COFF_ENCODE_ALIGNMENT
+       COFF_ENCODE_ALIGNMENT(section, current->alignment_power);
  #endif
  
  #ifdef COFF_IMAGE_WITH_PE
*************** coff_write_object_contents (abfd)
*** 3214,3220 ****
  	{
  	  SCNHDR buff;
  	  if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
! 	      || bfd_write ((PTR) (&buff), 1, SCNHSZ, abfd) != SCNHSZ)
  	    return false;
  	}
  
--- 3306,3312 ----
  	{
  	  SCNHDR buff;
  	  if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
! 	      || bfd_write ((PTR) (&buff), 1, bfd_coff_scnhsz (abfd), abfd) != bfd_coff_scnhsz (abfd))
  	    return false;
  	}
  
*************** coff_write_object_contents (abfd)
*** 3335,3341 ****
  	  scnhdr.s_nlnno = current->target_index;
  	  scnhdr.s_flags = STYP_OVRFLO;
  	  if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
! 	      || bfd_write ((PTR) &buff, 1, SCNHSZ, abfd) != SCNHSZ)
  	    return false;
  	}
      }
--- 3427,3433 ----
  	  scnhdr.s_nlnno = current->target_index;
  	  scnhdr.s_flags = STYP_OVRFLO;
  	  if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
! 	      || bfd_write ((PTR) &buff, 1, bfd_coff_scnhsz (abfd), abfd) != bfd_coff_scnhsz (abfd))
  	    return false;
  	}
      }
*************** coff_write_object_contents (abfd)
*** 3386,3391 ****
--- 3478,3488 ----
      internal_f.f_flags |= F_AR32W;
  #endif
  
+ #ifdef TI_TARGET_ID
+   /* target id is used in TI COFF v1 and later; COFF0 won't use this field,
+      but it doesn't hurt to set it internally */
+   internal_f.f_target_id = TI_TARGET_ID;
+ #endif
  #ifdef TIC80_TARGET_ID
    internal_f.f_target_id = TIC80_TARGET_ID;
  #endif
*************** coff_write_object_contents (abfd)
*** 3427,3432 ****
--- 3524,3533 ----
        internal_a.magic = NMAGIC; /* Assume separate i/d */
  #define __A_MAGIC_SET__
  #endif /* A29K */
+ #ifdef TICOFF_AOUT_MAGIC
+     internal_a.magic = TICOFF_AOUT_MAGIC;
+ #define __A_MAGIC_SET__
+ #endif
  #ifdef TIC80COFF
      internal_a.magic = TIC80_ARCH_MAGIC;
  #define __A_MAGIC_SET__
*************** coff_slurp_symbol_table (abfd)
*** 4128,4134 ****
  #endif
  	    case C_REGPARM:	/* register parameter		 */
  	    case C_REG:	/* register variable		 */
! #ifndef TIC80COFF
  #ifdef C_AUTOARG
  	    case C_AUTOARG:	/* 960-specific storage class */
  #endif
--- 4229,4236 ----
  #endif
  	    case C_REGPARM:	/* register parameter		 */
  	    case C_REG:	/* register variable		 */
!               /* C_AUTOARG conflictes with TI COFF C_UEXT */
! #if !defined (TIC80COFF) && !defined (TICOFF)
  #ifdef C_AUTOARG
  	    case C_AUTOARG:	/* 960-specific storage class */
  #endif
*************** coff_slurp_symbol_table (abfd)
*** 4232,4237 ****
--- 4334,4344 ----
  #endif
  	      break;
  
+ 	    case C_STATLAB:	/* Static load time label */
+               dst->symbol.value = src->u.syment.n_value;
+               dst->symbol.flags = BSF_GLOBAL;
+               break;
+ 
  	    case C_NULL:
  	      /* PE DLLs sometimes have zeroed out symbols for some
                   reason.  Just ignore them without a warning.  */
*************** coff_slurp_symbol_table (abfd)
*** 4250,4260 ****
  	      /* NT uses 0x67 for a weak symbol, not C_ALIAS.  */
  	    case C_ALIAS:	/* duplicate tag		 */
  #endif
! 	      /* New storage classes for TIc80 */
! #ifdef TIC80COFF
  	    case C_UEXT:	/* Tentative external definition */
  #endif
- 	    case C_STATLAB:	/* Static load time label */
  	    case C_EXTLAB:	/* External load time label */
  	    case C_HIDDEN:	/* ext symbol in dmert public lib */
  	    default:
--- 4357,4366 ----
  	      /* NT uses 0x67 for a weak symbol, not C_ALIAS.  */
  	    case C_ALIAS:	/* duplicate tag		 */
  #endif
! 	      /* New storage classes for TI COFF */ 
! #if defined(TIC80COFF) || defined(TICOFF)
  	    case C_UEXT:	/* Tentative external definition */
  #endif
  	    case C_EXTLAB:	/* External load time label */
  	    case C_HIDDEN:	/* ext symbol in dmert public lib */
  	    default:
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/coffgen.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 coffgen.c
*** coffgen.c	1999/09/11 15:16:14	1.9
--- coffgen.c	2000/01/10 16:46:32
*************** make_a_section_from_file (abfd, hdr, tar
*** 128,133 ****
--- 128,134 ----
  
    return_section->vma = hdr->s_vaddr;
    return_section->lma = hdr->s_paddr;
+   return_section->load_page = hdr->s_page;
    return_section->_raw_size = hdr->s_size;
    return_section->filepos = hdr->s_scnptr;
    return_section->rel_filepos = hdr->s_relptr;
*************** coff_real_object_p (abfd, nscns, interna
*** 182,187 ****
--- 183,190 ----
      abfd->flags |= HAS_LINENO;
    if (!(internal_f->f_flags & F_LSYMS))
      abfd->flags |= HAS_LOCALS;
+   if (internal_f->f_flags & F_LDPAGE)
+     abfd->flags |= HAS_LOAD_PAGE;
  
    /* FIXME: How can we set D_PAGED correctly?  */
    if ((internal_f->f_flags & F_EXEC) != 0)
*************** coff_real_object_p (abfd, nscns, interna
*** 211,216 ****
--- 214,224 ----
    if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
      goto fail;
  
+   /* set the arch/mach *before* swapping in sections; section header swapping
+      may depend on arch/mach info */
+   if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
+     goto fail;
+ 
    /* Now copy data as required; construct all asections etc */
    if (nscns != 0)
      {
*************** coff_real_object_p (abfd, nscns, interna
*** 228,236 ****
  
    /*  make_abs_section (abfd); */
  
-   if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
-     goto fail;
- 
    return abfd->xvec;
  
   fail:
--- 236,241 ----
*************** fixup_symbol_value (abfd, coff_symbol_pt
*** 606,613 ****
  	  syment->n_value = (coff_symbol_ptr->symbol.value
  			     + coff_symbol_ptr->symbol.section->output_offset);
  	  if (! obj_pe (abfd))
! 	    syment->n_value +=
! 	      coff_symbol_ptr->symbol.section->output_section->vma;
  	}
        else
  	{
--- 611,621 ----
  	  syment->n_value = (coff_symbol_ptr->symbol.value
  			     + coff_symbol_ptr->symbol.section->output_offset);
  	  if (! obj_pe (abfd))
!             {
!               syment->n_value += (syment->n_sclass == C_STATLAB) ?
!                 coff_symbol_ptr->symbol.section->output_section->lma :
!                 coff_symbol_ptr->symbol.section->output_section->vma;
!             }
  	}
        else
  	{
*************** _bfd_coff_is_local_label_name (abfd, nam
*** 2135,2145 ****
  {
    return name[0] == '.' && name[1] == 'L';
  }
- 
- /* Provided a BFD, a section and an offset into the section, calculate
-    and return the name of the source file and the line nearest to the
-    wanted location.  */
  
  /*ARGSUSED*/
  boolean
  coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
--- 2143,2152 ----
  {
    return name[0] == '.' && name[1] == 'L';
  }
  
+ /* Provided a BFD, a section and an offset (in bytes, not octets) into the
+    section, calculate and return the name of the source file and the line
+    nearest to the wanted location.  */
  /*ARGSUSED*/
  boolean
  coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/cofflink.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 cofflink.c
*** cofflink.c	1999/09/12 16:28:20	1.13
--- cofflink.c	2000/01/10 16:46:37
*************** _bfd_coff_link_input_bfd (finfo, input_b
*** 2425,2431 ****
        if (secdata == NULL || secdata->stab_info == NULL)
  	{
  	  if (! bfd_set_section_contents (output_bfd, o->output_section,
! 					  contents, o->output_offset,
  					  (o->_cooked_size != 0
  					   ? o->_cooked_size
  					   : o->_raw_size)))
--- 2425,2434 ----
        if (secdata == NULL || secdata->stab_info == NULL)
  	{
  	  if (! bfd_set_section_contents (output_bfd, o->output_section,
! 					  contents, 
!                                           (file_ptr) 
!                                           (o->output_offset * 
!                                            bfd_octets_per_byte (output_bfd)),
  					  (o->_cooked_size != 0
  					   ? o->_cooked_size
  					   : o->_raw_size)))
*************** _bfd_coff_reloc_link_order (output_bfd, 
*** 2737,2743 ****
  	  break;
  	}
        ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
! 				     (file_ptr) link_order->offset, size);
        free (buf);
        if (! ok)
  	return false;
--- 2740,2748 ----
  	  break;
  	}
        ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf,
! 				     (file_ptr) 
!                                      (link_order->offset *
!                                       bfd_octets_per_byte (output_bfd)), size);
        free (buf);
        if (! ok)
  	return false;
Index: bfd/coffswap.h
===================================================================
RCS file: /cvs/binutils/binutils/bfd/coffswap.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 coffswap.h
*** coffswap.h	1999/09/11 22:10:33	1.4
--- coffswap.h	2000/01/10 16:46:38
*************** coff_swap_sym_in (abfd, ext1, in1)
*** 357,362 ****
--- 357,365 ----
    }
    in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
    in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
+ #ifdef COFF_ADJUST_SYM_IN_POST
+   COFF_ADJUST_SYM_IN_POST(abfd, ext1, in1);
+ #endif
  }
  
  static unsigned int
*************** coff_swap_sym_out (abfd, inp, extp)
*** 367,372 ****
--- 370,378 ----
  {
    struct internal_syment *in = (struct internal_syment *)inp;
    SYMENT *ext =(SYMENT *)extp;
+ #ifdef COFF_ADJUST_SYM_OUT_PRE
+   COFF_ADJUST_SYM_OUT_PRE(abfd, inp, extp);
+ #endif
    if(in->_n._n_name[0] == 0) {
      bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
      bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *)  ext->e.e.e_offset);
*************** coff_swap_sym_out (abfd, inp, extp)
*** 390,395 ****
--- 396,404 ----
        }
    bfd_h_put_8(abfd,  in->n_sclass , ext->e_sclass);
    bfd_h_put_8(abfd,  in->n_numaux , ext->e_numaux);
+ #ifdef COFF_ADJUST_SYM_OUT_POST
+   COFF_ADJUST_SYM_OUT_POST(abfd, inp, extp);
+ #endif
    return SYMESZ;
  }
  
*************** coff_swap_scnhdr_out (abfd, in, out)
*** 845,851 ****
  {
    struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in;
    SCNHDR *scnhdr_ext = (SCNHDR *)out;
!   unsigned int ret = SCNHSZ;
  
  #ifdef COFF_ADJUST_SCNHDR_OUT_PRE
    COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
--- 854,860 ----
  {
    struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in;
    SCNHDR *scnhdr_ext = (SCNHDR *)out;
!   unsigned int ret = bfd_coff_scnhsz (abfd);
  
  #ifdef COFF_ADJUST_SCNHDR_OUT_PRE
    COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
Index: bfd/config.bfd
===================================================================
RCS file: /cvs/binutils/binutils/bfd/config.bfd,v
retrieving revision 1.14
diff -c -3 -p -r1.14 config.bfd
*** config.bfd	1999/12/14 05:13:29	1.14
--- config.bfd	2000/01/10 16:46:39
*************** arm*)	targ_archs=bfd_arm_arch ;;
*** 33,38 ****
--- 33,39 ----
  strongarm*) targ_archs=bfd_arm_arch ;;
  thumb*)	targ_archs=bfd_arm_arch ;;
  c30*)	targ_archs=bfd_tic30_arch ;;
+ c54x*)	targ_archs=bfd_tic54x_arch ;;
  hppa*)	targ_archs=bfd_hppa_arch ;;
  i[3456]86) targ_archs=bfd_i386_arch ;;
  m68*)	targ_archs=bfd_m68k_arch ;;
*************** case "${targ}" in
*** 173,178 ****
--- 174,185 ----
      ;;
    c30-*-*coff* | tic30-*-*coff*)
      targ_defvec=tic30_coff_vec
+     ;;
+ 
+   c54x*-*-*coff* | tic54x-*-*coff*)
+     targ_defvec=tic54x_coff1_vec
+     targ_selvecs="tic54x_coff1_beh_vec tic54x_coff2_vec tic54x_coff2_beh_vec tic54x_coff0_vec tic54x_coff0_beh_vec"
+     targ_underscore=yes
      ;;
  
    d10v-*-*)
Index: bfd/configure
===================================================================
RCS file: /cvs/binutils/binutils/bfd/configure,v
retrieving revision 1.14
diff -c -3 -p -r1.14 configure
*** configure	1999/09/28 21:45:39	1.14
--- configure	2000/01/10 16:47:00
*************** do
*** 5508,5513 ****
--- 5508,5519 ----
      tekhex_vec)			tb="$tb tekhex.lo" ;;
      tic30_aout_vec)		tb="$tb aout-tic30.lo" ;;
      tic30_coff_vec)		tb="$tb coff-tic30.lo" ;;
+     tic54x_coff0_vec)		tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff0_beh_vec)	tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff1_vec)		tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff1_beh_vec)	tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff2_vec)		tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff2_beh_vec)	tb="$tb coff-tic54x.lo" ;;
      tic80coff_vec)		tb="$tb coff-tic80.lo cofflink.lo" ;;
      versados_vec)		tb="$tb versados.lo" ;;
      vms_alpha_vec)		tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"
Index: bfd/configure.in
===================================================================
RCS file: /cvs/binutils/binutils/bfd/configure.in,v
retrieving revision 1.11
diff -c -3 -p -r1.11 configure.in
*** configure.in	1999/09/28 21:45:39	1.11
--- configure.in	2000/01/10 16:47:02
*************** do
*** 556,561 ****
--- 556,567 ----
      tekhex_vec)			tb="$tb tekhex.lo" ;;
      tic30_aout_vec)		tb="$tb aout-tic30.lo" ;;
      tic30_coff_vec)		tb="$tb coff-tic30.lo" ;;
+     tic54x_coff0_vec)		tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff0_beh_vec)	tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff1_vec)		tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff1_beh_vec)	tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff2_vec)		tb="$tb coff-tic54x.lo" ;;
+     tic54x_coff2_beh_vec)	tb="$tb coff-tic54x.lo" ;;
      tic80coff_vec)		tb="$tb coff-tic80.lo cofflink.lo" ;;
      versados_vec)		tb="$tb versados.lo" ;;
      vms_alpha_vec)		tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"
Index: bfd/libbfd.h
===================================================================
RCS file: /cvs/binutils/binutils/bfd/libbfd.h,v
retrieving revision 1.12
diff -c -3 -p -r1.12 libbfd.h
*** libbfd.h	1999/12/10 18:51:35	1.12
--- libbfd.h	2000/01/10 16:47:04
*************** static const char *const bfd_reloc_code_
*** 856,861 ****
--- 856,867 ----
    "BFD_RELOC_MN10300_32_PCREL",
    "BFD_RELOC_MN10300_16_PCREL",
    "BFD_RELOC_TIC30_LDP",
+   "BFD_RELOC_TIC54X_PARTLS7",
+   "BFD_RELOC_TIC54X_PARTMS9",
+   "BFD_RELOC_TIC54X_23",
+   "BFD_RELOC_TIC54X_16_OF_23",
+   "BFD_RELOC_TIC54X_MS7_OF_23",
+ 
    "BFD_RELOC_FR30_48",
    "BFD_RELOC_FR30_20",
    "BFD_RELOC_FR30_6_IN_4",
Index: bfd/linker.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/linker.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 linker.c
*** linker.c	1999/07/11 19:49:41	1.3
--- linker.c	2000/01/10 16:47:10
*************** _bfd_generic_reloc_link_order (abfd, inf
*** 2524,2530 ****
  	  break;
  	}
        ok = bfd_set_section_contents (abfd, sec, (PTR) buf,
! 				     (file_ptr) link_order->offset, size);
        free (buf);
        if (! ok)
  	return false;
--- 2524,2532 ----
  	  break;
  	}
        ok = bfd_set_section_contents (abfd, sec, (PTR) buf,
! 				     (file_ptr) 
!                                      (link_order->offset *
!                                       bfd_octets_per_byte (abfd)), size);
        free (buf);
        if (! ok)
  	return false;
*************** _bfd_default_link_order (abfd, info, sec
*** 2592,2598 ****
      case bfd_data_link_order:
        return bfd_set_section_contents (abfd, sec,
  				       (PTR) link_order->u.data.contents,
! 				       (file_ptr) link_order->offset,
  				       link_order->size);
      }
  }
--- 2594,2602 ----
      case bfd_data_link_order:
        return bfd_set_section_contents (abfd, sec,
  				       (PTR) link_order->u.data.contents,
! 				       (file_ptr) 
!                                        (link_order->offset *
!                                         bfd_octets_per_byte (abfd)),
  				       link_order->size);
      }
  }
*************** default_fill_link_order (abfd, info, sec
*** 2626,2632 ****
    for (i = 1; i < size; i += 2)
      space[i] = fill;
    result = bfd_set_section_contents (abfd, sec, space,
! 				     (file_ptr) link_order->offset,
  				     link_order->size);
    free (space);
    return result;
--- 2630,2638 ----
    for (i = 1; i < size; i += 2)
      space[i] = fill;
    result = bfd_set_section_contents (abfd, sec, space,
! 				     (file_ptr) 
!                                      (link_order->offset * 
!                                       bfd_octets_per_byte (abfd)),
  				     link_order->size);
    free (space);
    return result;
*************** default_indirect_link_order (output_bfd,
*** 2743,2749 ****
    /* Output the section contents.  */
    if (! bfd_set_section_contents (output_bfd, output_section,
  				  (PTR) new_contents,
! 				  link_order->offset, link_order->size))
      goto error_return;
  
    if (contents != NULL)
--- 2749,2758 ----
    /* Output the section contents.  */
    if (! bfd_set_section_contents (output_bfd, output_section,
  				  (PTR) new_contents,
! 				  (file_ptr)
!                                   (link_order->offset * 
!                                    bfd_octets_per_byte (output_bfd)), 
!                                   link_order->size))
      goto error_return;
  
    if (contents != NULL)
Index: bfd/reloc.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/reloc.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 reloc.c
*** reloc.c	1999/11/28 03:26:42	1.9
--- reloc.c	2000/01/10 16:47:15
*************** bfd_perform_relocation (abfd, reloc_entr
*** 592,598 ****
  {
    bfd_vma relocation;
    bfd_reloc_status_type flag = bfd_reloc_ok;
!   bfd_size_type addr = reloc_entry->address;
    bfd_vma output_base = 0;
    reloc_howto_type *howto = reloc_entry->howto;
    asection *reloc_target_output_section;
--- 592,598 ----
  {
    bfd_vma relocation;
    bfd_reloc_status_type flag = bfd_reloc_ok;
!   bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
    bfd_vma output_base = 0;
    reloc_howto_type *howto = reloc_entry->howto;
    asection *reloc_target_output_section;
*************** bfd_perform_relocation (abfd, reloc_entr
*** 628,634 ****
      }
  
    /* Is the address of the relocation really within the section?  */
!   if (reloc_entry->address > input_section->_cooked_size)
      return bfd_reloc_outofrange;
  
    /* Work out which section the relocation is targetted at and the
--- 628,635 ----
      }
  
    /* Is the address of the relocation really within the section?  */
!   if (reloc_entry->address > input_section->_cooked_size /
!       bfd_octets_per_byte (abfd))
      return bfd_reloc_outofrange;
  
    /* Work out which section the relocation is targetted at and the
*************** space consuming.  For each target:
*** 897,937 ****
      {
      case 0:
        {
! 	char x = bfd_get_8 (abfd, (char *) data + addr);
  	DOIT (x);
! 	bfd_put_8 (abfd, x, (unsigned char *) data + addr);
        }
        break;
  
      case 1:
        {
! 	short x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
  	DOIT (x);
! 	bfd_put_16 (abfd, x, (unsigned char *) data + addr);
        }
        break;
      case 2:
        {
! 	long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
  	DOIT (x);
! 	bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
        }
        break;
      case -2:
        {
! 	long x = bfd_get_32 (abfd, (bfd_byte *) data + addr);
  	relocation = -relocation;
  	DOIT (x);
! 	bfd_put_32 (abfd, x, (bfd_byte *) data + addr);
        }
        break;
  
      case -1:
        {
! 	long x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
  	relocation = -relocation;
  	DOIT (x);
! 	bfd_put_16 (abfd, x, (bfd_byte *) data + addr);
        }
        break;
  
--- 898,938 ----
      {
      case 0:
        {
! 	char x = bfd_get_8 (abfd, (char *) data + octets);
  	DOIT (x);
! 	bfd_put_8 (abfd, x, (unsigned char *) data + octets);
        }
        break;
  
      case 1:
        {
! 	short x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
  	DOIT (x);
! 	bfd_put_16 (abfd, x, (unsigned char *) data + octets);
        }
        break;
      case 2:
        {
! 	long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
  	DOIT (x);
! 	bfd_put_32 (abfd, x, (bfd_byte *) data + octets);
        }
        break;
      case -2:
        {
! 	long x = bfd_get_32 (abfd, (bfd_byte *) data + octets);
  	relocation = -relocation;
  	DOIT (x);
! 	bfd_put_32 (abfd, x, (bfd_byte *) data + octets);
        }
        break;
  
      case -1:
        {
! 	long x = bfd_get_16 (abfd, (bfd_byte *) data + octets);
  	relocation = -relocation;
  	DOIT (x);
! 	bfd_put_16 (abfd, x, (bfd_byte *) data + octets);
        }
        break;
  
*************** space consuming.  For each target:
*** 942,950 ****
      case 4:
  #ifdef BFD64
        {
! 	bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + addr);
  	DOIT (x);
! 	bfd_put_64 (abfd, x, (bfd_byte *) data + addr);
        }
  #else
        abort ();
--- 943,951 ----
      case 4:
  #ifdef BFD64
        {
! 	bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data + octets);
  	DOIT (x);
! 	bfd_put_64 (abfd, x, (bfd_byte *) data + octets);
        }
  #else
        abort ();
*************** bfd_install_relocation (abfd, reloc_entr
*** 994,1000 ****
  {
    bfd_vma relocation;
    bfd_reloc_status_type flag = bfd_reloc_ok;
!   bfd_size_type addr = reloc_entry->address;
    bfd_vma output_base = 0;
    reloc_howto_type *howto = reloc_entry->howto;
    asection *reloc_target_output_section;
--- 995,1001 ----
  {
    bfd_vma relocation;
    bfd_reloc_status_type flag = bfd_reloc_ok;
!   bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd);
    bfd_vma output_base = 0;
    reloc_howto_type *howto = reloc_entry->howto;
    asection *reloc_target_output_section;
*************** space consuming.  For each target:
*** 1283,1289 ****
  #define DOIT(x) \
    x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) +  relocation) & howto->dst_mask))
  
!   data = (bfd_byte *) data_start + (addr - data_start_offset);
  
    switch (howto->size)
      {
--- 1284,1290 ----
  #define DOIT(x) \
    x = ( (x & ~howto->dst_mask) | (((x & howto->src_mask) +  relocation) & howto->dst_mask))
  
!   data = (bfd_byte *) data_start + (octets - data_start_offset); 
  
    switch (howto->size)
      {
*************** ENUMDOC
*** 2547,2552 ****
--- 2548,2588 ----
    This is a 8bit DP reloc for the tms320c30, where the most
    significant 8 bits of a 24 bit word are placed into the least
    significant 8 bits of the opcode.
+ 
+ COMMENT
+ ENUM
+   BFD_RELOC_TIC54X_PARTLS7
+ ENUMDOC
+   This is a 7bit reloc for the tms320c54x, where the least
+   significant 7 bits of a 16 bit word are placed into the least
+   significant 7 bits of the opcode.
+ 
+ ENUM
+   BFD_RELOC_TIC54X_PARTMS9
+ ENUMDOC
+   This is a 9bit DP reloc for the tms320c54x, where the most
+   significant 9 bits of a 16 bit word are placed into the least
+   significant 9 bits of the opcode.
+ 
+ ENUM
+   BFD_RELOC_TIC54X_23
+ ENUMDOC
+   This is an extended address 23-bit reloc for the tms320c54x.
+ 
+ ENUM
+   BFD_RELOC_TIC54X_16_OF_23
+ ENUMDOC
+   This is a 16-bit reloc for the tms320c54x, where the least 
+   significant 16 bits of a 23-bit extended address are placed into 
+   the opcode.
+ 
+ ENUM
+   BFD_RELOC_TIC54X_MS7_OF_23
+ ENUMDOC
+   This is a reloc for the tms320c54x, where the most
+   significant 7 bits of a 23-bit extended address are placed into 
+   the opcode.
+ COMMENT
  
  ENUM
    BFD_RELOC_FR30_48
Index: bfd/section.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/section.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 section.c
*** section.c	1999/09/06 18:34:29	1.9
--- section.c	2000/01/10 16:47:17
*************** CODE_FRAGMENT
*** 336,341 ****
--- 336,350 ----
  .	   executables or shared objects.  *}
  .#define SEC_SHARED 0x4000000
  .
+ .	{* This section should be blocked (weak alignment).  Guarantees a
+ .          section will not cross a page boundary if smaller than a page, or
+ .          be aligned on a page boundary if >= a page.  *}
+ .#define SEC_BLOCK 0x8000000
+ .
+ .	{* Conditionally link this section; link only if there are no
+ .          references found to any symbol in the section *}
+ .#define SEC_CLINK 0x10000000
+ .
  .	{*  End of section flags.  *}
  .
  .	{* Some internal packed boolean fields.  *}
*************** CODE_FRAGMENT
*** 369,374 ****
--- 378,389 ----
  .
  .   bfd_vma lma;
  .
+ .        {*  The memory page of the section (for TI COFF, usually PROG or DATA)
+ .           Needed on targets with a multiple address space.  The
+ .           file flag HAS_LOAD_PAGE should be set if this field is used.  *}
+ .
+ .   int load_page;
+ .
  .        {* The size of the section in bytes, as it will be output.
  .           contains a value even if the section has no contents (e.g., the
  .           size of <<.bss>>). This will be filled in after relocation *}
*************** CODE_FRAGMENT
*** 383,390 ****
  .
  .        {* If this section is going to be output, then this value is the
  .           offset into the output section of the first byte in the input
! .           section. E.g., if this was going to start at the 100th byte in
! .           the output section, this value would be 100. *}
  .
  .   bfd_vma output_offset;
  .
--- 398,406 ----
  .
  .        {* If this section is going to be output, then this value is the
  .           offset into the output section of the first byte in the input
! .           section. E.g., in most cases, if this was going to start at the
! .           100th byte in the output section, this value would be 100; if
! .           bfd_octets_per_byte were "2", this value would be 50. *}
  .
  .   bfd_vma output_offset;
  .
*************** static const asymbol global_syms[] =
*** 533,546 ****
    GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
  };
  
! #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)	\
    const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
    const asection SEC = \
      /* name, index, next, flags, set_vma, reloc_done, linker_mark, gc_mark */ \
      { NAME,  0,     0,    FLAGS, 0,       0,          0,           0,	      \
  									      \
!     /* vma, lma, _cooked_size, _raw_size, output_offset, output_section, */   \
!        0,   0,   0,            0,         0,             (struct sec *) &SEC, \
  									      \
      /* alig..., reloc..., orel..., reloc_count, filepos, rel_..., line_... */ \
         0,       0,        0,       0,           0,       0, 	   0,	      \
--- 549,562 ----
    GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
  };
  
! #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX, PAGE)	\
    const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
    const asection SEC = \
      /* name, index, next, flags, set_vma, reloc_done, linker_mark, gc_mark */ \
      { NAME,  0,     0,    FLAGS, 0,       0,          0,           0,	      \
  									      \
!     /* vma, lma, page, _cooked_size, _raw_size, output_offset, output_section, */   \
!        0,   0,   PAGE, 0,            0,         0,             (struct sec *) &SEC, \
  									      \
      /* alig..., reloc..., orel..., reloc_count, filepos, rel_..., line_... */ \
         0,       0,        0,       0,           0,       0, 	   0,	      \
*************** static const asymbol global_syms[] =
*** 559,568 ****
      }
  
  STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
! 	     BFD_COM_SECTION_NAME, 0);
! STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1);
! STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
! STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
  #undef STD_SECTION
  
  /*
--- 575,584 ----
      }
  
  STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
! 	     BFD_COM_SECTION_NAME, 0, 1);
! STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1, 0);
! STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2, 0);
! STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3, 0);
  #undef STD_SECTION
  
  /*
*************** DESCRIPTION
*** 920,926 ****
  	Sets the contents of the section @var{section} in BFD
  	@var{abfd} to the data starting in memory at @var{data}. The
  	data is written to the output section starting at offset
! 	@var{offset} for @var{count} bytes.
  
  
  
--- 936,942 ----
  	Sets the contents of the section @var{section} in BFD
  	@var{abfd} to the data starting in memory at @var{data}. The
  	data is written to the output section starting at offset
! 	@var{offset} for @var{count} octets.
  
  
  
Index: bfd/srec.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/srec.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 srec.c
*** srec.c	1999/07/19 14:55:16	1.3
--- srec.c	2000/01/10 16:47:19
*************** srec_write_section (abfd, tdata, list)
*** 1014,1020 ****
  	  bytes_this_chunk = CHUNK;
  	}
  
!       address = list->where + bytes_written;
  
        if (! srec_write_record (abfd,
  			       tdata->type,
--- 1014,1020 ----
  	  bytes_this_chunk = CHUNK;
  	}
  
!       address = list->where + bytes_written / bfd_octets_per_byte (abfd);
  
        if (! srec_write_record (abfd,
  			       tdata->type,
Index: bfd/targets.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/targets.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 targets.c
*** targets.c	1999/12/10 18:51:35	1.10
--- targets.c	2000/01/10 16:47:21
*************** extern const bfd_target sunos_big_vec;
*** 619,624 ****
--- 619,630 ----
  extern const bfd_target tekhex_vec;
  extern const bfd_target tic30_aout_vec;
  extern const bfd_target tic30_coff_vec;
+ extern const bfd_target tic54x_coff0_vec;
+ extern const bfd_target tic54x_coff0_beh_vec;
+ extern const bfd_target tic54x_coff1_vec;
+ extern const bfd_target tic54x_coff1_beh_vec;
+ extern const bfd_target tic54x_coff2_vec;
+ extern const bfd_target tic54x_coff2_beh_vec;
  extern const bfd_target tic80coff_vec;
  extern const bfd_target vaxnetbsd_vec;
  extern const bfd_target versados_vec;
*************** const bfd_target * const bfd_target_vect
*** 852,857 ****
--- 858,869 ----
  	&aout0_big_vec,
  	&tic30_aout_vec,
  	&tic30_coff_vec,
+ 	&tic54x_coff0_vec,
+ 	&tic54x_coff0_beh_vec,
+ 	&tic54x_coff1_vec,
+ 	&tic54x_coff1_beh_vec,
+ 	&tic54x_coff2_vec,
+ 	&tic54x_coff2_beh_vec,
  	&tic80coff_vec,
  	&vaxnetbsd_vec,
  	&versados_vec,
Index: binutils/binutils.texi
===================================================================
RCS file: /cvs/binutils/binutils/binutils/binutils.texi,v
retrieving revision 1.16
diff -c -3 -p -r1.16 binutils.texi
*** binutils.texi	2000/01/07 22:33:48	1.16
--- binutils.texi	2000/01/10 16:47:47
*************** objdump [ -a | --archive-headers ] 
*** 1164,1169 ****
--- 1164,1170 ----
          [ -z | --disassemble-zeroes ]
          [ -EB | -EL | --endian=@{big | little @} ]
          [ -f | --file-headers ]
+         [ --file-start-context ]
          [ -g | --debugging ]
          [ -h | --section-headers | --headers ]
          [ -i | --info ]
*************** does not describe endianness information
*** 1291,1296 ****
--- 1292,1303 ----
  @cindex object file header
  Display summary information from the overall header of
  each of the @var{objfile} files.
+ 
+ @item --file-start-context
+ @cindex source code context
+ Specify that when displaying interlisted source code/disassembly
+ (assumes '-S') from a file that has not yet been displayed, extend the
+ context to the start of the file.
  
  @item -h
  @itemx --section-header
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/binutils/binutils/binutils/objdump.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 objdump.c
*** objdump.c	1999/11/21 11:37:21	1.14
--- objdump.c	2000/01/10 16:47:50
*************** static bfd_vma start_address = (bfd_vma)
*** 75,80 ****
--- 75,81 ----
  static bfd_vma stop_address = (bfd_vma) -1;  /* --stop-address */
  static int dump_debugging;		/* --debugging */
  static bfd_vma adjust_section_vma = 0;	/* --adjust-vma */
+ static int file_start_context = 0;      /* --file-start-context */
  
  /* Extra info to pass to the disassembler address printing function.  */
  struct objdump_disasm_info {
*************** usage (stream, status)
*** 257,262 ****
--- 258,264 ----
    -M  --disassembler-options <o> Pass text <o> on to the disassembler\n\
    -EB --endian=big               Assume big endian format when disassembling\n\
    -EL --endian=little            Assume little endian format when disassembling\n\
+       --file-start-context       Include context from start of file (with -S)\n\
    -l  --line-numbers             Include line numbers and filenames in output\n\
    -C  --demangle                 Decode mangled/processed symbol names\n\
    -w  --wide                     Format output for more than 80 columns\n\
*************** static struct option long_options[]=
*** 298,303 ****
--- 300,306 ----
    {"dynamic-syms", no_argument, NULL, 'T'},
    {"endian", required_argument, NULL, OPTION_ENDIAN},
    {"file-headers", no_argument, NULL, 'f'},
+   {"file-start-context", no_argument, &file_start_context, 1},
    {"full-contents", no_argument, NULL, 's'},
    {"headers", no_argument, NULL, 'h'},
    {"help", no_argument, NULL, 'H'},
*************** dump_section_header (abfd, section, igno
*** 335,349 ****
       PTR ignored ATTRIBUTE_UNUSED;
  {
    char *comma = "";
  
    printf ("%3d %-13s %08lx  ", section->index,
  	  bfd_get_section_name (abfd, section),
! 	  (unsigned long) bfd_section_size (abfd, section));
    printf_vma (bfd_get_section_vma (abfd, section));
    printf ("  ");
    printf_vma (section->lma);
    printf ("  %08lx  2**%u", section->filepos,
  	  bfd_get_section_alignment (abfd, section));
    if (! wide_output)
      printf ("\n                ");
    printf ("  ");
--- 338,355 ----
       PTR ignored ATTRIBUTE_UNUSED;
  {
    char *comma = "";
+   int opb = bfd_octets_per_byte(abfd);
  
    printf ("%3d %-13s %08lx  ", section->index,
  	  bfd_get_section_name (abfd, section),
! 	  (unsigned long) bfd_section_size (abfd, section) / opb);
    printf_vma (bfd_get_section_vma (abfd, section));
    printf ("  ");
    printf_vma (section->lma);
    printf ("  %08lx  2**%u", section->filepos,
  	  bfd_get_section_alignment (abfd, section));
+   if (abfd->flags & HAS_LOAD_PAGE)
+     printf ("  %2d", section->load_page);
    if (! wide_output)
      printf ("\n                ");
    printf ("  ");
*************** dump_section_header (abfd, section, igno
*** 370,375 ****
--- 376,383 ----
    PF (SEC_NEVER_LOAD, "NEVER_LOAD");
    PF (SEC_EXCLUDE, "EXCLUDE");
    PF (SEC_SORT_ENTRIES, "SORT_ENTRIES");
+   PF (SEC_BLOCK, "BLOCK");
+   PF (SEC_CLINK, "CLINK");
    PF (SEC_SMALL_DATA, "SMALL_DATA");
    PF (SEC_SHARED, "SHARED");
  
*************** dump_headers (abfd)
*** 415,420 ****
--- 423,431 ----
  
  #ifndef BFD64
    printf (_("Idx Name          Size      VMA       LMA       File off  Algn"));
+   if (abfd->flags & HAS_LOAD_PAGE)
+     printf (_("  Pg"));
+   printf ("\n");
  #else
    printf (_("Idx Name          Size      VMA               LMA               File off  Algn"));
  #endif
*************** find_symbol_for_address (abfd, sec, vma,
*** 737,742 ****
--- 748,754 ----
    long min = 0;
    long max = sorted_symcount;
    long thisplace;
+   int opb = bfd_octets_per_byte(abfd); 
  
    if (sorted_symcount < 1)
      return NULL;
*************** find_symbol_for_address (abfd, sec, vma,
*** 784,790 ****
  	  || ((abfd->flags & HAS_RELOC) != 0
  	      && vma >= bfd_get_section_vma (abfd, sec)
  	      && vma < (bfd_get_section_vma (abfd, sec)
! 			+ bfd_section_size (abfd, sec)))))
      {
        long i;
  
--- 796,802 ----
  	  || ((abfd->flags & HAS_RELOC) != 0
  	      && vma >= bfd_get_section_vma (abfd, sec)
  	      && vma < (bfd_get_section_vma (abfd, sec)
! 			+ bfd_section_size (abfd, sec) / opb))))
      {
        long i;
  
*************** skip_to_line (p, line, show)
*** 1008,1017 ****
     listing.  */
  
  static void
! show_line (abfd, section, off)
       bfd *abfd;
       asection *section;
!      bfd_vma off;
  {
    CONST char *filename;
    CONST char *functionname;
--- 1020,1029 ----
     listing.  */
  
  static void
! show_line (abfd, section, addr_offset)
       bfd *abfd;
       asection *section;
!      bfd_vma addr_offset;
  {
    CONST char *filename;
    CONST char *functionname;
*************** show_line (abfd, section, off)
*** 1020,1026 ****
    if (! with_line_numbers && ! with_source_code)
      return;
  
!   if (! bfd_find_nearest_line (abfd, section, syms, off, &filename,
  			       &functionname, &line))
      return;
  
--- 1032,1038 ----
    if (! with_line_numbers && ! with_source_code)
      return;
  
!   if (! bfd_find_nearest_line (abfd, section, syms, addr_offset, &filename,
  			       &functionname, &line))
      return;
  
*************** show_line (abfd, section, off)
*** 1072,1079 ****
  	      else
  		{
  		  l = line - SHOW_PRECEDING_CONTEXT_LINES;
! 		  if (l <= 0)
! 		    l = 1;
  		}
  
  	      if (p->f == NULL)
--- 1084,1091 ----
  	      else
  		{
  		  l = line - SHOW_PRECEDING_CONTEXT_LINES;
! 		  if (l < 0)
! 		    l = 0;
  		}
  
  	      if (p->f == NULL)
*************** show_line (abfd, section, off)
*** 1123,1131 ****
  	      p->next = print_files;
  	      print_files = p;
  
! 	      l = line - SHOW_PRECEDING_CONTEXT_LINES;
! 	      if (l <= 0)
! 		l = 1;
  	      skip_to_line (p, l, false);
  	      if (p->f != NULL)
  		skip_to_line (p, line, true);
--- 1135,1146 ----
  	      p->next = print_files;
  	      print_files = p;
  
!               if (file_start_context)
!                 l = 0;
!               else
!                 l = line - SHOW_PRECEDING_CONTEXT_LINES;
! 	      if (l < 0)
! 		l = 0;
  	      skip_to_line (p, l, false);
  	      if (p->f != NULL)
  		skip_to_line (p, line, true);
*************** objdump_sprintf (va_alist)
*** 1229,1259 ****
  /* Disassemble some data in memory between given values.  */
  
  static void
! disassemble_bytes (info, disassemble_fn, insns, data, start, stop, relppp,
  		   relppend)
       struct disassemble_info *info;
       disassembler_ftype disassemble_fn;
       boolean insns;
       bfd_byte *data;
!      bfd_vma start;
!      bfd_vma stop;
       arelent ***relppp;
       arelent **relppend;
  {
    struct objdump_disasm_info *aux;
    asection *section;
!   int bytes_per_line;
    boolean done_dot;
    int skip_addr_chars;
!   bfd_vma i;
  
    aux = (struct objdump_disasm_info *) info->application_data;
    section = aux->sec;
  
    if (insns)
!     bytes_per_line = 4;
    else
!     bytes_per_line = 16;
  
    /* Figure out how many characters to skip at the start of an
       address, to make the disassembly look nicer.  We discard leading
--- 1244,1276 ----
  /* Disassemble some data in memory between given values.  */
  
  static void
! disassemble_bytes (info, disassemble_fn, insns, data, 
!                    start_offset, stop_offset, relppp,
  		   relppend)
       struct disassemble_info *info;
       disassembler_ftype disassemble_fn;
       boolean insns;
       bfd_byte *data;
!      bfd_vma start_offset;
!      bfd_vma stop_offset;
       arelent ***relppp;
       arelent **relppend;
  {
    struct objdump_disasm_info *aux;
    asection *section;
!   int octets_per_line;
    boolean done_dot;
    int skip_addr_chars;
!   bfd_vma addr_offset;
!   int opb = info->octets_per_byte;
  
    aux = (struct objdump_disasm_info *) info->application_data;
    section = aux->sec;
  
    if (insns)
!     octets_per_line = 4;
    else
!     octets_per_line = 16;
  
    /* Figure out how many characters to skip at the start of an
       address, to make the disassembly look nicer.  We discard leading
*************** disassemble_bytes (info, disassemble_fn,
*** 1265,1272 ****
        char buf[30];
        char *s;
  
!       sprintf_vma (buf,
! 		   section->vma + bfd_section_size (section->owner, section));
        s = buf;
        while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0'
  	     && s[4] == '0')
--- 1282,1289 ----
        char buf[30];
        char *s;
  
!       sprintf_vma (buf, section->vma + 
!                    bfd_section_size (section->owner, section) / opb);
        s = buf;
        while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0'
  	     && s[4] == '0')
*************** disassemble_bytes (info, disassemble_fn,
*** 1279,1312 ****
    info->insn_info_valid = 0;
  
    done_dot = false;
!   i = start;
!   while (i < stop)
      {
        bfd_vma z;
!       int bytes = 0;
        boolean need_nl = false;
  
!       /* If we see more than SKIP_ZEROES bytes of zeroes, we just
           print `...'.  */
!       for (z = i; z < stop; z++)
  	if (data[z] != 0)
  	  break;
        if (! disassemble_zeroes
  	  && (info->insn_info_valid == 0
  	      || info->branch_delay_insns == 0)
! 	  && (z - i >= SKIP_ZEROES
! 	      || (z == stop && z - i < SKIP_ZEROES_AT_END)))
  	{
  	  printf ("\t...\n");
  
! 	  /* If there are more nonzero bytes to follow, we only skip
               zeroes in multiples of 4, to try to avoid running over
               the start of an instruction which happens to start with
               zero.  */
! 	  if (z != stop)
! 	    z = i + ((z - i) &~ 3);
  
! 	  bytes = z - i;
  	}
        else
  	{
--- 1296,1330 ----
    info->insn_info_valid = 0;
  
    done_dot = false;
!   addr_offset = start_offset;
!   while (addr_offset < stop_offset)
      {
        bfd_vma z;
!       int octets = 0;
        boolean need_nl = false;
  
!       /* If we see more than SKIP_ZEROES octets of zeroes, we just
           print `...'.  */
!       for (z = addr_offset * opb; z < stop_offset * opb; z++)
  	if (data[z] != 0)
  	  break;
        if (! disassemble_zeroes
  	  && (info->insn_info_valid == 0
  	      || info->branch_delay_insns == 0)
! 	  && (z - addr_offset * opb >= SKIP_ZEROES
! 	      || (z == stop_offset * opb && 
!                   z - addr_offset * opb < SKIP_ZEROES_AT_END)))
  	{
  	  printf ("\t...\n");
  
! 	  /* If there are more nonzero octets to follow, we only skip
               zeroes in multiples of 4, to try to avoid running over
               the start of an instruction which happens to start with
               zero.  */
! 	  if (z != stop_offset * opb)
! 	    z = addr_offset * opb + ((z - addr_offset * opb) &~ 3);
  
! 	  octets = z - addr_offset * opb;
  	}
        else
  	{
*************** disassemble_bytes (info, disassemble_fn,
*** 1318,1330 ****
  	  done_dot = false;
  
  	  if (with_line_numbers || with_source_code)
! 	    show_line (aux->abfd, section, i);
  
  	  if (! prefix_addresses)
  	    {
  	      char *s;
  
! 	      sprintf_vma (buf, section->vma + i);
  	      for (s = buf + skip_addr_chars; *s == '0'; s++)
  		*s = ' ';
  	      if (*s == '\0')
--- 1336,1348 ----
  	  done_dot = false;
  
  	  if (with_line_numbers || with_source_code)
! 	    show_line (aux->abfd, section, addr_offset);
  
  	  if (! prefix_addresses)
  	    {
  	      char *s;
  
! 	      sprintf_vma (buf, section->vma + addr_offset);
  	      for (s = buf + skip_addr_chars; *s == '0'; s++)
  		*s = ' ';
  	      if (*s == '\0')
*************** disassemble_bytes (info, disassemble_fn,
*** 1334,1340 ****
  	  else
  	    {
  	      aux->require_sec = true;
! 	      objdump_print_address (section->vma + i, info);
  	      aux->require_sec = false;
  	      putchar (' ');
  	    }
--- 1352,1358 ----
  	  else
  	    {
  	      aux->require_sec = true;
! 	      objdump_print_address (section->vma + addr_offset, info);
  	      aux->require_sec = false;
  	      putchar (' ');
  	    }
*************** disassemble_bytes (info, disassemble_fn,
*** 1349,1369 ****
  	      info->bytes_per_line = 0;
  	      info->bytes_per_chunk = 0;
  
! 	      /* FIXME: This is wrong.  It tests the number of bytes
                   in the last instruction, not the current one.  */
  	      if (*relppp < relppend
! 		  && (**relppp)->address >= i
! 		  && (**relppp)->address < i + bytes)
  		info->flags = INSN_HAS_RELOC;
  	      else
  		info->flags = 0;
  
! 	      bytes = (*disassemble_fn) (section->vma + i, info);
  	      info->fprintf_func = (fprintf_ftype) fprintf;
  	      info->stream = stdout;
  	      if (info->bytes_per_line != 0)
! 		bytes_per_line = info->bytes_per_line;
! 	      if (bytes < 0)
  		{
  		  if (sfile.current != sfile.buffer)
  		    printf ("%s\n", sfile.buffer);
--- 1367,1387 ----
  	      info->bytes_per_line = 0;
  	      info->bytes_per_chunk = 0;
  
! 	      /* FIXME: This is wrong.  It tests the number of octets
                   in the last instruction, not the current one.  */
  	      if (*relppp < relppend
! 		  && (**relppp)->address >= addr_offset
! 		  && (**relppp)->address < addr_offset + octets / opb)
  		info->flags = INSN_HAS_RELOC;
  	      else
  		info->flags = 0;
  
! 	      octets = (*disassemble_fn) (section->vma + addr_offset, info);
  	      info->fprintf_func = (fprintf_ftype) fprintf;
  	      info->stream = stdout;
  	      if (info->bytes_per_line != 0)
! 		octets_per_line = info->bytes_per_line;
! 	      if (octets < 0)
  		{
  		  if (sfile.current != sfile.buffer)
  		    printf ("%s\n", sfile.buffer);
*************** disassemble_bytes (info, disassemble_fn,
*** 1375,1392 ****
  	    {
  	      bfd_vma j;
  
! 	      bytes = bytes_per_line;
! 	      if (i + bytes > stop)
! 		bytes = stop - i;
  
! 	      for (j = i; j < i + bytes; ++j)
  		{
  		  if (isprint (data[j]))
! 		    buf[j - i] = data[j];
  		  else
! 		    buf[j - i] = '.';
  		}
! 	      buf[j - i] = '\0';
  	    }
  
  	  if (prefix_addresses
--- 1393,1410 ----
  	    {
  	      bfd_vma j;
  
! 	      octets = octets_per_line;
! 	      if (addr_offset + octets / opb > stop_offset)
! 		octets = (stop_offset - addr_offset) * opb;
  
! 	      for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j)
  		{
  		  if (isprint (data[j]))
! 		    buf[j - addr_offset * opb] = data[j];
  		  else
! 		    buf[j - addr_offset * opb] = '.';
  		}
! 	      buf[j - addr_offset * opb] = '\0';
  	    }
  
  	  if (prefix_addresses
*************** disassemble_bytes (info, disassemble_fn,
*** 1396,1412 ****
  	      bfd_vma j;
  
  	      /* If ! prefix_addresses and ! wide_output, we print
!                  bytes_per_line bytes per line.  */
! 	      pb = bytes;
! 	      if (pb > bytes_per_line && ! prefix_addresses && ! wide_output)
! 		pb = bytes_per_line;
  
  	      if (info->bytes_per_chunk)
  		bpc = info->bytes_per_chunk;
  	      else
  		bpc = 1;
  
! 	      for (j = i; j < i + pb; j += bpc)
  		{
  		  int k;
  		  if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
--- 1414,1430 ----
  	      bfd_vma j;
  
  	      /* If ! prefix_addresses and ! wide_output, we print
!                  octets_per_line octets per line.  */
! 	      pb = octets;
! 	      if (pb > octets_per_line && ! prefix_addresses && ! wide_output)
! 		pb = octets_per_line;
  
  	      if (info->bytes_per_chunk)
  		bpc = info->bytes_per_chunk;
  	      else
  		bpc = 1;
  
! 	      for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
  		{
  		  int k;
  		  if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
*************** disassemble_bytes (info, disassemble_fn,
*** 1423,1429 ****
  		    }
  		}
  
! 	      for (; pb < bytes_per_line; pb += bpc)
  		{
  		  int k;
  
--- 1441,1447 ----
  		    }
  		}
  
! 	      for (; pb < octets_per_line; pb += bpc)
  		{
  		  int k;
  
*************** disassemble_bytes (info, disassemble_fn,
*** 1451,1475 ****
  	      ? show_raw_insn > 0
  	      : show_raw_insn >= 0)
  	    {
! 	      while (pb < bytes)
  		{
  		  bfd_vma j;
  		  char *s;
  
  		  putchar ('\n');
! 		  j = i + pb;
  
! 		  sprintf_vma (buf, section->vma + j);
  		  for (s = buf + skip_addr_chars; *s == '0'; s++)
  		    *s = ' ';
  		  if (*s == '\0')
  		    *--s = '0';
  		  printf ("%s:\t", buf + skip_addr_chars);
  
! 		  pb += bytes_per_line;
! 		  if (pb > bytes)
! 		    pb = bytes;
! 		  for (; j < i + pb; j += bpc)
  		    {
  		      int k;
  
--- 1469,1493 ----
  	      ? show_raw_insn > 0
  	      : show_raw_insn >= 0)
  	    {
! 	      while (pb < octets)
  		{
  		  bfd_vma j;
  		  char *s;
  
  		  putchar ('\n');
! 		  j = addr_offset * opb + pb;
  
! 		  sprintf_vma (buf, section->vma + j / opb);
  		  for (s = buf + skip_addr_chars; *s == '0'; s++)
  		    *s = ' ';
  		  if (*s == '\0')
  		    *--s = '0';
  		  printf ("%s:\t", buf + skip_addr_chars);
  
! 		  pb += octets_per_line;
! 		  if (pb > octets)
! 		    pb = octets;
! 		  for (; j < addr_offset * opb + pb; j += bpc)
  		    {
  		      int k;
  
*************** disassemble_bytes (info, disassemble_fn,
*** 1499,1506 ****
  	  && (section->flags & SEC_RELOC) != 0)
  	{
  	  while ((*relppp) < relppend
! 		 && ((**relppp)->address >= (bfd_vma) i
! 		     && (**relppp)->address < (bfd_vma) i + bytes))
  	    {
  	      arelent *q;
  
--- 1517,1524 ----
  	  && (section->flags & SEC_RELOC) != 0)
  	{
  	  while ((*relppp) < relppend
! 		 && ((**relppp)->address >= (bfd_vma) addr_offset
! 		     && (**relppp)->address < (bfd_vma) addr_offset + octets / opb))
  	    {
  	      arelent *q;
  
*************** disassemble_bytes (info, disassemble_fn,
*** 1551,1557 ****
        if (need_nl)
  	printf ("\n");
  
!       i += bytes;
      }
  }
  
--- 1569,1575 ----
        if (need_nl)
  	printf ("\n");
  
!       addr_offset += octets / opb;
      }
  }
  
*************** static void
*** 1561,1571 ****
  disassemble_data (abfd)
       bfd *abfd;
  {
!   long i;
    disassembler_ftype disassemble_fn;
    struct disassemble_info disasm_info;
    struct objdump_disasm_info aux;
    asection *section;
  
    print_files = NULL;
    prev_functionname = NULL;
--- 1579,1590 ----
  disassemble_data (abfd)
       bfd *abfd;
  {
!   long addr_offset;
    disassembler_ftype disassemble_fn;
    struct disassemble_info disasm_info;
    struct objdump_disasm_info aux;
    asection *section;
+   int opb = bfd_octets_per_byte (abfd);
  
    print_files = NULL;
    prev_functionname = NULL;
*************** disassemble_data (abfd)
*** 1587,1592 ****
--- 1606,1612 ----
    aux.require_sec = false;
    disasm_info.print_address_func = objdump_print_address;
    disasm_info.symbol_at_address_func = objdump_symbol_at_address;
+   disasm_info.octets_per_byte = opb;
  
    if (machine != (char *) NULL)
      {
*************** disassemble_data (abfd)
*** 1644,1650 ****
        arelent **relbuf = NULL;
        arelent **relpp = NULL;
        arelent **relppend = NULL;
!       long stop;
        asymbol *sym = NULL;
        long place = 0;
  
--- 1664,1670 ----
        arelent **relbuf = NULL;
        arelent **relpp = NULL;
        arelent **relppend = NULL;
!       long stop_offset;
        asymbol *sym = NULL;
        long place = 0;
  
*************** disassemble_data (abfd)
*** 1707,1743 ****
        disasm_info.buffer_length = datasize;
        if (start_address == (bfd_vma) -1
  	  || start_address < disasm_info.buffer_vma)
! 	i = 0;
        else
! 	i = start_address - disasm_info.buffer_vma;
        if (stop_address == (bfd_vma) -1)
! 	stop = datasize;
        else
  	{
  	  if (stop_address < disasm_info.buffer_vma)
! 	    stop = 0;
  	  else
! 	    stop = stop_address - disasm_info.buffer_vma;
! 	  if (stop > disasm_info.buffer_length)
! 	    stop = disasm_info.buffer_length;
  	}
  
!       sym = find_symbol_for_address (abfd, section, section->vma + i,
  				     true, &place);
  
!       while (i < stop)
  	{
  	  asymbol *nextsym;
! 	  long nextstop;
  	  boolean insns;
  	  
! 	  if (sym != NULL && bfd_asymbol_value (sym) <= section->vma + i)
  	    {
  	      int x;
  
  	      for (x = place;
  		   (x < sorted_symcount
! 		    && bfd_asymbol_value (sorted_syms[x]) <= section->vma + i);
  		   ++x)
  		continue;
  	      disasm_info.symbols = & sorted_syms[place];
--- 1727,1763 ----
        disasm_info.buffer_length = datasize;
        if (start_address == (bfd_vma) -1
  	  || start_address < disasm_info.buffer_vma)
! 	addr_offset = 0;
        else
! 	addr_offset = start_address - disasm_info.buffer_vma;
        if (stop_address == (bfd_vma) -1)
! 	stop_offset = datasize / opb;
        else
  	{
  	  if (stop_address < disasm_info.buffer_vma)
! 	    stop_offset = 0;
  	  else
! 	    stop_offset = stop_address - disasm_info.buffer_vma;
! 	  if (stop_offset > disasm_info.buffer_length / opb)
! 	    stop_offset = disasm_info.buffer_length / opb;
  	}
  
!       sym = find_symbol_for_address (abfd, section, section->vma + addr_offset,
  				     true, &place);
  
!       while (addr_offset < stop_offset)
  	{
  	  asymbol *nextsym;
! 	  long nextstop_offset;
  	  boolean insns;
  	  
! 	  if (sym != NULL && bfd_asymbol_value (sym) <= section->vma + addr_offset)
  	    {
  	      int x;
  
  	      for (x = place;
  		   (x < sorted_symcount
! 		    && bfd_asymbol_value (sorted_syms[x]) <= section->vma + addr_offset);
  		   ++x)
  		continue;
  	      disasm_info.symbols = & sorted_syms[place];
*************** disassemble_data (abfd)
*** 1750,1762 ****
  	    {
  	      printf ("\n");
  	      objdump_print_addr_with_sym (abfd, section, sym,
! 					   section->vma + i,
  					   &disasm_info,
  					   false);
  	      printf (":\n");
  	    }
  	  
! 	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i)
  	    nextsym = sym;
  	  else if (sym == NULL)
  	    nextsym = NULL;
--- 1770,1782 ----
  	    {
  	      printf ("\n");
  	      objdump_print_addr_with_sym (abfd, section, sym,
! 					   section->vma + addr_offset,
  					   &disasm_info,
  					   false);
  	      printf (":\n");
  	    }
  	  
! 	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + addr_offset)
  	    nextsym = sym;
  	  else if (sym == NULL)
  	    nextsym = NULL;
*************** disassemble_data (abfd)
*** 1777,1795 ****
  		nextsym = sorted_syms[place];
  	    }
  	  
! 	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + i)
  	    {
! 	      nextstop = bfd_asymbol_value (sym) - section->vma;
! 	      if (nextstop > stop)
! 		nextstop = stop;
  	    }
  	  else if (nextsym == NULL)
! 	    nextstop = stop;
  	  else
  	    {
! 	      nextstop = bfd_asymbol_value (nextsym) - section->vma;
! 	      if (nextstop > stop)
! 		nextstop = stop;
  	    }
  	  
  	  /* If a symbol is explicitly marked as being an object
--- 1797,1815 ----
  		nextsym = sorted_syms[place];
  	    }
  	  
! 	  if (sym != NULL && bfd_asymbol_value (sym) > section->vma + addr_offset)
  	    {
! 	      nextstop_offset = bfd_asymbol_value (sym) - section->vma;
! 	      if (nextstop_offset > stop_offset)
! 		nextstop_offset = stop_offset;
  	    }
  	  else if (nextsym == NULL)
! 	    nextstop_offset = stop_offset;
  	  else
  	    {
! 	      nextstop_offset = bfd_asymbol_value (nextsym) - section->vma;
! 	      if (nextstop_offset > stop_offset)
! 		nextstop_offset = stop_offset;
  	    }
  	  
  	  /* If a symbol is explicitly marked as being an object
*************** disassemble_data (abfd)
*** 1797,1803 ****
  	     disassembling them.  */
  	  if (disassemble_all
  	      || sym == NULL
! 	      || bfd_asymbol_value (sym) > section->vma + i
  	      || ((sym->flags & BSF_OBJECT) == 0
  		  && (strstr (bfd_asymbol_name (sym), "gnu_compiled")
  		      == NULL)
--- 1817,1823 ----
  	     disassembling them.  */
  	  if (disassemble_all
  	      || sym == NULL
! 	      || bfd_asymbol_value (sym) > section->vma + addr_offset
  	      || ((sym->flags & BSF_OBJECT) == 0
  		  && (strstr (bfd_asymbol_name (sym), "gnu_compiled")
  		      == NULL)
*************** disassemble_data (abfd)
*** 1808,1817 ****
  	  else
  	    insns = false;
  	  
! 	  disassemble_bytes (&disasm_info, disassemble_fn, insns, data, i,
! 			     nextstop, &relpp, relppend);
  	  
! 	  i = nextstop;
  	  sym = nextsym;
  	}
        
--- 1828,1837 ----
  	  else
  	    insns = false;
  	  
! 	  disassemble_bytes (&disasm_info, disassemble_fn, insns, data, 
!                              addr_offset, nextstop_offset, &relpp, relppend);
  	  
! 	  addr_offset = nextstop_offset;
  	  sym = nextsym;
  	}
        
*************** dump_bfd_header (abfd)
*** 2057,2062 ****
--- 2077,2083 ----
    PF (WP_TEXT, "WP_TEXT");
    PF (D_PAGED, "D_PAGED");
    PF (BFD_IS_RELAXABLE, "BFD_IS_RELAXABLE");
+   PF (HAS_LOAD_PAGE, "HAS_LOAD_PAGE");
    printf (_("\nstart address 0x"));
    printf_vma (abfd->start_address);
    printf ("\n");
*************** dump_data (abfd)
*** 2247,2254 ****
    asection *section;
    bfd_byte *data = 0;
    bfd_size_type datasize = 0;
!   bfd_size_type i;
!   bfd_size_type start, stop;
  
    for (section = abfd->sections; section != NULL; section =
         section->next)
--- 2268,2276 ----
    asection *section;
    bfd_byte *data = 0;
    bfd_size_type datasize = 0;
!   bfd_size_type addr_offset;
!   bfd_size_type start_offset, stop_offset;
!   int opb = bfd_octets_per_byte (abfd);
  
    for (section = abfd->sections; section != NULL; section =
         section->next)
*************** dump_data (abfd)
*** 2272,2299 ****
  
  	      if (start_address == (bfd_vma) -1
  		  || start_address < section->vma)
! 		start = 0;
  	      else
! 		start = start_address - section->vma;
  	      if (stop_address == (bfd_vma) -1)
! 		stop = bfd_section_size (abfd, section);
  	      else
  		{
  		  if (stop_address < section->vma)
! 		    stop = 0;
  		  else
! 		    stop = stop_address - section->vma;
! 		  if (stop > bfd_section_size (abfd, section))
! 		    stop = bfd_section_size (abfd, section);
  		}
! 	      for (i = start; i < stop; i += onaline)
  		{
  		  bfd_size_type j;
  
! 		  printf (" %04lx ", (unsigned long int) (i + section->vma));
! 		  for (j = i; j < i + onaline; j++)
  		    {
! 		      if (j < stop)
  			printf ("%02x", (unsigned) (data[j]));
  		      else
  			printf ("  ");
--- 2294,2324 ----
  
  	      if (start_address == (bfd_vma) -1
  		  || start_address < section->vma)
! 		start_offset = 0;
  	      else
! 		start_offset = start_address - section->vma;
  	      if (stop_address == (bfd_vma) -1)
! 		stop_offset = bfd_section_size (abfd, section) / opb;
  	      else
  		{
  		  if (stop_address < section->vma)
! 		    stop_offset = 0;
  		  else
! 		    stop_offset = stop_address - section->vma;
! 		  if (stop_offset > bfd_section_size (abfd, section) / opb)
! 		    stop_offset = bfd_section_size (abfd, section) / opb;
  		}
! 	      for (addr_offset = start_offset; 
!                    addr_offset < stop_offset; addr_offset += onaline)
  		{
  		  bfd_size_type j;
  
! 		  printf (" %04lx ", (unsigned long int) 
!                           (addr_offset + section->vma));
! 		  for (j = addr_offset * opb; 
!                        j < addr_offset * opb + onaline; j++)
  		    {
! 		      if (j < stop_offset * opb)
  			printf ("%02x", (unsigned) (data[j]));
  		      else
  			printf ("  ");
*************** dump_data (abfd)
*** 2302,2310 ****
  		    }
  
  		  printf (" ");
! 		  for (j = i; j < i + onaline; j++)
  		    {
! 		      if (j >= stop)
  			printf (" ");
  		      else
  			printf ("%c", isprint (data[j]) ? data[j] : '.');
--- 2327,2335 ----
  		    }
  
  		  printf (" ");
! 		  for (j = addr_offset; j < addr_offset * opb + onaline; j++)
  		    {
! 		      if (j >= stop_offset * opb)
  			printf (" ");
  		      else
  			printf ("%c", isprint (data[j]) ? data[j] : '.');
Index: binutils/testsuite/binutils-all/objdump.exp
===================================================================
RCS file: /cvs/binutils/binutils/binutils/testsuite/binutils-all/objdump.exp,v
retrieving revision 1.4
diff -c -3 -p -r1.4 objdump.exp
*** objdump.exp	1999/09/04 17:38:46	1.4
--- objdump.exp	2000/01/10 16:47:52
*************** if ![regexp $want $got all text_name tex
*** 83,89 ****
  } else {
      verbose "text name is $text_name size is $text_size"
      verbose "data name is $data_name size is $data_size"
!     if {[expr "0x$text_size"] < 8 || [expr "0x$data_size"] < 4} then {
  	send_log "sizes too small\n"
  	fail "objdump -h"
      } else {
--- 83,96 ----
  } else {
      verbose "text name is $text_name size is $text_size"
      verbose "data name is $data_name size is $data_size"
!     set ets 8
!     set eds 4
!     # c54x section sizes are in bytes, not octets; adjust accordingly
!     if [istarget *c54x*-*-*] then {
! 	set ets 4
! 	set eds 2
!     }
!     if {[expr "0x$text_size"] < $ets || [expr "0x$data_size"] < $eds} then {
  	send_log "sizes too small\n"
  	fail "objdump -h"
      } else {
*************** if [regexp $want $got] then {
*** 126,132 ****
  
  set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"]
  
! set want "$testfile:\[ 	\]*file format.*Contents.*(text|TEXT|\\\$CODE\\\$)\[^0-9\]*\[ 	\]*\[0-9a-fA-F\]*\[ 	\]*(00000001|01000000).*Contents.*(data|DATA)\[^0-9\]*\[ 	\]*\[0-9a-fA-F\]*\[ 	\]*(00000002|02000000)"
  
  if [regexp $want $got] then {
      pass "objdump -s"
--- 133,139 ----
  
  set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"]
  
! set want "$testfile:\[ 	\]*file format.*Contents.*(text|TEXT|\\\$CODE\\\$)\[^0-9\]*\[ 	\]*\[0-9a-fA-F\]*\[ 	\]*(00000001|01000000|00000100).*Contents.*(data|DATA)\[^0-9\]*\[ 	\]*\[0-9a-fA-F\]*\[ 	\]*(00000002|02000000|00000200)"
  
  if [regexp $want $got] then {
      pass "objdump -s"
Index: gas/Makefile.am
===================================================================
RCS file: /cvs/binutils/binutils/gas/Makefile.am,v
retrieving revision 1.10
diff -c -3 -p -r1.10 Makefile.am
*** Makefile.am	1999/09/04 17:29:20	1.10
--- Makefile.am	2000/01/10 16:48:13
*************** CPU_TYPES = \
*** 61,66 ****
--- 61,67 ----
  	sparc \
  	tahoe \
  	tic30 \
+ 	tic54x \
  	tic80 \
  	vax \
  	w65 \
*************** TARGET_CPU_CFILES = \
*** 218,223 ****
--- 219,225 ----
  	config/tc-sparc.c \
  	config/tc-tahoe.c \
  	config/tc-tic30.c \
+ 	config/tc-tic54x.c \
  	config/tc-tic80.c \
  	config/tc-vax.c \
  	config/tc-w65.c \
*************** TARGET_CPU_HFILES = \
*** 252,257 ****
--- 254,260 ----
  	config/tc-sparc.h \
  	config/tc-tahoe.h \
  	config/tc-tic30.h \
+ 	config/tc-tic54x.h \
  	config/tc-tic80.h \
  	config/tc-vax.h \
  	config/tc-w65.h \
*************** $(OBJS): @ALL_OBJ_DEPS@
*** 419,425 ****
  
  as_new_SOURCES = $(GAS_CFILES)
  as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
! 	$(extra_objects) $(GASLIBS) $(INTLLIBS)
  as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
  	$(extra_objects) $(GASLIBS) $(INTLDEPS)
  
--- 422,429 ----
  
  as_new_SOURCES = $(GAS_CFILES)
  as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
! 	$(extra_objects) $(GASLIBS) $(INTLLIBS) -lm
! 
  as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
  	$(extra_objects) $(GASLIBS) $(INTLDEPS)
  
*************** DEPTC_tic30_coff = $(srcdir)/config/obj-
*** 1181,1186 ****
--- 1185,1193 ----
  DEPTC_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h $(INCDIR)/opcode/tic30.h
+ DEPTC_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \
+   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(BFDDIR)/libcoff.h \
+   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic54x.h
  DEPTC_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic80.h
*************** DEPOBJ_tic30_elf = $(srcdir)/config/obj-
*** 1465,1471 ****
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \
    $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
! DEPOBJ_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
  DEPOBJ_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
--- 1472,1481 ----
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \
    $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
! DEPOBJ_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \
!   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(BFDDIR)/libcoff.h \
!   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
! OBJDEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
  DEPOBJ_tic80_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
*************** DEP_tic30_coff = $(srcdir)/config/obj-co
*** 1689,1694 ****
--- 1699,1707 ----
  DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h
+ DEP_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \
+   $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(BFDDIR)/libcoff.h \
+   $(INCDIR)/bfdlink.h
  DEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
    $(INCDIR)/bfdlink.h
Index: gas/Makefile.in
===================================================================
RCS file: /cvs/binutils/binutils/gas/Makefile.in,v
retrieving revision 1.12
diff -c -3 -p -r1.12 Makefile.in
*** Makefile.in	1999/09/04 17:29:21	1.12
--- Makefile.in	2000/01/10 16:48:22
*************** CPU_TYPES = \
*** 167,172 ****
--- 167,173 ----
  	sparc \
  	tahoe \
  	tic30 \
+ 	tic54x \
  	tic80 \
  	vax \
  	w65 \
*************** TARGET_CPU_CFILES = \
*** 330,335 ****
--- 331,337 ----
  	config/tc-sparc.c \
  	config/tc-tahoe.c \
  	config/tc-tic30.c \
+ 	config/tc-tic54x.c \
  	config/tc-tic80.c \
  	config/tc-vax.c \
  	config/tc-w65.c \
*************** TARGET_CPU_HFILES = \
*** 365,370 ****
--- 367,373 ----
  	config/tc-sparc.h \
  	config/tc-tahoe.h \
  	config/tc-tic30.h \
+ 	config/tc-tic54x.h \
  	config/tc-tic80.h \
  	config/tc-vax.h \
  	config/tc-w65.h \
*************** STAGESTUFF = *.o $(noinst_PROGRAMS)
*** 528,534 ****
  
  as_new_SOURCES = $(GAS_CFILES)
  as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
! 	$(extra_objects) $(GASLIBS) $(INTLLIBS)
  
  as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
  	$(extra_objects) $(GASLIBS) $(INTLDEPS)
--- 531,537 ----
  
  as_new_SOURCES = $(GAS_CFILES)
  as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
! 	$(extra_objects) $(GASLIBS) $(INTLLIBS) -lm
  
  as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \
  	$(extra_objects) $(GASLIBS) $(INTLDEPS)
*************** DEPTC_tic30_elf = $(srcdir)/config/obj-e
*** 905,910 ****
--- 908,917 ----
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h $(INCDIR)/opcode/tic30.h
  
+ DEPTC_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \
+   $(INCDIR)/coff/internal.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \
+   $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic54x.h
+ 
  DEPTC_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/opcode/tic80.h
*************** DEPOBJ_tic30_elf = $(srcdir)/config/obj-
*** 1270,1277 ****
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \
    $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
  
! DEPOBJ_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
  
--- 1277,1288 ----
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h subsegs.h \
    $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
+ 
+ DEPOBJ_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \
+   $(INCDIR)/coff/internal.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \
+   $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
  
! OBJDEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
    $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h
  
*************** DEP_tic30_coff = $(srcdir)/config/obj-co
*** 1575,1580 ****
--- 1586,1595 ----
  DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
    $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
    $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h
+ 
+ DEP_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \
+   $(INCDIR)/coff/internal.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \
+   $(INCDIR)/bfdlink.h
  
  DEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \
    $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h $(BFDDIR)/libcoff.h \
Index: gas/app.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/app.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 app.c
*** app.c	1999/11/09 17:14:45	1.4
--- app.c	2000/01/10 16:48:24
*************** static const char symbol_chars[] =
*** 67,73 ****
  #ifdef TC_V850
  #define LEX_IS_DOUBLEDASH_1ST		12
  #endif
! #ifdef TC_M32R
  #define LEX_IS_DOUBLEBAR_1ST		13
  #endif
  #define IS_SYMBOL_COMPONENT(c)		(lex[c] == LEX_IS_SYMBOL_COMPONENT)
--- 67,73 ----
  #ifdef TC_V850
  #define LEX_IS_DOUBLEDASH_1ST		12
  #endif
! #if defined(TC_M32R) || defined(DOUBLEBAR_PARALLEL)
  #define LEX_IS_DOUBLEBAR_1ST		13
  #endif
  #define IS_SYMBOL_COMPONENT(c)		(lex[c] == LEX_IS_SYMBOL_COMPONENT)
*************** do_scrub_begin (m68k_mri)
*** 174,180 ****
  #ifdef TC_V850
    lex['-'] = LEX_IS_DOUBLEDASH_1ST;
  #endif
! #ifdef TC_M32R
    lex['|'] = LEX_IS_DOUBLEBAR_1ST;
  #endif
  #ifdef TC_D30V
--- 174,180 ----
  #ifdef TC_V850
    lex['-'] = LEX_IS_DOUBLEDASH_1ST;
  #endif
! #ifdef LEX_IS_DOUBLEBAR_1ST
    lex['|'] = LEX_IS_DOUBLEBAR_1ST;
  #endif
  #ifdef TC_D30V
*************** do_scrub_chars (get, tostart, tolen)
*** 351,357 ****
  #ifdef TC_V850
           12: After seeing a dash, looking for a second dash as a start of comment.
  #endif
! #ifdef TC_M32R
  	 13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator.
  #endif
  	  */
--- 351,357 ----
  #ifdef TC_V850
           12: After seeing a dash, looking for a second dash as a start of comment.
  #endif
! #if defined(TC_M32R) || defined(DOUBLEBAR_PARALLEL)
  	 13: After seeing a vertical bar, looking for a second vertical bar as a parallel expression seperator.
  #endif
  	  */
*************** do_scrub_chars (get, tostart, tolen)
*** 761,766 ****
--- 761,781 ----
  	      break;
  	    }
  
+ #ifdef KEEP_WHITE_AROUND_COLON
+           if (lex[ch] == LEX_IS_COLON)
+             {
+               /* only keep this white if there's no white *after* the colon */
+               ch2 = GET ();
+               UNGET (ch2);
+               if (!IS_WHITESPACE (ch2))
+                 {
+                   state = 9;
+                   UNGET (ch);
+                   PUT (' ');
+                   break;
+                 }
+             }
+ #endif
  	  if (IS_COMMENT (ch)
  	      || ch == '/'
  	      || IS_LINE_SEPARATOR (ch))
*************** do_scrub_chars (get, tostart, tolen)
*** 970,979 ****
--- 985,998 ----
  #endif
  
  	case LEX_IS_COLON:
+ #ifdef KEEP_WHITE_AROUND_COLON
+           state = 9;
+ #else
  	  if (state == 9 || state == 10)
  	    state = 3;
  	  else if (state != 3)
  	    state = 1;
+ #endif
  	  PUT (ch);
  	  break;
  
*************** do_scrub_chars (get, tostart, tolen)
*** 1013,1019 ****
  	  PUT ('\n');
  	  break;
  #endif	    
! #ifdef TC_M32R
  	case LEX_IS_DOUBLEBAR_1ST:
  	  ch2 = GET();
  	  if (ch2 != '|')
--- 1032,1038 ----
  	  PUT ('\n');
  	  break;
  #endif	    
! #if defined(TC_M32R) || defined(DOUBLEBAR_PARALLEL)
  	case LEX_IS_DOUBLEBAR_1ST:
  	  ch2 = GET();
  	  if (ch2 != '|')
Index: gas/as.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/as.h,v
retrieving revision 1.5
diff -c -3 -p -r1.5 as.h
*** as.h	1999/10/11 04:07:10	1.5
--- as.h	2000/01/10 16:48:25
*************** void eh_frame_convert_frag PARAMS ((frag
*** 629,634 ****
--- 629,638 ----
  #endif
  #include "listing.h"
  
+ #ifndef NUMBERS_WITH_SUFFIX
+ #define NUMBERS_WITH_SUFFIX 0
+ #endif
+ 
  #ifndef LOCAL_LABELS_DOLLAR
  #define LOCAL_LABELS_DOLLAR 0
  #endif
*************** void eh_frame_convert_frag PARAMS ((frag
*** 641,646 ****
--- 645,660 ----
  #define TEXT_SECTION_NAME	".text"
  #define DATA_SECTION_NAME	".data"
  #define BSS_SECTION_NAME	".bss"
+ #endif
+ 
+ #ifndef OCTETS_PER_BYTE_POWER
+ #define OCTETS_PER_BYTE_POWER 0
+ #endif
+ #ifndef OCTETS_PER_BYTE
+ #define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
+ #endif
+ #if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER)
+  #error "Octets per byte conflicts with its power-of-two definition!"
  #endif
  
  #endif /* GAS */
Index: gas/cond.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/cond.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 cond.c
*** cond.c	1999/07/11 20:19:54	1.3
--- cond.c	2000/01/10 16:48:26
*************** s_ifc (arg)
*** 247,252 ****
--- 247,332 ----
  }
  
  void 
+ s_elseif (arg)
+      int arg;
+ {
+   expressionS operand;
+   int t;
+ 
+   if (current_cframe == NULL)
+     {
+       as_bad (_("\".elseif\" without matching \".if\" - ignored"));
+ 
+     }
+   else if (current_cframe->else_seen)
+     {
+       as_bad (_("\".elseif\" after \".else\" - ignored"));
+       as_bad_where (current_cframe->else_file_line.file,
+ 		    current_cframe->else_file_line.line,
+ 		    _("here is the previous \"else\""));
+       as_bad_where (current_cframe->if_file_line.file,
+ 		    current_cframe->if_file_line.line,
+ 		    _("here is the previous \"if\""));
+     }
+   else
+     {
+       as_where (&current_cframe->else_file_line.file,
+ 		&current_cframe->else_file_line.line);
+ 
+       if (!current_cframe->dead_tree)
+ 	{
+ 	  current_cframe->ignoring = !current_cframe->ignoring;
+ 	  if (LISTING_SKIP_COND ())
+ 	    {
+ 	      if (! current_cframe->ignoring)
+ 		listing_list (1);
+ 	      else
+ 		listing_list (2);
+ 	    }
+ 	}			/* if not a dead tree */
+     }				/* if error else do it */
+ 
+ 
+   SKIP_WHITESPACE ();		/* Leading whitespace is part of operand. */
+ 
+   if (current_cframe != NULL && current_cframe->ignoring)
+     {
+       operand.X_add_number = 0;
+       while (! is_end_of_line[(unsigned char) *input_line_pointer])
+ 	++input_line_pointer;
+     }
+   else
+     {
+       expression (&operand);
+       if (operand.X_op != O_constant)
+ 	as_bad (_("non-constant expression in \".elseif\" statement"));
+     }
+   
+   switch ((operatorT) arg)
+     {
+     case O_eq: t = operand.X_add_number == 0; break;
+     case O_ne: t = operand.X_add_number != 0; break;
+     case O_lt: t = operand.X_add_number < 0; break;
+     case O_le: t = operand.X_add_number <= 0; break;
+     case O_ge: t = operand.X_add_number >= 0; break;
+     case O_gt: t = operand.X_add_number > 0; break;
+     default:
+       abort ();
+       return;
+     }
+ 
+   current_cframe->ignoring = current_cframe->dead_tree || ! t;
+ 
+   if (LISTING_SKIP_COND ()
+       && current_cframe->ignoring
+       && (current_cframe->previous_cframe == NULL
+ 	  || ! current_cframe->previous_cframe->ignoring))
+     listing_list (2);
+ 
+   demand_empty_rest_of_line ();
+ }
+ 
+ void 
  s_endif (arg)
       int arg ATTRIBUTE_UNUSED;
  {
Index: gas/configure
===================================================================
RCS file: /cvs/binutils/binutils/gas/configure,v
retrieving revision 1.15
diff -c -3 -p -r1.15 configure
*** configure	1999/09/14 23:25:05	1.15
--- configure	2000/01/10 16:48:38
*************** EOF
*** 2224,2229 ****
--- 2224,2231 ----
  
        tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
        tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
+       tic54x-*-* | c54x*-*-*)  
+ 			    fmt=coff bfd_gas=yes ;;
        tic80-*-*)	    fmt=coff ;;
  
        v850-*-*)		    fmt=elf bfd_gas=yes ;;
Index: gas/configure.in
===================================================================
RCS file: /cvs/binutils/binutils/gas/configure.in,v
retrieving revision 1.13
diff -c -3 -p -r1.13 configure.in
*** configure.in	1999/09/14 23:25:05	1.13
--- configure.in	2000/01/10 16:48:39
*************** changequote([,])dnl
*** 335,340 ****
--- 335,342 ----
  
        tic30-*-*aout*)	    fmt=aout bfd_gas=yes ;;
        tic30-*-*coff*)       fmt=coff bfd_gas=yes ;;
+       tic54x-*-* | c54x*-*-*)
+ 			    fmt=coff bfd_gas=yes ;;
        tic80-*-*)	    fmt=coff ;;
  
        v850-*-*)		    fmt=elf bfd_gas=yes ;;
Index: gas/expr.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/expr.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 expr.c
*** expr.c	1999/11/05 21:50:54	1.9
--- expr.c	2000/01/10 16:48:42
*************** integer_constant (radix, expressionP)
*** 327,333 ****
  #define valuesize 32
  #endif
  
!   if (flag_m68k_mri && radix == 0)
      {
        int flt = 0;
  
--- 327,333 ----
  #define valuesize 32
  #endif
  
!   if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && radix == 0)
      {
        int flt = 0;
  
*************** integer_constant (radix, expressionP)
*** 541,547 ****
  	}
      }
  
!   if (flag_m68k_mri && suffix != NULL && input_line_pointer - 1 == suffix)
      c = *input_line_pointer++;
  
    if (small)
--- 541,548 ----
  	}
      }
  
!   if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && 
!       suffix != NULL && input_line_pointer - 1 == suffix)
      c = *input_line_pointer++;
  
    if (small)
*************** operand (expressionP)
*** 810,822 ****
      case '9':
        input_line_pointer--;
  
!       integer_constant (flag_m68k_mri ? 0 : 10, expressionP);
        break;
  
      case '0':
        /* non-decimal radix */
  
!       if (flag_m68k_mri)
  	{
  	  char *s;
  
--- 811,824 ----
      case '9':
        input_line_pointer--;
  
!       integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) ? 
!                         0 : 10, expressionP);
        break;
  
      case '0':
        /* non-decimal radix */
  
!       if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
  	{
  	  char *s;
  
*************** operand (expressionP)
*** 829,836 ****
  	      integer_constant (0, expressionP);
  	      break;
  	    }
! 	}
! 
        c = *input_line_pointer;
        switch (c)
  	{
--- 831,856 ----
  	      integer_constant (0, expressionP);
  	      break;
  	    }
!           if (NUMBERS_WITH_SUFFIX)
!             {
!               /* Check for a binary constant.  */
!               for (s = input_line_pointer; *s == '0' || *s == '1'; s++)
!                 ;
!               if (toupper (*s) == 'B')
!                 {
!                   integer_constant (0, expressionP);
!                   break;
!                 }
!               /* Check for an octal constant.  */
!               for (s = input_line_pointer; *s >= '0' && *s <= '7'; s++)
!                 ;
!               if (toupper (*s) == 'Q')
!                 {
!                   integer_constant (0, expressionP);
!                   break;
!                 }
!             }
!         }
        c = *input_line_pointer;
        switch (c)
  	{
*************** operand (expressionP)
*** 840,846 ****
  	case 'Q':
  	case '8':
  	case '9':
! 	  if (flag_m68k_mri)
  	    {
  	      integer_constant (0, expressionP);
  	      break;
--- 860,866 ----
  	case 'Q':
  	case '8':
  	case '9':
! 	  if (NUMBERS_WITH_SUFFIX || flag_m68k_mri)
  	    {
  	      integer_constant (0, expressionP);
  	      break;
*************** operand (expressionP)
*** 873,879 ****
  	  break;
  
  	case 'b':
! 	  if (LOCAL_LABELS_FB && ! flag_m68k_mri)
  	    {
  	      /* This code used to check for '+' and '-' here, and, in
  		 some conditions, fall through to call
--- 893,899 ----
  	  break;
  
  	case 'b':
! 	  if (LOCAL_LABELS_FB && ! flag_m68k_mri && ! NUMBERS_WITH_SUFFIX)
  	    {
  	      /* This code used to check for '+' and '-' here, and, in
  		 some conditions, fall through to call
Index: gas/frags.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/frags.c,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 frags.c
*** frags.c	1999/05/03 07:28:40	1.1.1.1
--- frags.c	2000/01/10 16:48:43
*************** frag_new (old_frags_var_max_size)
*** 114,120 ****
    assert (frchain_now->frch_last == frag_now);
  
    /* Fix up old frag's fr_fix.  */
!   frag_now->fr_fix = frag_now_fix () - old_frags_var_max_size;
    /* Make sure its type is valid.  */
    assert (frag_now->fr_type != 0);
  
--- 114,120 ----
    assert (frchain_now->frch_last == frag_now);
  
    /* Fix up old frag's fr_fix.  */
!   frag_now->fr_fix = frag_now_fix_octets () - old_frags_var_max_size;
    /* Make sure its type is valid.  */
    assert (frag_now->fr_type != 0);
  
*************** frag_align_pattern (alignment, fill_patt
*** 336,347 ****
  }
  
  addressT
! frag_now_fix ()
  {
    if (now_seg == absolute_section)
      return abs_section_offset;
!   return (addressT) ((char*) obstack_next_free (&frchain_now->frch_obstack)
! 		     - frag_now->fr_literal);
  }
  
  void
--- 336,354 ----
  }
  
  addressT
! frag_now_fix_octets ()
  {
    if (now_seg == absolute_section)
      return abs_section_offset;
! 
!   return ((char*) obstack_next_free (&frchain_now->frch_obstack)
!           - frag_now->fr_literal);
! }
! 
! addressT
! frag_now_fix ()
! {
!   return frag_now_fix_octets() / OCTETS_PER_BYTE;
  }
  
  void
Index: gas/frags.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/frags.h,v
retrieving revision 1.2
diff -c -3 -p -r1.2 frags.h
*** frags.h	1999/06/03 00:29:02	1.2
--- frags.h	2000/01/10 16:48:43
*************** struct obstack;
*** 44,57 ****
  
  struct frag
  {
!   /* Object file address. */
    addressT fr_address;
    /* Chain forward; ascending address order.  Rooted in frch_root. */
    struct frag *fr_next;
  
!   /* (Fixed) number of chars we know we have.  May be 0. */
    offsetT fr_fix;
!   /* (Variable) number of chars after above.  May be 0. */
    offsetT fr_var;
    /* For variable-length tail. */
    symbolS *fr_symbol;
--- 44,57 ----
  
  struct frag
  {
!   /* Object file address (as an octet offset). */
    addressT fr_address;
    /* Chain forward; ascending address order.  Rooted in frch_root. */
    struct frag *fr_next;
  
!   /* (Fixed) number of octets we know we have.  May be 0. */
    offsetT fr_fix;
!   /* (Variable) number of octets after above.  May be 0. */
    offsetT fr_var;
    /* For variable-length tail. */
    symbolS *fr_symbol;
*************** struct frag
*** 101,106 ****
--- 101,107 ----
     instead, use frag_now_fix ().  */
  COMMON fragS *frag_now;
  extern addressT frag_now_fix PARAMS ((void));
+ extern addressT frag_now_fix_octets PARAMS ((void));
  
  /* For foreign-segment symbol fixups. */
  COMMON fragS zero_address_frag;
Index: gas/gasp.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/gasp.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 gasp.c
*** gasp.c	1999/08/03 15:29:03	1.3
--- gasp.c	2000/01/10 16:48:50
*************** macro_op (idx, in)
*** 2691,2697 ****
      return 0;
  
    sb_terminate (in);
!   if (! check_macro (in->ptr + idx, &out, comment_char, &err))
      return 0;
  
    if (err != NULL)
--- 2691,2697 ----
      return 0;
  
    sb_terminate (in);
!   if (! check_macro (in->ptr + idx, &out, comment_char, &err, NULL))
      return 0;
  
    if (err != NULL)
Index: gas/input-scrub.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/input-scrub.c,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 input-scrub.c
*** input-scrub.c	1999/05/03 07:28:41	1.1.1.1
--- input-scrub.c	2000/01/10 16:48:50
*************** input_scrub_include_file (filename, posi
*** 252,267 ****
  }
  
  /* Start getting input from an sb structure.  This is used when
!    expanding a macro.  */
  
  void
  input_scrub_include_sb (from, position)
       sb *from;
       char *position;
  {
!   if (macro_nest > max_macro_nest)
!     as_fatal (_("macros nested too deeply"));
!   ++macro_nest;
  
    next_saved_file = input_scrub_push (position);
  
--- 252,279 ----
  }
  
  /* Start getting input from an sb structure.  This is used when
!    expanding a macro, or doing string substitution on a line  */
  
  void
  input_scrub_include_sb (from, position)
       sb *from;
       char *position;
  {
!   /* I put this flag so that it's possible to do a wholesale
!      replace of a single line w/o disrupting the input stream; if the checking
!      is enabled, substitutions on lines like " .if SUBS" will fail, thinking
!      they have to see ".endif" before the end of the single-line sb
!      twall@cygnus.com 
!   */
!   if (!from->no_macro_check)
!     {
!       if (macro_nest > max_macro_nest)
!         as_fatal (_("macros nested too deeply"));
!       ++macro_nest;
! #ifdef md_macro_start
!       md_macro_start ();
! #endif
!     }
  
    next_saved_file = input_scrub_push (position);
  
*************** input_scrub_include_sb (from, position)
*** 272,277 ****
--- 284,290 ----
        sb_add_char (&from_sb, '\n');
      }
    sb_add_sb (&from_sb, from);
+   from_sb.no_macro_check = from->no_macro_check;
    sb_index = 1;
  
    /* These variables are reset by input_scrub_push.  Restore them
*************** input_scrub_next_buffer (bufp)
*** 296,304 ****
      {
        if (sb_index >= from_sb.len)
  	{
  	  sb_kill (&from_sb);
! 	  cond_finish_check (macro_nest);
! 	  --macro_nest;
  	  partial_where = NULL;
  	  if (next_saved_file != NULL)
  	    *bufp = input_scrub_pop (next_saved_file);
--- 309,325 ----
      {
        if (sb_index >= from_sb.len)
  	{
+           int macro_check = !from_sb.no_macro_check;
  	  sb_kill (&from_sb);
!           if (macro_check)
!             {
!               cond_finish_check (macro_nest);
!               /* allow the target to clean up per-macro expansion data */
! #ifdef md_macro_end
!               md_macro_end ();
! #endif
!               --macro_nest;
!             }
  	  partial_where = NULL;
  	  if (next_saved_file != NULL)
  	    *bufp = input_scrub_pop (next_saved_file);
Index: gas/listing.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/listing.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 listing.c
*** listing.c	1999/07/11 20:19:57	1.4
--- listing.c	2000/01/10 16:48:54
*************** calc_hex (list)
*** 596,602 ****
    unsigned int address = ~ (unsigned int) 0;
    fragS *frag;
    fragS *frag_ptr;
!   unsigned int byte_in_frag;
  
    /* Find first frag which says it belongs to this line */
    frag = list->frag;
--- 596,602 ----
    unsigned int address = ~ (unsigned int) 0;
    fragS *frag;
    fragS *frag_ptr;
!   unsigned int octet_in_frag;
  
    /* Find first frag which says it belongs to this line */
    frag = list->frag;
*************** calc_hex (list)
*** 611,643 ****
    while (frag_ptr != (fragS *) NULL && frag_ptr->line == first)
      {
        /* Print as many bytes from the fixed part as is sensible */
!       byte_in_frag = 0;
!       while ((offsetT) byte_in_frag < frag_ptr->fr_fix
  	     && data_buffer_size < MAX_BYTES - 3)
  	{
  	  if (address == ~ (unsigned int) 0)
  	    {
! 	      address = frag_ptr->fr_address;
  	    }
  
  	  sprintf (data_buffer + data_buffer_size,
  		   "%02X",
! 		   (frag_ptr->fr_literal[byte_in_frag]) & 0xff);
  	  data_buffer_size += 2;
! 	  byte_in_frag++;
  	}
        {
! 	unsigned int var_rep_max = byte_in_frag;
! 	unsigned int var_rep_idx = byte_in_frag;
  
  	/* Print as many bytes from the variable part as is sensible */
! 	while (((offsetT) byte_in_frag
! 		< frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset)
  	       && data_buffer_size < MAX_BYTES - 3)
  	  {
  	    if (address == ~ (unsigned int) 0)
  	      {
! 		address = frag_ptr->fr_address;
  	      }
  	    sprintf (data_buffer + data_buffer_size,
  		     "%02X",
--- 611,643 ----
    while (frag_ptr != (fragS *) NULL && frag_ptr->line == first)
      {
        /* Print as many bytes from the fixed part as is sensible */
!       octet_in_frag = 0;
!       while ((offsetT) octet_in_frag < frag_ptr->fr_fix
  	     && data_buffer_size < MAX_BYTES - 3)
  	{
  	  if (address == ~ (unsigned int) 0)
  	    {
! 	      address = frag_ptr->fr_address / OCTETS_PER_BYTE;
  	    }
  
  	  sprintf (data_buffer + data_buffer_size,
  		   "%02X",
! 		   (frag_ptr->fr_literal[octet_in_frag]) & 0xff);
  	  data_buffer_size += 2;
! 	  octet_in_frag++;
  	}
        {
! 	unsigned int var_rep_max = octet_in_frag;
! 	unsigned int var_rep_idx = octet_in_frag;
  
  	/* Print as many bytes from the variable part as is sensible */
! 	while (((offsetT) octet_in_frag
! 		< (frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset))
  	       && data_buffer_size < MAX_BYTES - 3)
  	  {
  	    if (address == ~ (unsigned int) 0)
  	      {
! 		address = frag_ptr->fr_address / OCTETS_PER_BYTE;
  	      }
  	    sprintf (data_buffer + data_buffer_size,
  		     "%02X",
*************** calc_hex (list)
*** 649,655 ****
  	    data_buffer_size += 2;
  
  	    var_rep_idx++;
! 	    byte_in_frag++;
  
  	    if ((offsetT) var_rep_idx >= frag_ptr->fr_fix + frag_ptr->fr_var)
  	      var_rep_idx = var_rep_max;
--- 649,655 ----
  	    data_buffer_size += 2;
  
  	    var_rep_idx++;
! 	    octet_in_frag++;
  
  	    if ((offsetT) var_rep_idx >= frag_ptr->fr_fix + frag_ptr->fr_var)
  	      var_rep_idx = var_rep_max;
*************** print_lines (list, lineno, string, addre
*** 679,684 ****
--- 679,686 ----
    unsigned int lines;
    unsigned int byte_in_word = 0;
    char *src = data_buffer;
+   int end = strlen(src);
+   int cur;
  
    /* Print the stuff on the first line */
    listing_page (list);
*************** print_lines (list, lineno, string, addre
*** 707,717 ****
  
    /* And the data to go along with it */
    idx = 0;
!   
!   while (*src && idx < nchars)
      {
!       fprintf (list_file, "%c%c", src[0], src[1]);
!       src += 2;
        byte_in_word++;
        
        if (byte_in_word == LISTING_WORD_SIZE)
--- 709,728 ----
  
    /* And the data to go along with it */
    idx = 0;
!   cur = 0;
!   while (src[cur] && idx < nchars)
      {
!       int offset;
! #if TARGET_BYTES_BIG_ENDIAN != 0
!       offset = cur;
!       fprintf (list_file, "%c%c", src[offset], src[offset+1]);
! #else
!       offset = (cur & ~(LISTING_WORD_SIZE * 2 - 1)) 
!         + (LISTING_WORD_SIZE - byte_in_word - 1) * 2;
!       if (offset < end)
!         fprintf (list_file, "%c%c", src[offset], src[offset+1]);
! #endif
!       cur += 2;
        byte_in_word++;
        
        if (byte_in_word == LISTING_WORD_SIZE)
*************** print_lines (list, lineno, string, addre
*** 740,746 ****
    
    for (lines = 0;
         lines < (unsigned int) listing_lhs_cont_lines
! 	 && *src;
         lines ++)
      {
        nchars = ((LISTING_WORD_SIZE * 2) + 1)
--- 751,757 ----
    
    for (lines = 0;
         lines < (unsigned int) listing_lhs_cont_lines
! 	 && src[cur];
         lines ++)
      {
        nchars = ((LISTING_WORD_SIZE * 2) + 1)
*************** print_lines (list, lineno, string, addre
*** 750,759 ****
        /* Print any more lines of data, but more compactly */
        fprintf (list_file, "% 4d      ", lineno);
        
!       while (*src && idx < nchars)
  	{
! 	  fprintf (list_file, "%c%c", src[0], src[1]);
! 	  src += 2;
  	  idx += 2;
  	  byte_in_word++;
  	  
--- 761,779 ----
        /* Print any more lines of data, but more compactly */
        fprintf (list_file, "% 4d      ", lineno);
        
!       while (src[cur] && idx < nchars)
  	{
!           int offset;
! #if TARGET_BYTES_BIG_ENDIAN != 0
!           offset = cur;
!           fprintf (list_file, "%c%c", src[offset], src[offset+1]);
! #else
!           offset = (cur & ~(LISTING_WORD_SIZE * 2 - 1))
!             + (LISTING_WORD_SIZE - byte_in_word - 1) * 2;
!           if (offset < end)
!             fprintf (list_file, "%c%c", src[offset], src[offset+1]);
! #endif
! 	  cur += 2;
  	  idx += 2;
  	  byte_in_word++;
  	  
Index: gas/macro.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/macro.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 macro.c
*** macro.c	1999/11/12 15:39:46	1.5
--- macro.c	2000/01/10 16:48:55
*************** getstring (idx, in, acc)
*** 343,348 ****
--- 343,356 ----
  	  idx++;
  	  while (idx < in->len)
  	    {
+               /* handle string escapes twall@cygnus.com */
+               if (in->ptr[idx] == '\\')
+                 {
+                   idx++;
+                   sb_add_char (acc, in->ptr[idx++]);
+                   if (idx >= in->len)
+                     break;
+                 }
  	      if (macro_alternate && in->ptr[idx] == '!')
  		{
  		  idx++  ;
*************** macro_expand (idx, in, m, out, comment_c
*** 1108,1118 ****
     gasp.  Return 1 if a macro is found, 0 otherwise.  */
  
  int
! check_macro (line, expand, comment_char, error)
       const char *line;
       sb *expand;
       int comment_char;
       const char **error;
  {
    const char *s;
    char *copy, *cs;
--- 1116,1127 ----
     gasp.  Return 1 if a macro is found, 0 otherwise.  */
  
  int
! check_macro (line, expand, comment_char, error, info)
       const char *line;
       sb *expand;
       int comment_char;
       const char **error;
+      void **info;
  {
    const char *s;
    char *copy, *cs;
*************** check_macro (line, expand, comment_char,
*** 1152,1157 ****
--- 1161,1170 ----
    *error = macro_expand (0, &line_sb, macro, expand, comment_char);
  
    sb_kill (&line_sb);
+ 
+   /* export the macro information if requested */
+   if (info)
+     *info = (void *)macro;
  
    return 1;
  }
Index: gas/macro.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/macro.h,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 macro.h
*** macro.h	1999/05/03 07:28:41	1.1.1.1
--- macro.h	2000/01/10 16:48:55
*************** extern void macro_mri_mode PARAMS ((int)
*** 45,51 ****
  extern const char *define_macro
    PARAMS ((int idx, sb *in, sb *label, int (*get_line) PARAMS ((sb *)),
  	   const char **namep));
! extern int check_macro PARAMS ((const char *, sb *, int, const char **));
  extern void delete_macro PARAMS ((const char *));
  extern const char *expand_irp
    PARAMS ((int, int, sb *, sb *, int (*) PARAMS ((sb *)), int));
--- 45,52 ----
  extern const char *define_macro
    PARAMS ((int idx, sb *in, sb *label, int (*get_line) PARAMS ((sb *)),
  	   const char **namep));
! extern int check_macro PARAMS ((const char *, sb *, int, const char **, 
!                                 void **));
  extern void delete_macro PARAMS ((const char *));
  extern const char *expand_irp
    PARAMS ((int, int, sb *, sb *, int (*) PARAMS ((sb *)), int));
Index: gas/read.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/read.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 read.c
*** read.c	1999/11/03 22:14:47	1.9
--- read.c	2000/01/10 16:49:08
*************** static const pseudo_typeS potable[] =
*** 306,311 ****
--- 306,312 ----
    {"eject", listing_eject, 0},	/* Formfeed listing */
    {"else", s_else, 0},
    {"elsec", s_else, 0},
+   {"elseif", s_elseif, (int) O_ne},
    {"end", s_end, 0},
    {"endc", s_endif, 0},
    {"endfunc", s_func, 1},
*************** read_a_source_file (name)
*** 598,604 ****
  		      /* In MRI mode, we need to handle the MACRO
                           pseudo-op specially: we don't want to put the
                           symbol in the symbol table.  */
! 		      if (! mri_line_macro)
  			line_label = colon (line_start);
  		      else
  			line_label = symbol_create (line_start,
--- 599,610 ----
  		      /* In MRI mode, we need to handle the MACRO
                           pseudo-op specially: we don't want to put the
                           symbol in the symbol table.  */
! 		      if (! mri_line_macro 
! #ifdef TC_START_LABEL_WITHOUT_COLON
!                           && TC_START_LABEL_WITHOUT_COLON(c, 
!                                                           input_line_pointer)
! #endif
!                           )
  			line_label = colon (line_start);
  		      else
  			line_label = symbol_create (line_start,
*************** read_a_source_file (name)
*** 866,873 ****
  			{
  			  sb out;
  			  const char *err;
  
! 			  if (check_macro (s, &out, '\0', &err))
  			    {
  			      if (err != NULL)
  				as_bad (err);
--- 872,880 ----
  			{
  			  sb out;
  			  const char *err;
+                           void *macro;
  
! 			  if (check_macro (s, &out, '\0', &err, &macro))
  			    {
  			      if (err != NULL)
  				as_bad (err);
*************** read_a_source_file (name)
*** 877,882 ****
--- 884,892 ----
  			      sb_kill (&out);
  			      buffer_limit =
  				input_scrub_next_buffer (&input_line_pointer);
+ #ifdef md_macro_info
+                               md_macro_info (macro);
+ #endif
  			      continue;
  			    }
  			}
*************** do_align (n, fill, len, max)
*** 1193,1200 ****
  #ifdef md_do_align
   just_record_alignment:
  #endif
! 
!   record_alignment (now_seg, n);
  }
  
  /* Handle the .align pseudo-op.  A positive ARG is a default alignment
--- 1203,1209 ----
  #ifdef md_do_align
   just_record_alignment:
  #endif
!   record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER);
  }
  
  /* Handle the .align pseudo-op.  A positive ARG is a default alignment
*************** do_org (segment, exp, fill)
*** 2364,2370 ****
        char *p;
  
        p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
! 		    exp->X_add_number, (char *) NULL);
        *p = fill;
      }
  }
--- 2373,2379 ----
        char *p;
  
        p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
! 		    exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
        *p = fill;
      }
  }
*************** s_rept (ignore)
*** 2638,2652 ****
       int ignore ATTRIBUTE_UNUSED;
  {
    int count;
-   sb one;
-   sb many;
  
    count = get_absolute_expression ();
  
    sb_new (&one);
!   if (! buffer_and_nest ("REPT", "ENDR", &one, get_line_sb))
      {
!       as_bad (_("rept without endr"));
        return;
      }
  
--- 2647,2673 ----
       int ignore ATTRIBUTE_UNUSED;
  {
    int count;
  
    count = get_absolute_expression ();
  
+   do_repeat(count, "REPT", "ENDR");
+ }
+ 
+ /* generic repeat block implementation; allows different expressions to be
+    used as the start/end keys */
+ void
+ do_repeat (count, start, end)
+       int count;
+       const char *start;
+       const char *end;
+ {
+   sb one;
+   sb many;
+ 
    sb_new (&one);
!   if (! buffer_and_nest (start, end, &one, get_line_sb))
      {
!       as_bad (_("%s without %s"), start, end);
        return;
      }
  
*************** s_rept (ignore)
*** 2661,2666 ****
--- 2682,2704 ----
    buffer_limit = input_scrub_next_buffer (&input_line_pointer);
  }
  
+ /* Skip to end of current repeat loop; EXTRA indicates how many additional
+    input buffers to skip 
+    Assumes that conditionals preceding the loop end are properly nested.
+ 
+    This function makes it easier to implement a premature "break" out of the
+    loop.  The EXTRA arg accounts for other buffers we might have inserted,
+    such as line substitutions.
+ */
+ void
+ end_repeat (extra)
+   int extra;
+ {
+   cond_exit_macro (macro_nest);
+   while (extra-- >= 0)
+     buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+ }
+ 
  /* Handle the .equ, .equiv and .set directives.  If EQUIV is 1, then
     this is .equiv, and it is an error if the symbol is already
     defined.  */
*************** read_print_statistics (file)
*** 5071,5076 ****
--- 5109,5147 ----
       FILE *file;
  {
    hash_print_statistics (file, "pseudo-op table", po_hash);
+ }
+ 
+ /* inserts the given line into the input stream.  
+    
+    avoids macro conditionals nesting checking, since the contents of the line
+    are considered a self-contained element. 
+    This function allows easy substition of input lines when called by
+    md_start_line_hook(). 
+  */
+ void
+ insert_line (line)
+      char *line;
+ {
+   sb newline;
+   sb_new (&newline);
+   while (*line != 0)
+     sb_add_char (&newline, *line++);
+   newline.no_macro_check = 1;
+   input_scrub_include_sb (&newline, input_line_pointer);
+   sb_kill (&newline);
+   buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+ }
+ 
+ /* insert a (usually automatically generated) file into the input stream;
+    the path must resolve to an actual file; no include path searching or
+    dependency registering.
+  */
+ void
+ insert_file (path)
+   char *path;
+ {
+   input_scrub_include_file (path, input_line_pointer);
+   buffer_limit = input_scrub_next_buffer (&input_line_pointer);
  }
  
  /* end of read.c */
Index: gas/read.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/read.h,v
retrieving revision 1.2
diff -c -3 -p -r1.2 read.h
*** read.h	1999/06/05 18:19:08	1.2
--- read.h	2000/01/10 16:49:08
*************** extern void stabs_generate_asm_file PARA
*** 116,121 ****
--- 116,124 ----
  extern void stabs_generate_asm_lineno PARAMS ((void));
  extern void stabs_generate_asm_func PARAMS ((const char *, const char *));
  extern void stabs_generate_asm_endfunc PARAMS ((const char *, const char *));
+ extern void do_repeat PARAMS((int,const char *,const char *));
+ extern void end_repeat PARAMS((int));
+ extern void insert_line PARAMS((char *line));
  
  extern void generate_lineno_debug PARAMS ((void));
  
*************** extern void s_comm PARAMS ((int));
*** 128,133 ****
--- 131,137 ----
  extern void s_data PARAMS ((int));
  extern void s_desc PARAMS ((int));
  extern void s_else PARAMS ((int arg));
+ extern void s_elseif PARAMS ((int arg));
  extern void s_end PARAMS ((int arg));
  extern void s_endif PARAMS ((int arg));
  extern void s_err PARAMS ((int));
Index: gas/sb.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/sb.c,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 sb.c
*** sb.c	1999/05/03 07:28:41	1.1.1.1
--- sb.c	2000/01/10 16:49:08
*************** sb_build (ptr, size)
*** 92,97 ****
--- 92,98 ----
    ptr->pot = size;
    ptr->len = 0;
    ptr->item = e;
+   ptr->no_macro_check = 0;
  }
  
  
Index: gas/sb.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/sb.h,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 sb.h
*** sb.h	1999/05/03 07:28:41	1.1.1.1
--- sb.h	2000/01/10 16:49:09
*************** typedef struct sb
*** 58,63 ****
--- 58,64 ----
      int len;			/* how much is used. */
      int pot;			/* the maximum length is 1<<pot */
      struct le *item;
+     int no_macro_check;         /* skip macro/conditional nest checking */
    }
  sb;
  
Index: gas/stabs.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/stabs.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 stabs.c
*** stabs.c	1999/07/11 20:19:59	1.3
--- stabs.c	2000/01/10 16:49:10
*************** generate_asm_file (type, file)
*** 498,504 ****
    static char *last_file;
    static int label_count;
    char *hold;
!   char buf[100];
    char sym[30];
  
    /* Rather than try to do this in some efficient fashion, we just
--- 498,504 ----
    static char *last_file;
    static int label_count;
    char *hold;
!   char buf[strlen(file) + 100];
    char sym[30];
  
    /* Rather than try to do this in some efficient fashion, we just
*************** generate_asm_file (type, file)
*** 511,520 ****
    if (last_file == NULL
        || strcmp (last_file, file) != 0)
      {
        sprintf (sym, "%sF%d", FAKE_LABEL_NAME, label_count);
        ++label_count;
  
!       sprintf (buf, "\"%s\",%d,0,0,%s\n", file, type, sym);
        input_line_pointer = buf;
        s_stab ('s');
        colon (sym);
--- 511,538 ----
    if (last_file == NULL
        || strcmp (last_file, file) != 0)
      {
+       char *tmp = file;
+       char *endp = file + strlen(file);
+       char *bufp = buf;
+ 
        sprintf (sym, "%sF%d", FAKE_LABEL_NAME, label_count);
        ++label_count;
  
!       *bufp++ = '"';
!       while (tmp < endp)
!         {
!           char *bslash = strchr (tmp, '\\');
!           int len = (bslash ? (bslash - tmp + 1) : strlen(tmp));
!           /* double all backslashes, since demand_copy_C_string (used by
!              s_stab to extract the part in quotes) will try to replace them as
!              escape sequences.  backslash may appear in a filespec. */
!           strncpy (bufp, tmp, len);
!           tmp += len;
!           bufp += len;
!           if (bslash != NULL)
!             *bufp++ = '\\';
!         } 
!       sprintf (bufp, "\",%d,0,0,%s\n", type, sym);
        input_line_pointer = buf;
        s_stab ('s');
        colon (sym);
Index: gas/symbols.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/symbols.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 symbols.c
*** symbols.c	1999/08/03 15:29:03	1.10
--- symbols.c	2000/01/10 16:49:13
*************** resolve_symbol_value (symp, finalize)
*** 856,865 ****
        struct local_symbol *locsym = (struct local_symbol *) symp;
  
        if (local_symbol_resolved_p (locsym))
! 	return locsym->lsy_offset;
  
        final_val = (local_symbol_get_frag (locsym)->fr_address
! 		   + locsym->lsy_offset);
  
        if (finalize)
  	{
--- 856,865 ----
        struct local_symbol *locsym = (struct local_symbol *) symp;
  
        if (local_symbol_resolved_p (locsym))
! 	return locsym->lsy_offset / OCTETS_PER_BYTE;
  
        final_val = (local_symbol_get_frag (locsym)->fr_address
! 		   + locsym->lsy_offset) / OCTETS_PER_BYTE;
  
        if (finalize)
  	{
*************** resolve_symbol_value (symp, finalize)
*** 915,921 ****
  	  /* Fall through.  */
  
  	case O_constant:
! 	  final_val += symp->sy_frag->fr_address;
  	  if (final_seg == expr_section)
  	    final_seg = absolute_section;
  	  resolved = 1;
--- 915,921 ----
  	  /* Fall through.  */
  
  	case O_constant:
! 	  final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE;
  	  if (final_seg == expr_section)
  	    final_seg = absolute_section;
  	  resolved = 1;
Index: gas/config/obj-coff.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/obj-coff.c,v
retrieving revision 1.19
diff -c -3 -p -r1.19 obj-coff.c
*** obj-coff.c	1999/09/12 03:44:41	1.19
--- obj-coff.c	2000/01/10 16:49:21
*************** coff_frob_symbol (symp, punt)
*** 1269,1275 ****
        for (; i > 0; i--)
  	{
  	  if (lptr->frag)
! 	    lptr->l.u.offset += lptr->frag->fr_address;
  	  l[i] = lptr->l;
  	  lptr = lptr->next;
  	}
--- 1269,1275 ----
        for (; i > 0; i--)
  	{
  	  if (lptr->frag)
! 	    lptr->l.u.offset += lptr->frag->fr_address / OCTETS_PER_BYTE;
  	  l[i] = lptr->l;
  	  lptr = lptr->next;
  	}
*************** coff_frob_section (sec)
*** 1453,1477 ****
    char *p;
    fragS *fragp;
    bfd_vma size, n_entries, mask;
  
    /* The COFF back end in BFD requires that all section sizes be
!      rounded up to multiples of the corresponding section alignments.
!      Seems kinda silly to me, but that's the way it is.  */
    size = bfd_get_section_size_before_reloc (sec);
!   mask = ((bfd_vma) 1 << (bfd_vma) sec->alignment_power) - 1;
    if (size & mask)
      {
        size = (size + mask) & ~mask;
        bfd_set_section_size (stdoutput, sec, size);
      }
  
    /* If the section size is non-zero, the section symbol needs an aux
       entry associated with it, indicating the size.  We don't know
       all the values yet; coff_frob_symbol will fill them in later.  */
    if (size != 0
        || sec == text_section
        || sec == data_section
        || sec == bss_section)
      {
        symbolS *secsym = section_symbol (sec);
  
--- 1453,1484 ----
    char *p;
    fragS *fragp;
    bfd_vma size, n_entries, mask;
+   bfd_vma align_power = (bfd_vma)sec->alignment_power + OCTETS_PER_BYTE_POWER;
  
    /* The COFF back end in BFD requires that all section sizes be
!      rounded up to multiples of the corresponding section alignments,
!      supposedly because standard COFF has no other way of encoding alignment
!      for sections.  If your COFF flavor has a different way of encoding
!      section alignment, then skip this step, as TICOFF does. */
    size = bfd_get_section_size_before_reloc (sec);
!   mask = ((bfd_vma) 1 << align_power) - 1;
! #if !defined(TICOFF)
    if (size & mask)
      {
        size = (size + mask) & ~mask;
        bfd_set_section_size (stdoutput, sec, size);
      }
+ #endif
  
    /* If the section size is non-zero, the section symbol needs an aux
       entry associated with it, indicating the size.  We don't know
       all the values yet; coff_frob_symbol will fill them in later.  */
+ #ifndef TICOFF
    if (size != 0
        || sec == text_section
        || sec == data_section
        || sec == bss_section)
+ #endif
      {
        symbolS *secsym = section_symbol (sec);
  
Index: gas/config/obj-coff.h
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/obj-coff.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 obj-coff.h
*** obj-coff.h	1999/09/12 03:44:41	1.3
--- obj-coff.h	2000/01/10 16:49:23
***************
*** 132,137 ****
--- 132,142 ----
  #define TARGET_FORMAT "coff-tic30"
  #endif
  
+ #ifdef TC_TIC54X
+ #include "coff/tic54x.h"
+ #define TARGET_FORMAT "coff1-c54x"
+ #endif
+ 
  #ifdef TC_TIC80
  #include "coff/tic80.h"
  #define TARGET_FORMAT "coff-tic80"
Index: gas/doc/Makefile.am
===================================================================
RCS file: /cvs/binutils/binutils/gas/doc/Makefile.am,v
retrieving revision 1.2
diff -c -3 -p -r1.2 Makefile.am
*** Makefile.am	1999/09/04 17:29:22	1.2
--- Makefile.am	2000/01/10 16:49:24
*************** CPU_DOCS = \
*** 30,35 ****
--- 30,36 ----
  	c-pj.texi \
  	c-sh.texi \
  	c-sparc.texi \
+         c-tic54x.texi \
  	c-vax.texi \
  	c-v850.texi \
  	c-z8k.texi
Index: gas/doc/Makefile.in
===================================================================
RCS file: /cvs/binutils/binutils/gas/doc/Makefile.in,v
retrieving revision 1.4
diff -c -3 -p -r1.4 Makefile.in
*** Makefile.in	1999/09/04 17:29:22	1.4
--- Makefile.in	2000/01/10 16:49:25
*************** CPU_DOCS = \
*** 134,139 ****
--- 134,140 ----
  	c-pj.texi \
  	c-sh.texi \
  	c-sparc.texi \
+         c-tic54x.texi \
  	c-vax.texi \
  	c-v850.texi \
  	c-z8k.texi
Index: gas/doc/all.texi
===================================================================
RCS file: /cvs/binutils/binutils/gas/doc/all.texi,v
retrieving revision 1.2
diff -c -3 -p -r1.2 all.texi
*** all.texi	1999/09/04 17:29:22	1.2
--- all.texi	2000/01/10 16:49:27
***************
*** 42,47 ****
--- 42,48 ----
  @set PJ
  @set SH
  @set SPARC
+ @set C54X
  @set V850
  @set VAX
  @set VXWORKS
Index: gas/doc/as.texinfo
===================================================================
RCS file: /cvs/binutils/binutils/gas/doc/as.texinfo,v
retrieving revision 1.6
diff -c -3 -p -r1.6 as.texinfo
*** as.texinfo	2000/01/03 18:34:24	1.6
--- as.texinfo	2000/01/10 16:49:37
*************** Here is a brief summary of how to invoke
*** 249,254 ****
--- 249,258 ----
     -Av8plus | -Av8plusa | -Av9 | -Av9a ]
   [ -xarch=v8plus | -xarch=v8plusa ] [ -bump ] [ -32 | -64 ]
  @end ifset
+ @ifset TIC54X
+  [ -mcpu=54[123589] | -mcpu=54[56]lp ] [ -mfar-mode | -mf ] 
+  [ -merrors-to-file <filename> | -me <filename> ]
+ @end ifset
  @ifset Z8000
  @c Z8000 has no machine-dependent assembler options
  @end ifset
*************** Warn when the assembler switches to anot
*** 559,564 ****
--- 563,584 ----
  @end table
  @end ifset
  
+ @ifset TIC54X
+ The following options are available when @value{AS} is configured for the 'c54x
+ architecture. 
+ 
+ @table @code
+ @item -mfar-mode
+ Enable extended addressing mode.  All addresses and relocations will assume
+ extended addressing (usually 23 bits).
+ @item -mcpu=@var{CPU_VERSION}
+ Sets the CPU version being compiled for.
+ @item -merrors-to-file @var{FILENAME}
+ Redirect error output to a file, for broken systems which don't support such
+ behaviour in the shell.
+ @end table
+ @end ifset
+ 
  @ifset MIPS
  The following options are available when @value{AS} is configured for
  a MIPS processor.
*************** Some machine configurations provide addi
*** 3106,3111 ****
--- 3126,3132 ----
  * Double::                      @code{.double @var{flonums}}
  * Eject::                       @code{.eject}
  * Else::                        @code{.else}
+ * Elseif::                      @code{.elseif}
  * End::				@code{.end}
  @ifset COFF
  * Endef::                       @code{.endef}
*************** assembly; @pxref{If,,@code{.if}}.  It ma
*** 3463,3468 ****
--- 3484,3497 ----
  of code to be assembled if the condition for the preceding @code{.if}
  was false.
  
+ @node Elseif
+ @section @code{.elseif}
+ 
+ @cindex @code{elseif} directive
+ @code{.elseif} is part of the @code{@value{AS}} support for conditional
+ assembly; @pxref{If,,@code{.if}}.  It is shorthand for beginning a new
+ @code{.if} block that would otherwise fill the entire @code{.else} section.
+ 
  @node End
  @section @code{.end}
  
*************** considered part of the source program be
*** 3691,3696 ****
--- 3720,3727 ----
  the conditional section of code must be marked by @code{.endif}
  (@pxref{Endif,,@code{.endif}}); optionally, you may include code for the
  alternative condition, flagged by @code{.else} (@pxref{Else,,@code{.else}}).
+ If you have several conditions to check, @code{.elseif} may be used to avoid
+ nesting blocks if/else within each subsequent @code{.else} block.
  
  The following variants of @code{.if} are also supported:
  @table @code
*************** subject, see the hardware manufacturer's
*** 4934,4939 ****
--- 4965,4973 ----
  @ifset SPARC
  * Sparc-Dependent::             SPARC Dependent Features
  @end ifset
+ @ifset TIC54X
+ * TIC54X-Dependent::            TI TMS320C54x Dependent Features
+ @end ifset
  @ifset V850
  * V850-Dependent::              V850 Dependent Features
  @end ifset
*************** family.
*** 5113,5118 ****
--- 5147,5156 ----
  @include c-sparc.texi
  @end ifset
  
+ @ifset TIC54X
+ @include c-tic54x.texi
+ @end ifset
+ 
  @ifset Z8000
  @include c-z8k.texi
  @end ifset
*************** and some initial 64-bit support).
*** 5413,5418 ****
--- 5451,5459 ----
  
  Richard Henderson rewrote the Alpha assembler. Klaus Kaempf wrote GAS and BFD
  support for openVMS/Alpha.
+ 
+ Timothy Wall, Michael Hayes, and Greg Smart contributed to the various tic*
+ flavors.
  
  Several engineers at Cygnus Support have also provided many small bug fixes and
  configuration enhancements.
Index: gas/doc/internals.texi
===================================================================
RCS file: /cvs/binutils/binutils/gas/doc/internals.texi,v
retrieving revision 1.4
diff -c -3 -p -r1.4 internals.texi
*** internals.texi	1999/09/12 03:44:42	1.4
--- internals.texi	2000/01/10 16:49:40
*************** If you define this macro, GAS will assum
*** 984,992 ****
  is a label, even if it does not have a colon.
  
  @item TC_START_LABEL
  @cindex TC_START_LABEL
  You may define this macro to control what GAS considers to be a label.  The
! default definition is to accept any name followed by a colon character.
  
  @item NO_PSEUDO_DOT
  @cindex NO_PSEUDO_DOT
--- 984,996 ----
  is a label, even if it does not have a colon.
  
  @item TC_START_LABEL
+ @itemx TC_START_LABEL_WITHOUT_COLON
  @cindex TC_START_LABEL
+ @cindex TC_START_LABEL_WITHOUT_COLON
  You may define this macro to control what GAS considers to be a label.  The
! default definition is to accept any name followed by a colon character.  If you
! have defined @samp{LABELS_WITHOUT_COLONS} then you should define
! @samp{TC_START_LABEL_WITHOUT_COLON} instead of @samp{TC_START_LABEL}.
  
  @item NO_PSEUDO_DOT
  @cindex NO_PSEUDO_DOT
*************** If you define this macro, GAS will call 
*** 1217,1222 ****
--- 1221,1258 ----
  @cindex md_section_align
  GAS will call this function for each section at the end of the assembly, to
  permit the CPU backend to adjust the alignment of a section.
+ 
+ @item md_macro_start
+ @cindex md_macro_start
+ GAS will call this function when it starts to include a macro expansion.
+ 'macro_nest' indicates the current macro nesting level, which includes the one
+ being expanded. 
+ 
+ @item md_macro_info
+ @cindex md_macro_info
+ GAS will call this function after the macro expansion has been included and
+ after parsing the macro arguments.  The single argument is a pointer to the
+ macro processing's internal representation of the macro, which includes
+ expansion of the formal arguments.
+ 
+ @item md_macro_end
+ @cindex md_macro_end
+ Complement to md_macro_start, called when finished processing an inserted macro
+ expansion, just before decrementing macro_nest.
+ 
+ @item DOUBLEBAR_PARALLEL
+ @cindex DOUBLEBAR_PARALLEL
+ Affects the preprocessor so that lines containing '||' don't have their
+ whitespace stripped following the double bar.  This is useful for targets that
+ implement parallel instructions.
+ 
+ @item KEEP_WHITE_AROUND_COLON
+ @cindex KEEP_WHITE_AROUND_COLON
+ Affects the preprocessor so that whitespace around colons is preserved.
+ Normally, whitespace is compressed and removed when, in the presence of the
+ colon, the adjoining tokens can be distinguished.  This is useful when
+ colons might be removed from the input after preprocessing but before
+ assembling.
  
  @item tc_frob_section
  @cindex tc_frob_section
Index: gas/testsuite/gas/all/gas.exp
===================================================================
RCS file: /cvs/binutils/binutils/gas/testsuite/gas/all/gas.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 gas.exp
*** gas.exp	1999/09/12 05:32:03	1.2
--- gas.exp	2000/01/10 16:49:40
*************** gas_test "p2425.s" ""   "" "pcrel values
*** 11,17 ****
  # Therefore this test (as it is currently written) is completely bogus
  # for any PA target.  Do not bother trying to run it and just claim
  # it fails.
! if [istarget hppa*-*-*] then {
      setup_xfail *-*-*
      fail "simplifiable double subtraction"
  } else {
--- 11,22 ----
  # Therefore this test (as it is currently written) is completely bogus
  # for any PA target.  Do not bother trying to run it and just claim
  # it fails.
! #
! # The C54x uses ".space" to allocate bits, and requires absolute expressions;
! # The ".space" directive is taken care of in the C54x-specific tests, so fail
! #  here 
! #
! if { [istarget hppa*-*-*] || [istarget *c54x*-*-*] } then {
      setup_xfail *-*-*
      fail "simplifiable double subtraction"
  } else {
*************** proc do_930509a {} {
*** 79,85 ****
  
  # This test is meaningless for the PA; the difference of two symbols
  # must not be resolved by the assembler.
! if ![istarget hppa*-*-*] then {
      # the vax fails because VMS can apparently actually handle this
      # case in relocs, so gas doesn't handle it itself.
      setup_xfail "vax*-*-vms*"
--- 84,92 ----
  
  # This test is meaningless for the PA; the difference of two symbols
  # must not be resolved by the assembler.
! # C54x assembler (for compatibility) does not allow differences between
! # forward references
! if { ![istarget hppa*-*-*] && ![istarget *c54x*-*-*] } then {
      # the vax fails because VMS can apparently actually handle this
      # case in relocs, so gas doesn't handle it itself.
      setup_xfail "vax*-*-vms*"
*************** if ![istarget hppa*-*-*] then {
*** 88,95 ****
--- 95,105 ----
      do_930509a
  }
  
+ # ".struct" and ".align" have different meanings on c54x
+ # These directives are done in the c54x-specific tests instead
  case $target_triplet in {
      { hppa*-*-* } { }
+     { *c54x*-*-* } { }
      default {
  	run_dump_test struct
  	run_dump_test align
*************** case $target_triplet in {
*** 100,106 ****
  # We omit m88k COFF because it uses weird pseudo-op names.
  # We omit the ARM toolchains because they define locals to
  #  start with '.', which eliminates .eos, .text etc from the output.
! if {   ([istarget *-*-coff*] && ![istarget m88*-*-*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff]) \
       ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
       || [istarget a29k-*-udi*] \
       || [istarget a29k-*-ebmon*] \
--- 110,117 ----
  # We omit m88k COFF because it uses weird pseudo-op names.
  # We omit the ARM toolchains because they define locals to
  #  start with '.', which eliminates .eos, .text etc from the output.
! # Omit c54x, since .tag and .def mean something different on that target
! if {   ([istarget *-*-coff*] && ![istarget m88*-*-*] && ![istarget *arm*-*-coff] && ![istarget thumb*-*-coff] && ![istarget *c54x*-*-coff]) \
       ||([istarget *-*-pe*] && ![istarget arm*-*-pe*] && ![istarget thumb*-*-pe*]) \
       || [istarget a29k-*-udi*] \
       || [istarget a29k-*-ebmon*] \
*************** proc test_cond {} {
*** 137,143 ****
      }
  }
  
! test_cond
  
  # FIXME: this is here cause of a bug in DejaGnu 1.1.1. When it is no longer
  #        in use, then this can be removed.
--- 148,157 ----
      }
  }
  
! # again, p2align doesn't work on c54x target
! if ![istarget *c54x*-*-*] then {
!     test_cond
! }
  
  # FIXME: this is here cause of a bug in DejaGnu 1.1.1. When it is no longer
  #        in use, then this can be removed.
Index: gas/testsuite/gas/ieee-fp/x930509a.exp
===================================================================
RCS file: /cvs/binutils/binutils/gas/testsuite/gas/ieee-fp/x930509a.exp,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 x930509a.exp
*** x930509a.exp	1999/05/03 07:28:51	1.1.1.1
--- x930509a.exp	2000/01/10 16:49:40
*************** proc dotest {} {
*** 20,25 ****
      if !$x then { fail "$testname (listing didn't match)" }
  }
  
! if ![istarget vax*-*-*] then {
      dotest
  }
--- 20,27 ----
      if !$x then { fail "$testname (listing didn't match)" }
  }
  
! # C54x alignment/addressing is different, so the listing looks different
! # float encoding is tested in c54x-specific tests
! if { ![istarget vax*-*-*] && ![istarget *c54x*-*-*] } then {
      dotest
  }
Index: gas/testsuite/gas/macros/macros.exp
===================================================================
RCS file: /cvs/binutils/binutils/gas/testsuite/gas/macros/macros.exp,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 macros.exp
*** macros.exp	1999/05/03 07:28:51	1.1.1.1
--- macros.exp	2000/01/10 16:49:41
*************** if ![istarget hppa*-*-*] {
*** 4,21 ****
      run_dump_test test1
  }
  
! run_dump_test test2
  
  run_dump_test test3
  
! run_dump_test irp
  
- run_dump_test rept
  
  gas_test_error "err.s" "" "macro infinite recursion"
  
  case $target_triplet in {
      { hppa*-*-* } { }
      default {
  	run_dump_test semi
      }
--- 4,26 ----
      run_dump_test test1
  }
  
! if ![istarget *c54x*-*-*] {
!     run_dump_test test2
! }
  
  run_dump_test test3
  
! if ![istarget *c54x*-*-*] {
!     run_dump_test irp
!     run_dump_test rept
! }
  
  
  gas_test_error "err.s" "" "macro infinite recursion"
  
  case $target_triplet in {
      { hppa*-*-* } { }
+     { *c54x*-*-* } { }
      default {
  	run_dump_test semi
      }
Index: include/dis-asm.h
===================================================================
RCS file: /cvs/binutils/binutils/include/dis-asm.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 dis-asm.h
*** dis-asm.h	1999/12/16 01:23:39	1.4
--- dis-asm.h	2000/01/10 16:49:47
*************** typedef struct disassemble_info {
*** 121,126 ****
--- 121,131 ----
    int bytes_per_chunk;
    enum bfd_endian display_endian;
  
+   /* Number of host bytes per incremented target address 
+      Normally one, but some DSPs have byte sizes of 16 or 32
+    */
+   int octets_per_byte;
+ 
    /* Results from instruction decoders.  Not all decoders yet support
       this information.  This info is set each time an instruction is
       decoded, and is only valid for the last such instruction.
*************** extern int print_insn_d10v		PARAMS ((bfd
*** 185,190 ****
--- 190,196 ----
  extern int print_insn_d30v		PARAMS ((bfd_vma, disassemble_info*));
  extern int print_insn_v850		PARAMS ((bfd_vma, disassemble_info*));
  extern int print_insn_tic30		PARAMS ((bfd_vma, disassemble_info*));
+ extern int print_insn_tic54x		PARAMS ((bfd_vma, disassemble_info*));
  extern int print_insn_vax		PARAMS ((bfd_vma, disassemble_info*));
  extern int print_insn_tic80		PARAMS ((bfd_vma, disassemble_info*));
  extern int print_insn_pj		PARAMS ((bfd_vma, disassemble_info*));
*************** extern int generic_symbol_at_address
*** 225,230 ****
--- 231,237 ----
    (INFO).arch = bfd_arch_unknown, \
    (INFO).mach = 0, \
    (INFO).endian = BFD_ENDIAN_UNKNOWN, \
+   (INFO).octets_per_byte = 1, \
    INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)
  
  /* Call this macro to initialize only the internal variables for the
Index: include/coff/internal.h
===================================================================
RCS file: /cvs/binutils/binutils/include/coff/internal.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 internal.h
*** internal.h	1999/09/20 08:45:53	1.4
--- internal.h	2000/01/10 16:49:49
*************** struct internal_filehdr
*** 53,59 ****
    long f_nsyms;			/* number of symtab entries	*/
    unsigned short f_opthdr;	/* sizeof(optional hdr)		*/
    unsigned short f_flags;	/* flags			*/
!   unsigned short f_target_id;	/* (TIc80 specific)		*/
  };
  
  
--- 53,59 ----
    long f_nsyms;			/* number of symtab entries	*/
    unsigned short f_opthdr;	/* sizeof(optional hdr)		*/
    unsigned short f_flags;	/* flags			*/
!   unsigned short f_target_id;	/* (TI COFF specific)		*/
  };
  
  
*************** struct internal_filehdr
*** 68,73 ****
--- 68,74 ----
   *	F_DYNLOAD	rs/6000 aix: dynamically loadable w/imports & exports
   *	F_SHROBJ	rs/6000 aix: file is a shared object
   *      F_DLL           PE format DLL
+  *      F_LDPAGE        TI COFF uses load page
   */
  
  #define	F_RELFLG	(0x0001)
*************** struct internal_filehdr
*** 80,85 ****
--- 81,87 ----
  #define	F_DYNLOAD	(0x1000)
  #define	F_SHROBJ	(0x2000)
  #define F_DLL           (0x2000)
+ #define F_LDPAGE        (0x4000)
  
  /* extra structure which is used in the optional header */
  typedef struct _IMAGE_DATA_DIRECTORY 
*************** struct internal_aouthdr
*** 222,228 ****
  
  #define C_WEAKEXT	127	/* weak symbol -- GNU extension */
  
! /* New storage classes for TIc80 */
  #define C_UEXT		19	/* Tentative external definition */
  #define C_STATLAB	20	/* Static load time label */
  #define C_EXTLAB	21	/* External load time label */
--- 224,230 ----
  
  #define C_WEAKEXT	127	/* weak symbol -- GNU extension */
  
! /* New storage classes for TI COFF */
  #define C_UEXT		19	/* Tentative external definition */
  #define C_STATLAB	20	/* Static load time label */
  #define C_EXTLAB	21	/* External load time label */
*************** struct internal_scnhdr
*** 301,306 ****
--- 303,309 ----
    unsigned long s_nlnno;	/* number of line number entries*/
    long s_flags;			/* flags			*/
    long s_align;			/* used on I960			*/
+   unsigned long s_page;         /* TI COFF                      */
  };
  
  /*
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/binutils/binutils/ld/Makefile.am,v
retrieving revision 1.19
diff -c -3 -p -r1.19 Makefile.am
*** Makefile.am	1999/12/02 11:49:19	1.19
--- Makefile.am	2000/01/10 16:50:06
*************** ALL_EMULATIONS = \
*** 202,207 ****
--- 202,208 ----
  	esun4.o \
  	etic30aout.o \
  	etic30coff.o \
+ 	etic54xcoff.o \
  	etic80coff.o \
  	evanilla.o \
  	evax.o \
*************** etic30aout.c: $(srcdir)/emulparams/tic30
*** 619,624 ****
--- 620,628 ----
  etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \
    $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} tic30coff "$(tdir_tic30coff)"
+ etic54xcoff.c: $(srcdir)/emulparams/tic54xcoff.sh \
+   $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic54xcoff.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} tic54xcoff "$(tdir_tic54xcoff)"
  etic80coff.c: $(srcdir)/emulparams/tic80coff.sh \
    $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic80coff.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} tic80coff "$(tdir_tic80coff)"
Index: ld/Makefile.in
===================================================================
RCS file: /cvs/binutils/binutils/ld/Makefile.in,v
retrieving revision 1.20
diff -c -3 -p -r1.20 Makefile.in
*** Makefile.in	1999/12/02 11:49:19	1.20
--- Makefile.in	2000/01/10 16:50:08
*************** ALL_EMULATIONS = \
*** 307,312 ****
--- 307,313 ----
  	esun4.o \
  	etic30aout.o \
  	etic30coff.o \
+ 	etic54xcoff.o \
  	etic80coff.o \
  	evanilla.o \
  	evax.o \
*************** etic30aout.c: $(srcdir)/emulparams/tic30
*** 1320,1325 ****
--- 1321,1329 ----
  etic30coff.c: $(srcdir)/emulparams/tic30coff.sh \
    $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic30coff.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} tic30coff "$(tdir_tic30coff)"
+ etic54xcoff.c: $(srcdir)/emulparams/tic54xcoff.sh \
+   $(srcdir)/emultempl/ticoff.em $(srcdir)/scripttempl/tic54xcoff.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} tic54xcoff "$(tdir_tic54xcoff)"
  etic80coff.c: $(srcdir)/emulparams/tic80coff.sh \
    $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/tic80coff.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} tic80coff "$(tdir_tic80coff)"
Index: ld/configure.tgt
===================================================================
RCS file: /cvs/binutils/binutils/ld/configure.tgt,v
retrieving revision 1.17
diff -c -3 -p -r1.17 configure.tgt
*** configure.tgt	1999/09/04 17:37:36	1.17
--- configure.tgt	2000/01/10 16:50:09
*************** powerpc-*-beos*)	targ_emul=aixppc ;;
*** 250,255 ****
--- 250,256 ----
  rs6000-*-aix*)		targ_emul=aixrs6 ;;
  tic30-*-*aout*)		targ_emul=tic30aout ;;
  tic30-*-*coff*)		targ_emul=tic30coff ;;
+ tic54x-*-* | c54x*-*-*)	targ_emul=tic54xcoff ;;
  tic80-*-*)		targ_emul=tic80coff ;;
  v850-*-*)		targ_emul=v850 ;;
  v850e-*-*)		targ_emul=v850 ;;
Index: ld/gen-doc.texi
===================================================================
RCS file: /cvs/binutils/binutils/ld/gen-doc.texi,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 gen-doc.texi
*** gen-doc.texi	1999/05/03 07:29:06	1.1.1.1
--- gen-doc.texi	2000/01/10 16:50:09
***************
*** 5,10 ****
--- 5,11 ----
  @c 2. Specific target machines
  @set H8300
  @set I960
+ @set TICOFF
  
  @c 3. Properties of this configuration
  @clear SingleFormat
Index: ld/ld.h
===================================================================
RCS file: /cvs/binutils/binutils/ld/ld.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 ld.h
*** ld.h	2000/01/05 14:12:23	1.3
--- ld.h	2000/01/10 16:50:09
*************** typedef struct  user_section_struct
*** 96,101 ****
--- 96,107 ----
  #define ALIGN_N(this, boundary) \
    ((( (this) + ((boundary) -1)) & (~((boundary)-1))))
  
+ /* align only if the start and end addresses fail to fall within the blocking
+    value */
+ #define BLOCK_N(start, len, blocking) \
+ (((((start)+(len)) & ~((blocking)-1)) == ((start) & ~((blocking)-1))) ? \
+  (start) : ALIGN_N(start, blocking))
+ 
  typedef struct
  {
    /* 1 => assign space to common symbols even if `relocatable_output'.  */
Index: ld/ld.texinfo
===================================================================
RCS file: /cvs/binutils/binutils/ld/ld.texinfo,v
retrieving revision 1.10
diff -c -3 -p -r1.10 ld.texinfo
*** ld.texinfo	2000/01/07 19:46:04	1.10
--- ld.texinfo	2000/01/10 16:50:17
*************** This file documents the @sc{gnu} linker 
*** 105,110 ****
--- 105,113 ----
  @ifset I960
  * i960::                        ld and the Intel 960 family
  @end ifset
+ @ifset TICOFF
+ * TI COFF::                     ld and the TI COFF
+ @end ifset
  @end ifclear
  @ifclear SingleFormat
  * BFD::                         BFD
*************** assembler.  It causes the linker to crea
*** 854,859 ****
--- 857,868 ----
  runtime to relocate any data which was statically initialized to pointer
  values.  See the code in testsuite/ld-empic for details.
  
+ @cindex stderr redirect
+ @kindex --errors-to-file @var{file}
+ @item --errors-to-file @var{file}
+ This option is useful on deficient systems that cannot otherwise redirect
+ stderr to a file.
+ 
  @kindex --force-exe-suffix
  @item  --force-exe-suffix
  Make sure that an output file has a .exe suffix.
*************** The full description of an output sectio
*** 2127,2133 ****
      @var{output-section-command}
      @var{output-section-command}
      @dots{}
!   @} [>@var{region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
  @end group
  @end smallexample
  
--- 2136,2142 ----
      @var{output-section-command}
      @var{output-section-command}
      @dots{}
!   @} [>@var{region}] [AT>@var{lma_region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}] [ALIGN(@var{align})] [FIT(@var{block})]
  @end group
  @end smallexample
  
*************** set to precisely that.  If you provide n
*** 2183,2189 ****
  current value of the location counter aligned to the alignment
  requirements of the output section.  The alignment requirement of the
  output section is the strictest alignment of any input section contained
! within the output section.
  
  For example,
  @smallexample
--- 2192,2199 ----
  current value of the location counter aligned to the alignment
  requirements of the output section.  The alignment requirement of the
  output section is the strictest alignment of any input section contained
! within the output section.  The section alignment may also be set with
! @var{align}.  
  
  For example,
  @smallexample
*************** like this:
*** 2632,2638 ****
      @var{output-section-command}
      @var{output-section-command}
      @dots{}
!   @} [>@var{region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}]
  @end group
  @end smallexample
  We've already described @var{section}, @var{address}, and
--- 2642,2648 ----
      @var{output-section-command}
      @var{output-section-command}
      @dots{}
!   @} [>@var{region}] [AT>@var{lma_region}] [:@var{phdr} :@var{phdr} @dots{}] [=@var{fillexp}] [ALIGN(@var{align})] [BLOCK(@var{block})]
  @end group
  @end smallexample
  We've already described @var{section}, @var{address}, and
*************** remaining section attributes.
*** 2645,2650 ****
--- 2655,2662 ----
  * Output Section Region::	Output section region
  * Output Section Phdr::		Output section phdr
  * Output Section Fill::		Output section fill
+ * Output Section Alignment::    Output section alignment
+ * Output Section Blocking::     Output section blocking
  @end menu
  
  @node Output Section Type
*************** SECTIONS @{
*** 2686,2691 ****
--- 2698,2704 ----
  
  @node Output Section LMA
  @subsubsection Output section LMA
+ @kindex AT>@var{lma_region}
  @kindex AT(@var{lma})
  @cindex load address
  @cindex section load address
*************** Address}).
*** 2696,2702 ****
  
  The linker will normally set the LMA equal to the VMA.  You can change
  that by using the @code{AT} keyword.  The expression @var{lma} that
! follows the @code{AT} keyword specifies the load address of the section.
  
  @cindex ROM initialized data
  @cindex initialized data in ROM
--- 2709,2717 ----
  
  The linker will normally set the LMA equal to the VMA.  You can change
  that by using the @code{AT} keyword.  The expression @var{lma} that
! follows the @code{AT} keyword specifies the load address of the
! section.  Alternatively, with @samp{AT>@var{lma_region}} expression,
! you may specify a memory region for the section's load address. @xref{MEMORY}.
  
  @cindex ROM initialized data
  @cindex initialized data in ROM
*************** SECTIONS @{ .text : @{ *(.text) @} =0x90
*** 2804,2809 ****
--- 2819,2840 ----
  @end group
  @end smallexample
  
+ @node Output Section Alignment
+ @subsubsection Output section alignment
+ @kindex ALIGN(@var{exp})
+ @cindex aligment, output section
+ You can set the alignment of the output section here.  The alignment
+ value is in bytes and should be a power of two.
+ 
+ @node Output Section Blocking
+ @subsubsection Output section blocking
+ @kindex BLOCK(@var{exp})
+ @cindex blocking, output section
+ The blocking value indicates that the section, if smaller than the
+ blocking value, should not cross a blocking boundary, or, if larger than
+ the blocking value, should be aligned at a block boundary.  The blocking
+ value is in bytes and should be a power of two.
+ 
  @node Overlay Description
  @subsection Overlay description
  @kindex OVERLAY
*************** you wish.  The syntax is:
*** 2943,2949 ****
  @group
  MEMORY 
    @{
!     @var{name} [(@var{attr})] : ORIGIN = @var{origin}, LENGTH = @var{len}
      @dots{}
    @}
  @end group
--- 2974,2980 ----
  @group
  MEMORY 
    @{
!     [PAGE @var{page} :] @var{name} [(@var{attr})] : ORIGIN = @var{origin}, LENGTH = @var{len}
      @dots{}
    @}
  @end group
*************** The @var{name} is a name used in the lin
*** 2953,2959 ****
  region.  The region name has no meaning outside of the linker script.
  Region names are stored in a separate name space, and will not conflict
  with symbol names, file names, or section names.  Each memory region
! must have a distinct name.
  
  @cindex memory region attributes
  The @var{attr} string is an optional list of attributes that specify
--- 2984,2996 ----
  region.  The region name has no meaning outside of the linker script.
  Region names are stored in a separate name space, and will not conflict
  with symbol names, file names, or section names.  Each memory region
! must have a distinct name.  
! 
! @cindex memory pages
! @var{page} may be used to uniquely identify up to 255 unique address
! spaces.  If the target uses memory pages, initialized sections default
! to page 0, and uninitialized sections default to page 1.  If the target
! doesn't use memory pages, @var{page} is ignored.
  
  @cindex memory region attributes
  The @var{attr} string is an optional list of attributes that specify
*************** functionality are not listed.
*** 3826,3831 ****
--- 3863,3871 ----
  * H8/300::                      @code{ld} and the H8/300
  * i960::                        @code{ld} and the Intel 960 family
  * ARM::				@code{ld} and the ARM family
+ @ifset TICOFF
+ * TI COFF::                     @code{ld} and TI COFF
+ @end ifset
  @end menu
  @end ifset
  
*************** The @samp{--thumb-entry} switch is a dup
*** 3965,3970 ****
--- 4005,4022 ----
  But it also sets the bottom bit of the address, so that it can be
  branched to using a BX instruction, and the program will start
  executing in Thumb mode straight away.
+ 
+ @ifset TICOFF
+ @node TI COFF
+ @section @code{ld}'s support for various TI COFF versions
+ @cindex TI COFF versions
+ @kindex --format=@var{version}
+ The @samp{--format} switch allows selection of one of the various
+ TI COFF versions.  The latest of this writing is 2; versions 0 and 1 are
+ also supported.  The TI COFF versions also vary in header byte-order
+ format; @code{ld} will read any version or byte order, but the output
+ header format depends on the default specified by the specific target.
+ @end ifset
  
  @ifclear GENERIC
  @lowersections
Index: ld/ldexp.c
===================================================================
RCS file: /cvs/binutils/binutils/ld/ldexp.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 ldexp.c
*** ldexp.c	1999/07/11 20:08:59	1.2
--- ldexp.c	2000/01/10 16:50:18
*************** fold_name (tree, current_section, alloca
*** 456,466 ****
        case SIZEOF:
  	if (allocation_done != lang_first_phase_enum)
  	  {
  	    lang_output_section_statement_type *os;
  
  	    os = lang_output_section_find (tree->name.name);
  	    check (os, tree->name.name, "SIZEOF");
! 	    result = new_abs (os->bfd_section->_raw_size);
  	  }
  	else
  	  result = invalid ();
--- 456,467 ----
        case SIZEOF:
  	if (allocation_done != lang_first_phase_enum)
  	  {
+             int opb = bfd_octets_per_byte (output_bfd);
  	    lang_output_section_statement_type *os;
  
  	    os = lang_output_section_find (tree->name.name);
  	    check (os, tree->name.name, "SIZEOF");
! 	    result = new_abs (os->bfd_section->_raw_size / opb);
  	  }
  	else
  	  result = invalid ();
*************** exp_fold_tree (tree, current_section, al
*** 525,530 ****
--- 526,535 ----
  	{
  	  switch (tree->type.node_code) 
  	    {
+             case BLOCK:
+               /* simply record the requested value for later processing */
+               current_section->block_value = result.value;
+               break;
  	    case ALIGN_K:
  	      if (allocation_done != lang_first_phase_enum)
  		result = new_rel_from_section (ALIGN_N (dot, result.value),
Index: ld/ldgram.y
===================================================================
RCS file: /cvs/binutils/binutils/ld/ldgram.y,v
retrieving revision 1.3
diff -c -3 -p -r1.3 ldgram.y
*** ldgram.y	2000/01/05 14:12:23	1.3
--- ldgram.y	2000/01/10 16:50:18
*************** Foundation, Inc., 59 Temple Place - Suit
*** 48,53 ****
--- 48,54 ----
  static enum section_type sectype;
  
  lang_memory_region_type *region;
+ int current_mempage = 0;
  
  struct wildcard_spec current_file;
  boolean ldgram_want_filename = true;
*************** static int error_index;
*** 92,97 ****
--- 93,100 ----
  %type <integer> fill_opt
  %type <name_list> exclude_name_list
  %type <name> memspec_opt casesymlist
+ %type <name> memspec_at_opt
+ %type <etree> align_opt block_opt
  %type <cname> wildcard_name
  %type <wildcard> wildcard_spec
  %token <integer> INT  
*************** static int error_index;
*** 131,136 ****
--- 134,140 ----
  %token <integer> NEXT
  %token SIZEOF ADDR LOADADDR MAX_K MIN_K
  %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
+ %token PAGE RUN
  %token ORIGIN FILL
  %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
  %token ALIGNMOD AT PROVIDE
*************** memory_spec_list:
*** 612,624 ****
  	|
  	;
  
! 
! memory_spec: 		NAME
! 			{ region = lang_memory_region_lookup($1); }
! 		attributes_opt ':'
! 		origin_spec opt_comma length_spec
  
! 	; origin_spec:
  	ORIGIN '=' mustbe_exp
  		{ region->current =
  		 region->origin =
--- 616,639 ----
  	|
  	;
  
! memory_spec:
!                 NAME {
!                   region = lang_memory_region_lookup($1);
!                   region->page = current_mempage;
!                 }
!                 attributes_opt ':' origin_spec opt_comma length_spec 
!         |       PAGE INT ':' NAME
!                 {
!                   current_mempage = $2;
!                   if (($2 & 0xFF) != $2)
!                     einfo (_("%P%F:%S: page number %d out of range\n"), $2);
!                   region = lang_memory_region_lookup($4);
!                   region->page = current_mempage;
!                 }
!                 attributes_opt ':' origin_spec opt_comma length_spec 
! 	;
  
! origin_spec:
  	ORIGIN '=' mustbe_exp
  		{ region->current =
  		 region->origin =
*************** exp	:
*** 799,804 ****
--- 814,834 ----
  	;
  
  
+ align_opt:
+                 /* empty */ { $$ = (etree_type *)NULL; }
+         |       ALIGN_K '(' exp ')' { $$ = exp_unop(ALIGN_K,$3); }
+         ;
+ 
+ block_opt:
+                 /* empty */ { $$ = (etree_type *)NULL; }
+         |       BLOCK '(' exp ')' { $$ = exp_unop(BLOCK,$3); }
+         ;
+ 
+ memspec_at_opt:
+                 AT '>' NAME { $$ = $3; }
+         |       { $$ = "*default*"; }
+         ;
+ 
  opt_at:
  		AT '(' exp ')' { $$ = $3; }
  	|	{ $$ = 0; }
*************** section:	NAME 		{ ldlex_expression(); }
*** 815,824 ****
  			}
  		statement_list_opt 	
   		'}' { ldlex_popstate (); ldlex_expression (); }
! 		memspec_opt phdr_opt fill_opt
  		{
  		  ldlex_popstate ();
! 		  lang_leave_output_section_statement ($13, $11, $12);
  		}
  		opt_comma
  	|	OVERLAY
--- 845,856 ----
  			}
  		statement_list_opt 	
   		'}' { ldlex_popstate (); ldlex_expression (); }
! 		memspec_opt memspec_at_opt phdr_opt fill_opt
!                 align_opt block_opt
  		{
  		  ldlex_popstate ();
! 		  lang_leave_output_section_statement ($14, $11, $13, $12,
!                                                        $15, $16);
  		}
  		opt_comma
  	|	OVERLAY
*************** section:	NAME 		{ ldlex_expression(); }
*** 832,841 ****
  		overlay_section
  		'}'
  			{ ldlex_popstate (); ldlex_expression (); }
! 		memspec_opt phdr_opt fill_opt
  			{
  			  ldlex_popstate ();
! 			  lang_leave_overlay ($14, $12, $13);
  			}
  		opt_comma
  	|	/* The GROUP case is just enough to support the gcc
--- 864,874 ----
  		overlay_section
  		'}'
  			{ ldlex_popstate (); ldlex_expression (); }
! 		memspec_opt memspec_at_opt phdr_opt fill_opt
!                 align_opt block_opt
  			{
  			  ldlex_popstate ();
! 			  lang_leave_overlay ($15, $12, $14, $13, $16, $17);
  			}
  		opt_comma
  	|	/* The GROUP case is just enough to support the gcc
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/binutils/binutils/ld/ldlang.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 ldlang.c
*** ldlang.c	2000/01/05 14:12:23	1.17
--- ldlang.c	2000/01/10 16:50:24
*************** lang_memory_region_lookup (name)
*** 618,623 ****
--- 618,624 ----
      new->length = ~(bfd_size_type)0;
      new->current = 0;
      new->had_full_message = false;
+     new->page = 0;
  
      return new;
    }
*************** lang_output_section_statement_lookup (na
*** 682,687 ****
--- 683,689 ----
        lookup = (lang_output_section_statement_type *)
  	new_stat (lang_output_section_statement, stat_ptr);
        lookup->region = (lang_memory_region_type *) NULL;
+       lookup->lma_region = (lang_memory_region_type *) NULL;
        lookup->fill = 0;
        lookup->block_value = 1;
        lookup->name = name;
*************** lang_map ()
*** 733,740 ****
    lang_memory_region_type *m;
  
    minfo (_("\nMemory Configuration\n\n"));
!   fprintf (config.map_file, "%-16s %-18s %-18s %s\n",
! 	   _("Name"), _("Origin"), _("Length"), _("Attributes"));
  
    for (m = lang_memory_region_list;
         m != (lang_memory_region_type *) NULL;
--- 735,742 ----
    lang_memory_region_type *m;
  
    minfo (_("\nMemory Configuration\n\n"));
!   fprintf (config.map_file, "%-16s %-18s %-18s %-6s %s\n",
! 	   _("Name"), _("Origin"), _("Length"), _("Page"), _("Attributes"));
  
    for (m = lang_memory_region_list;
         m != (lang_memory_region_type *) NULL;
*************** lang_map ()
*** 755,760 ****
--- 757,764 ----
  	}
  
        minfo ("0x%V", m->length);
+       sprintf (buf, "%12d", m->page);
+       minfo ("%s", buf);
        if (m->flags || m->not_flags)
  	{
  #ifndef BFD64
*************** wild_doit (ptr, section, output, file)
*** 1195,1200 ****
--- 1199,1211 ----
        /* If supplied an aligment, then force it.  */
        if (output->section_alignment != -1)
  	output->bfd_section->alignment_power = output->section_alignment;
+ 
+       if (section->flags & SEC_BLOCK)
+         {
+           section->output_section->flags |= SEC_BLOCK;
+           /* FIXME: This value should really be obtained from the bfd... */
+           output->block_value = 128;
+         }
      }
  }
  
*************** print_input_section (in)
*** 2168,2174 ****
  {
    asection *i = in->section;
    bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size;
! 
    if (size != 0)
      {
        print_space ();
--- 2179,2186 ----
  {
    asection *i = in->section;
    bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size;
!   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
!                                            ldfile_output_machine);
    if (size != 0)
      {
        print_space ();
*************** print_input_section (in)
*** 2192,2198 ****
  	    }
  
  	  minfo ("0x%V %W %B\n",
! 		 i->output_section->vma + i->output_offset, size,
  		 i->owner);
  
  	  if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
--- 2204,2210 ----
  	    }
  
  	  minfo ("0x%V %W %B\n",
! 		 i->output_section->vma + i->output_offset, size / opb,
  		 i->owner);
  
  	  if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
*************** print_input_section (in)
*** 2214,2220 ****
  
  	  bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
  
! 	  print_dot = i->output_section->vma + i->output_offset + size;
  	}
      }
  }
--- 2226,2232 ----
  
  	  bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
  
! 	  print_dot = i->output_section->vma + i->output_offset + size / opb;
  	}
      }
  }
*************** print_data_statement (data)
*** 2234,2239 ****
--- 2246,2253 ----
    bfd_vma addr;
    bfd_size_type size;
    const char *name;
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine);
  
    for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
      print_space ();
*************** print_data_statement (data)
*** 2278,2284 ****
  
    print_nl ();
  
!   print_dot = addr + size;
  }
  
  /* Print an address statement.  These are generated by options like
--- 2292,2299 ----
  
    print_nl ();
  
!   print_dot = addr + size / opb;
! 
  }
  
  /* Print an address statement.  These are generated by options like
*************** print_reloc_statement (reloc)
*** 2302,2307 ****
--- 2317,2324 ----
    int i;
    bfd_vma addr;
    bfd_size_type size;
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine); 
  
    for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
      print_space ();
*************** print_reloc_statement (reloc)
*** 2323,2329 ****
  
    print_nl ();
  
!   print_dot = addr + size;
  }  
  
  static void
--- 2340,2346 ----
  
    print_nl ();
  
!   print_dot = addr + size / opb;
  }  
  
  static void
*************** print_padding_statement (s)
*** 2332,2337 ****
--- 2349,2356 ----
  {
    int len;
    bfd_vma addr;
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine); 
  
    minfo (" *fill*");
  
*************** print_padding_statement (s)
*** 2352,2358 ****
  
    print_nl ();
  
!   print_dot = addr + s->size;
  }
  
  static void
--- 2371,2377 ----
  
    print_nl ();
  
!   print_dot = addr + s->size / opb;
  }
  
  static void
*************** insert_pad (this_ptr, fill, power, outpu
*** 2547,2552 ****
--- 2566,2573 ----
       inserting a magic 'padding' statement.
       */
  
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine); 
    unsigned int alignment_needed = align_power (dot, power) - dot;
  
    if (alignment_needed != 0)
*************** insert_pad (this_ptr, fill, power, outpu
*** 2563,2569 ****
        new->padding_statement.output_offset =
  	dot - output_section_statement->vma;
        new->padding_statement.fill = fill;
!       new->padding_statement.size = alignment_needed;
      }
  
  
--- 2584,2590 ----
        new->padding_statement.output_offset =
  	dot - output_section_statement->vma;
        new->padding_statement.fill = fill;
!       new->padding_statement.size = alignment_needed * opb;
      }
  
  
*************** insert_pad (this_ptr, fill, power, outpu
*** 2572,2580 ****
      {
        output_section_statement->alignment_power = power;
      }
!   output_section_statement->_raw_size += alignment_needed;
!   return alignment_needed + dot;
  
  }
  
  /* Work out how much this section will move the dot point */
--- 2593,2601 ----
      {
        output_section_statement->alignment_power = power;
      }
!   output_section_statement->_raw_size += alignment_needed * opb;
  
+   return dot + alignment_needed;
  }
  
  /* Work out how much this section will move the dot point */
*************** size_input_section (this_ptr, output_sec
*** 2588,2593 ****
--- 2609,2616 ----
  {
    lang_input_section_type *is = &((*this_ptr)->input_section);
    asection *i = is->section;
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine); 
  
    if (is->ifile->just_syms_flag == false)
      {
*************** size_input_section (this_ptr, output_sec
*** 2605,2614 ****
        /* Mark how big the output section must be to contain this now
  	 */
        if (i->_cooked_size != 0)
! 	dot += i->_cooked_size;
        else
! 	dot += i->_raw_size;
!       output_section_statement->bfd_section->_raw_size = dot - output_section_statement->bfd_section->vma;
      }
    else
      {
--- 2628,2638 ----
        /* Mark how big the output section must be to contain this now
  	 */
        if (i->_cooked_size != 0)
! 	dot += i->_cooked_size / opb;
        else
! 	dot += i->_raw_size / opb;
!       output_section_statement->bfd_section->_raw_size = 
!         (dot - output_section_statement->bfd_section->vma) * opb;
      }
    else
      {
*************** static void
*** 2629,2634 ****
--- 2653,2659 ----
  lang_check_section_addresses ()
  {
    asection * s;
+   int opb = bfd_octets_per_byte (output_bfd);
  
    /* Scan all sections in the output list.  */
    for (s = output_bfd->sections; s != NULL; s = s->next)
*************** lang_check_section_addresses ()
*** 2648,2653 ****
--- 2673,2680 ----
  	  bfd_vma s_end;
  	  bfd_vma os_start;
  	  bfd_vma os_end;
+ 	  int s_page;
+ 	  int os_page;
  	  
  	  /* Only consider loadable sections with real contents.  */
  	  if (IGNORE_SECTION (output_bfd, os))
*************** lang_check_section_addresses ()
*** 2658,2668 ****
  	     overlapping VMAs but they must have distinct LMAs.  */
  	  s_start  = bfd_section_lma (output_bfd, s);
  	  os_start = bfd_section_lma (output_bfd, os);
! 	  s_end    = s_start  + bfd_section_size (output_bfd, s) - 1;
! 	  os_end   = os_start + bfd_section_size (output_bfd, os) - 1;
  	  
  	  /* Look for an overlap.  */
! 	  if ((s_end < os_start) || (s_start > os_end))
  	    continue;
  	  
  	  einfo (
--- 2685,2697 ----
  	     overlapping VMAs but they must have distinct LMAs.  */
  	  s_start  = bfd_section_lma (output_bfd, s);
  	  os_start = bfd_section_lma (output_bfd, os);
! 	  s_end    = s_start  + bfd_section_size (output_bfd, s) / opb - 1;
! 	  os_end   = os_start + bfd_section_size (output_bfd, os) / opb - 1;
! 	  s_page   = bfd_get_section_load_page (output_bfd, s);
! 	  os_page  = bfd_get_section_load_page (output_bfd, os);
  	  
  	  /* Look for an overlap.  */
! 	  if ((s_page != os_page) || (s_end < os_start) || (s_start > os_end))
  	    continue;
  	  
  	  einfo (
*************** _("%X%P: section %s [%V -> %V] overlaps 
*** 2681,2686 ****
--- 2710,2746 ----
  
  static boolean relax_again;
  
+ static void
+ os_region_check (os, region, tree)
+   lang_output_section_statement_type *os;
+   struct memory_region_struct *region;
+   etree_type *tree;
+ {
+   if (os->region->current < os->region->origin
+       || (os->region->current - os->region->origin
+           > os->region->length))
+     {
+       if (tree != (etree_type *) NULL)
+         {
+           einfo (_("%X%P: address 0x%v of %B section %s is not within "
+                    "region %s\n"),
+                  os->region->current,
+                  os->bfd_section->owner,
+                  os->bfd_section->name,
+                  os->region->name);
+         }
+       else
+         {
+           einfo (_("%X%P: region %s is full (%B section %s)\n"),
+                  os->region->name,
+                  os->bfd_section->owner,
+                  os->bfd_section->name);
+         }
+       /* Reset the region pointer.  */
+       os->region->current = os->region->origin;
+     }
+ }
+ 
  /* Set the sizes for all the output sections.  */
  
  bfd_vma
*************** lang_size_sections (s, output_section_st
*** 2692,2697 ****
--- 2752,2760 ----
       bfd_vma dot;
       boolean relax;
  {
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine);
+ 
    /* Size up the sections from their constituent parts.  */
    for (; s != (lang_statement_union_type *) NULL; s = s->next)
      {
*************** lang_size_sections (s, output_section_st
*** 2805,2823 ****
  	    (void) lang_size_sections (os->children.head, os, &os->children.head,
  				       os->fill, dot, relax);
  	    
! 	    /* Ignore the size of the input sections, use the vma and size to
! 	       align against.  */
! 
! 	    after = ALIGN_N (os->bfd_section->vma +
! 			     os->bfd_section->_raw_size,
  			     /* The coercion here is important, see ld.h.  */
  			     (bfd_vma) os->block_value);
  
  	    if (bfd_is_abs_section (os->bfd_section))
  	      ASSERT (after == os->bfd_section->vma);
  	    else
! 	      os->bfd_section->_raw_size = after - os->bfd_section->vma;
! 	    dot = os->bfd_section->vma + os->bfd_section->_raw_size;
  	    os->processed = true;
  
  	    /* Update dot in the region ?
--- 2868,2898 ----
  	    (void) lang_size_sections (os->children.head, os, &os->children.head,
  				       os->fill, dot, relax);
  	    
!             /* This used to be ALIGN_N, and os->block_value was always
!                set to one, which resolved to a no-op.  I've changed this to do
!                blocking instead. */ 
!             /* put the section within the requested block size, or align at
!                the block boundary */
! 	    after = BLOCK_N (os->bfd_section->vma,
! 			     os->bfd_section->_raw_size / opb,
  			     /* The coercion here is important, see ld.h.  */
  			     (bfd_vma) os->block_value);
  
  	    if (bfd_is_abs_section (os->bfd_section))
  	      ASSERT (after == os->bfd_section->vma);
  	    else
!               {
!                 if (after != os->bfd_section->vma 
!                     && config.warn_section_align)
!                   einfo (_("%P: warning: blocking changed start of section %s "
!                            "by %u bytes\n"), os->name, 
!                            (unsigned) (after - os->bfd_section->vma));
!                   
!                 bfd_set_section_vma (0, os->bfd_section, after);
!               }
! 
! 	    dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
! 
  	    os->processed = true;
  
  	    /* Update dot in the region ?
*************** lang_size_sections (s, output_section_st
*** 2830,2866 ****
  	      {
  		os->region->current = dot;
  		
! 		/* Make sure the new address is within the region.  We
!                    explicitly permit the current address to be at the
!                    exact end of the region when the VMA is non-zero,
!                    in case the region is at the end of addressable
!                    memory and the calculation wraps around.  */
! 		if ((os->region->current < os->region->origin
! 		     || (os->region->current - os->region->origin
! 			 > os->region->length))
! 		    && ((os->region->current
! 			 != os->region->origin + os->region->length)
! 			|| os->bfd_section->vma == 0))
  
! 		  {
! 		    if (os->addr_tree != (etree_type *) NULL)
! 		      {
! 			einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"),
! 			       os->region->current,
! 			       os->bfd_section->owner,
! 			       os->bfd_section->name,
! 			       os->region->name);
! 		      }
! 		    else
! 		      {
! 			einfo (_("%X%P: region %s is full (%B section %s)\n"),
! 			       os->region->name,
! 			       os->bfd_section->owner,
! 			       os->bfd_section->name);
! 		      }
! 		    /* Reset the region pointer.  */
! 		    os->region->current = os->region->origin;
! 		  }
  	      }
  	  }
  	  break;
--- 2905,2939 ----
  	      {
  		os->region->current = dot;
  		
! 		/* Make sure this isn't silly.  */
!                 os_region_check (os, os->region, os->addr_tree);
  
!                 /* if there's no load address specified, use the run region as
!                    the load region */
!                 if (os->lma_region == NULL && os->load_base == NULL)
!                     os->lma_region = os->region;
! 
!                 if (os->lma_region != NULL)
!                   {
!                     if (os->load_base != NULL)
!                       {
!                         einfo (_("%X%P: use an absolute load address "
!                                  "or a load memory region, not both\n"));
!                       }
!                     else
!                       {
!                         /* don't allocate twice */
!                         if (os->lma_region != os->region)
!                           {
!                             /* set load_base, which will be handled later */
!                             os->load_base = exp_intop (os->lma_region->current);
!                             os->lma_region->current += 
!                               os->bfd_section->_raw_size / opb;
!                             os_region_check (os, os->lma_region, NULL);
!                           }
!                         os->bfd_section->load_page = os->lma_region->page;
!                       }
!                   }
  	      }
  	  }
  	  break;
*************** lang_size_sections (s, output_section_st
*** 2898,2904 ****
  		break;
  	      }
  
! 	    dot += size;
  	    output_section_statement->bfd_section->_raw_size += size;
  	    /* The output section gets contents, and then we inspect for
  	       any flags set in the input script which override any ALLOC.  */
--- 2971,2977 ----
  		break;
  	      }
  
! 	    dot += size / opb;
  	    output_section_statement->bfd_section->_raw_size += size;
  	    /* The output section gets contents, and then we inspect for
  	       any flags set in the input script which override any ALLOC.  */
*************** lang_size_sections (s, output_section_st
*** 2918,2924 ****
  	    s->reloc_statement.output_section =
  	      output_section_statement->bfd_section;
  	    size = bfd_get_reloc_size (s->reloc_statement.howto);
! 	    dot += size;
  	    output_section_statement->bfd_section->_raw_size += size;
  	  }
  	  break;
--- 2991,2997 ----
  	    s->reloc_statement.output_section =
  	      output_section_statement->bfd_section;
  	    size = bfd_get_reloc_size (s->reloc_statement.howto);
! 	    dot += size / opb;
  	    output_section_statement->bfd_section->_raw_size += size;
  	  }
  	  break;
*************** lang_size_sections (s, output_section_st
*** 3006,3012 ****
  		    new->padding_statement.output_offset =
  		      dot - output_section_statement->bfd_section->vma;
  		    new->padding_statement.fill = fill;
! 		    new->padding_statement.size = newdot - dot;
  		    output_section_statement->bfd_section->_raw_size +=
  		      new->padding_statement.size;
  		  }
--- 3079,3085 ----
  		    new->padding_statement.output_offset =
  		      dot - output_section_statement->bfd_section->vma;
  		    new->padding_statement.fill = fill;
! 		    new->padding_statement.size = (newdot - dot) * opb;
  		    output_section_statement->bfd_section->_raw_size +=
  		      new->padding_statement.size;
  		  }
*************** lang_size_sections (s, output_section_st
*** 3024,3030 ****
  	     pass than it did at this point in the previous pass.  */
  	  s->padding_statement.output_offset =
  	    dot - output_section_statement->bfd_section->vma;
! 	  dot += s->padding_statement.size;
  	  output_section_statement->bfd_section->_raw_size +=
  	    s->padding_statement.size;
  	  break;
--- 3097,3103 ----
  	     pass than it did at this point in the previous pass.  */
  	  s->padding_statement.output_offset =
  	    dot - output_section_statement->bfd_section->vma;
! 	  dot += s->padding_statement.size / opb;
  	  output_section_statement->bfd_section->_raw_size +=
  	    s->padding_statement.size;
  	  break;
*************** lang_do_assignments (s, output_section_s
*** 3057,3062 ****
--- 3130,3138 ----
       fill_type fill;
       bfd_vma dot;
  {
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine); 
+ 
    for (; s != (lang_statement_union_type *) NULL; s = s->next)
      {
        switch (s->header.type)
*************** lang_do_assignments (s, output_section_s
*** 3078,3084 ****
  		dot = os->bfd_section->vma;
  		(void) lang_do_assignments (os->children.head, os,
  					    os->fill, dot);
! 		dot = os->bfd_section->vma + os->bfd_section->_raw_size;
  	      }
  	    if (os->load_base) 
  	      {
--- 3154,3161 ----
  		dot = os->bfd_section->vma;
  		(void) lang_do_assignments (os->children.head, os,
  					    os->fill, dot);
! 		dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
! 
  	      }
  	    if (os->load_base) 
  	      {
*************** lang_do_assignments (s, output_section_s
*** 3087,3093 ****
  		if (os->bfd_section) 
  		  {
  		    os->bfd_section->lma 
! 		      = exp_get_abs_int(os->load_base, 0,"load base", lang_final_phase_enum);
  		  }
  	      }
  	  }
--- 3164,3176 ----
  		if (os->bfd_section) 
  		  {
  		    os->bfd_section->lma 
! 		      = exp_get_abs_int(os->load_base, 0,"load base", 
!                                         lang_final_phase_enum);
!                     if (os->lma_region)
!                       os->bfd_section->load_page = os->lma_region->page;
!                     /* unspecified pages always default to zero */
!                     else if (os->bfd_section->flags & SEC_LOAD)
!                       os->bfd_section->load_page = 0;
  		  }
  	      }
  	  }
*************** lang_do_assignments (s, output_section_s
*** 3118,3139 ****
  	    if (value.valid_p == false)
  	      einfo (_("%F%P: invalid data statement\n"));
  	  }
! 	  switch (s->data_statement.type)
! 	    {
! 	    case QUAD:
! 	    case SQUAD:
! 	      dot += QUAD_SIZE;
! 	      break;
! 	    case LONG:
! 	      dot += LONG_SIZE;
! 	      break;
! 	    case SHORT:
! 	      dot += SHORT_SIZE;
! 	      break;
! 	    case BYTE:
! 	      dot += BYTE_SIZE;
! 	      break;
! 	    }
  	  break;
  
  	case lang_reloc_statement_enum:
--- 3201,3226 ----
  	    if (value.valid_p == false)
  	      einfo (_("%F%P: invalid data statement\n"));
  	  }
!           {
!             int size;
!             switch (s->data_statement.type)
!               {
!               case QUAD:
!               case SQUAD:
!                 size = QUAD_SIZE;
!                 break;
!               case LONG:
!                 size = LONG_SIZE;
!                 break;
!               case SHORT:
!                 size = SHORT_SIZE;
!                 break;
!               case BYTE:
!                 size = BYTE_SIZE;
!                 break;
!               }
!             dot += size / opb;
!           }
  	  break;
  
  	case lang_reloc_statement_enum:
*************** lang_do_assignments (s, output_section_s
*** 3147,3153 ****
  	    if (value.valid_p == false)
  	      einfo (_("%F%P: invalid reloc statement\n"));
  	  }
! 	  dot += bfd_get_reloc_size (s->reloc_statement.howto);
  	  break;
  
  	case lang_input_section_enum:
--- 3234,3240 ----
  	    if (value.valid_p == false)
  	      einfo (_("%F%P: invalid reloc statement\n"));
  	  }
! 	  dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb;
  	  break;
  
  	case lang_input_section_enum:
*************** lang_do_assignments (s, output_section_s
*** 3155,3163 ****
  	    asection *in = s->input_section.section;
  
  	    if (in->_cooked_size != 0)
! 	      dot += in->_cooked_size;
  	    else
! 	      dot += in->_raw_size;
  	  }
  	  break;
  
--- 3242,3250 ----
  	    asection *in = s->input_section.section;
  
  	    if (in->_cooked_size != 0)
! 	      dot += in->_cooked_size / opb;
  	    else
! 	      dot += in->_raw_size / opb;
  	  }
  	  break;
  
*************** lang_do_assignments (s, output_section_s
*** 3177,3183 ****
  
  	  break;
  	case lang_padding_statement_enum:
! 	  dot += s->padding_statement.size;
  	  break;
  
  	case lang_group_statement_enum:
--- 3264,3270 ----
  
  	  break;
  	case lang_padding_statement_enum:
! 	  dot += s->padding_statement.size / opb;
  	  break;
  
  	case lang_group_statement_enum:
*************** lang_set_startof ()
*** 3235,3245 ****
        h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
        if (h != NULL && h->type == bfd_link_hash_undefined)
  	{
  	  h->type = bfd_link_hash_defined;
  	  if (s->_cooked_size != 0)
! 	    h->u.def.value = s->_cooked_size;
  	  else
! 	    h->u.def.value = s->_raw_size;
  	  h->u.def.section = bfd_abs_section_ptr;
  	}
  
--- 3322,3334 ----
        h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
        if (h != NULL && h->type == bfd_link_hash_undefined)
  	{
+           int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                                    ldfile_output_machine); 
  	  h->type = bfd_link_hash_defined;
  	  if (s->_cooked_size != 0)
! 	    h->u.def.value = s->_cooked_size / opb;
  	  else
! 	    h->u.def.value = s->_raw_size / opb;
  	  h->u.def.section = bfd_abs_section_ptr;
  	}
  
*************** lang_one_common (h, info)
*** 3416,3421 ****
--- 3505,3512 ----
    unsigned int power_of_two;
    bfd_vma size;
    asection *section;
+   int opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, 
+                                            ldfile_output_machine); 
  
    if (h->type != bfd_link_hash_common)
      return true;
*************** lang_one_common (h, info)
*** 3430,3437 ****
    section = h->u.c.p->section;
  
    /* Increase the size of the section.  */
!   section->_cooked_size = ALIGN_N (section->_cooked_size,
! 				   (bfd_size_type) (1 << power_of_two));
  
    /* Adjust the alignment if necessary.  */
    if (power_of_two > section->alignment_power)
--- 3521,3528 ----
    section = h->u.c.p->section;
  
    /* Increase the size of the section.  */
!   section->_cooked_size = ALIGN_N ((section->_cooked_size + opb - 1) / opb,
! 				   (bfd_size_type) (1 << power_of_two)) * opb;
  
    /* Adjust the alignment if necessary.  */
    if (power_of_two > section->alignment_power)
*************** lang_float (maybe)
*** 4217,4231 ****
  }
  
  void
! lang_leave_output_section_statement (fill, memspec, phdrs)
       bfd_vma fill;
       const char *memspec;
       struct lang_output_section_phdr_list *phdrs;
  {
    current_section->fill = fill;
    current_section->region = lang_memory_region_lookup (memspec);
    current_section->phdrs = phdrs;
    stat_ptr = &statement_list;
  }
  
  /*
--- 4308,4354 ----
  }
  
  void
! lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec, 
!                                      align, block)
       bfd_vma fill;
       const char *memspec;
       struct lang_output_section_phdr_list *phdrs;
+      const char *lma_memspec;
+      etree_type *align;
+      etree_type *block;
  {
    current_section->fill = fill;
    current_section->region = lang_memory_region_lookup (memspec);
+   if (strcmp (lma_memspec, "*default*") != 0)
+     {
+       current_section->lma_region = lang_memory_region_lookup (lma_memspec);
+       /* if no runtime region has been given, but the load region has been,
+          use the load region */
+       if (strcmp (memspec, "*default*") == 0)
+         current_section->region = lang_memory_region_lookup (lma_memspec);
+     }
    current_section->phdrs = phdrs;
    stat_ptr = &statement_list;
+   if (align != NULL)
+     {
+       etree_value_type r;
+       bfd_vma dummy_dot = 0;
+       r = exp_fold_tree (align, abs_output_section,
+                          lang_allocating_phase_enum, dummy_dot, &dummy_dot);
+       if (r.valid_p == false)
+         einfo (_("%F%S: invalid expression for ALIGN\n"));
+       current_section->section_alignment = r.value;
+     }
+   if (block != NULL)
+     {
+       etree_value_type r;
+       bfd_vma dummy_dot = 0;
+       r = exp_fold_tree (block, abs_output_section,
+                          lang_allocating_phase_enum, dummy_dot, &dummy_dot);
+       if (r.valid_p == false)
+         einfo (_("%F%S: invalid expression for BLOCK\n"));
+       current_section->block_value = r.value;
+     }
  }
  
  /*
*************** lang_abs_symbol_at_end_of (secname, name
*** 4291,4297 ****
  	h->u.def.value = 0;
        else
  	h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
! 			  + bfd_section_size (output_bfd, sec));
  
        h->u.def.section = bfd_abs_section_ptr;
      }
--- 4414,4421 ----
  	h->u.def.value = 0;
        else
  	h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
! 			  + bfd_section_size (output_bfd, sec) /
!                           bfd_octets_per_byte (output_bfd));
  
        h->u.def.section = bfd_abs_section_ptr;
      }
*************** lang_leave_overlay_section (fill, phdrs)
*** 4601,4607 ****
  
    name = current_section->name;
  
!   lang_leave_output_section_statement (fill, "*default*", phdrs);
  
    /* Define the magic symbols.  */
  
--- 4725,4733 ----
  
    name = current_section->name;
  
!   lang_leave_output_section_statement (fill, "*default*", 
!                                        phdrs, "*default*", 
!                                        (etree_type *)NULL, (etree_type *)NULL);
  
    /* Define the magic symbols.  */
  
*************** lang_leave_overlay_section (fill, phdrs)
*** 4631,4650 ****
     looks through all the sections in the overlay and sets them.  */
  
  void
! lang_leave_overlay (fill, memspec, phdrs)
       bfd_vma fill;
       const char *memspec;
       struct lang_output_section_phdr_list *phdrs;
  {
    lang_memory_region_type *region;
    struct overlay_list *l;
    struct lang_nocrossref *nocrossref;
  
    if (memspec == NULL)
      region = NULL;
    else
      region = lang_memory_region_lookup (memspec);
  
    nocrossref = NULL;
  
    l = overlay_list;
--- 4757,4808 ----
     looks through all the sections in the overlay and sets them.  */
  
  void
! lang_leave_overlay (fill, memspec, phdrs, lma_memspec, align, block)
       bfd_vma fill;
       const char *memspec;
       struct lang_output_section_phdr_list *phdrs;
+      const char *lma_memspec;
+      etree_type *align;
+      etree_type *block;
  {
    lang_memory_region_type *region;
+   lang_memory_region_type *lma_region;
    struct overlay_list *l;
    struct lang_nocrossref *nocrossref;
+   int align_value = -1;
+   int block_value = 1;
  
    if (memspec == NULL)
      region = NULL;
    else
      region = lang_memory_region_lookup (memspec);
  
+   if (lma_memspec == NULL)
+     lma_region = NULL;
+   else
+     lma_region = lang_memory_region_lookup (lma_memspec);
+ 
+   if (align != NULL)
+     {
+       etree_value_type r;
+       bfd_vma dummy_dot = 0;
+       r = exp_fold_tree (align, abs_output_section,
+                          lang_allocating_phase_enum, dummy_dot, &dummy_dot);
+       if (r.valid_p == false)
+         einfo (_("%F%S: invalid expression for ALIGN\n"));
+       align_value = r.value;
+     }
+   if (block != NULL)
+     {
+       etree_value_type r;
+       bfd_vma dummy_dot = 0;
+       r = exp_fold_tree (block, abs_output_section,
+                          lang_allocating_phase_enum, dummy_dot, &dummy_dot);
+       if (r.valid_p == false)
+         einfo (_("%F%S: invalid expression for BLOCK\n"));
+       block_value = r.value;
+     }
+ 
    nocrossref = NULL;
  
    l = overlay_list;
*************** lang_leave_overlay (fill, memspec, phdrs
*** 4656,4663 ****
--- 4814,4826 ----
  	l->os->fill = fill;
        if (region != NULL && l->os->region == NULL)
  	l->os->region = region;
+       if (lma_region != NULL && l->os->lma_region == NULL)
+         l->os->lma_region = lma_region;
        if (phdrs != NULL && l->os->phdrs == NULL)
  	l->os->phdrs = phdrs;
+       if (align_value != -1)
+         l->os->section_alignment = align_value;
+       l->os->block_value = block_value;
  
        if (overlay_nocrossrefs)
  	{
Index: ld/ldlang.h
===================================================================
RCS file: /cvs/binutils/binutils/ld/ldlang.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 ldlang.h
*** ldlang.h	2000/01/05 14:12:23	1.3
--- ldlang.h	2000/01/10 16:50:25
*************** typedef struct memory_region_struct
*** 51,56 ****
--- 51,57 ----
    flagword flags;
    flagword not_flags;
    boolean had_full_message;
+   int page;
  } lang_memory_region_type ;
  
  typedef struct lang_statement_header_struct 
*************** typedef struct lang_output_section_state
*** 136,141 ****
--- 137,143 ----
    flagword flags;		/* Or together of all input sections */
    enum section_type sectype;
    struct memory_region_struct *region;
+   struct memory_region_struct *lma_region;
    size_t block_value;
    fill_type fill;
  
*************** extern void lang_add_attribute PARAMS ((
*** 409,415 ****
  extern void lang_startup PARAMS ((const char *));
  extern void lang_float PARAMS ((enum bfd_boolean));
  extern void lang_leave_output_section_statement
!   PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *));
  extern void lang_abs_symbol_at_end_of PARAMS ((const char *, const char *));
  extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *,
  						     const char *));
--- 411,418 ----
  extern void lang_startup PARAMS ((const char *));
  extern void lang_float PARAMS ((enum bfd_boolean));
  extern void lang_leave_output_section_statement
!   PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *,
!            const char *, etree_type *, etree_type *));
  extern void lang_abs_symbol_at_end_of PARAMS ((const char *, const char *));
  extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *,
  						     const char *));
*************** extern void lang_enter_overlay_section P
*** 475,481 ****
  extern void lang_leave_overlay_section
    PARAMS ((bfd_vma, struct lang_output_section_phdr_list *));
  extern void lang_leave_overlay
!   PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *));
  
  extern struct bfd_elf_version_tree *lang_elf_version_info;
  
--- 478,485 ----
  extern void lang_leave_overlay_section
    PARAMS ((bfd_vma, struct lang_output_section_phdr_list *));
  extern void lang_leave_overlay
!   PARAMS ((bfd_vma, const char *, struct lang_output_section_phdr_list *,
!            const char *, etree_type *, etree_type *));
  
  extern struct bfd_elf_version_tree *lang_elf_version_info;
  
Index: ld/lexsup.c
===================================================================
RCS file: /cvs/binutils/binutils/ld/lexsup.c,v
retrieving revision 1.7
diff -c -3 -p -r1.7 lexsup.c
*** lexsup.c	1999/09/12 16:40:09	1.7
--- lexsup.c	2000/01/10 16:50:27
*************** int parsing_defsym = 0;
*** 123,128 ****
--- 123,129 ----
  #define OPTION_NO_UNDEFINED		(OPTION_MPC860C0 + 1)
  #define OPTION_INIT                     (OPTION_NO_UNDEFINED + 1)
  #define OPTION_FINI                     (OPTION_INIT + 1)
+ #define OPTION_STDERR_TO_FILE           (OPTION_FINI + 1)
  
  /* The long options.  This structure is used for both the option
     parsing and the help text.  */
*************** static const struct ld_option ld_options
*** 273,278 ****
--- 274,281 ----
        '\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES },
    { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
        '\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
+   { {"errors-to-file", required_argument, NULL, OPTION_STDERR_TO_FILE},
+       '\0', N_("FILE"), N_("Save errors to FILE instead of printing to stderr"), TWO_DASHES },
    { {"fini", required_argument, NULL, OPTION_FINI},
       '\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH },
    { {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX},
*************** parse_args (argc, argv)
*** 797,802 ****
--- 800,825 ----
  	      command_line.rpath_link = buf;
  	    }
  	  break;
+         case OPTION_STDERR_TO_FILE:
+           {
+             FILE *fp = fopen (optarg, "w+");
+             if (fp == NULL)
+               {
+                 fprintf (stderr,
+                          _("Can't redirect stderr to the file '%s'\n"),
+                          optarg);
+                 xexit (1);
+               }
+             fclose (fp);
+             if ((fp = freopen (optarg, "w+", stderr)) == NULL)
+               {
+                 fprintf (stderr,
+                          _("Can't redirect stderr to the file '%s'\n"),
+                          optarg);
+                 xexit (1);
+               }
+             break;
+           }
  	case OPTION_RELAX:
  	  command_line.relax = true;
  	  break;
Index: ld/mri.c
===================================================================
RCS file: /cvs/binutils/binutils/ld/mri.c,v
retrieving revision 1.1.1.1
diff -c -3 -p -r1.1.1.1 mri.c
*** mri.c	1999/05/03 07:29:07	1.1.1.1
--- mri.c	2000/01/10 16:50:27
*************** mri_draw_tree ()
*** 266,272 ****
        }
  
        lang_leave_output_section_statement
! 	(0, "*default*", (struct lang_output_section_phdr_list *) NULL);
  
        p = p->next;
      }
--- 266,273 ----
        }
  
        lang_leave_output_section_statement
! 	(0, "*default*", (struct lang_output_section_phdr_list *) NULL, 
!          "*default*", (etree_type *)NULL, (etree_type *)NULL);
  
        p = p->next;
      }
Index: ld/emultempl/armelf.em
===================================================================
RCS file: /cvs/binutils/binutils/ld/emultempl/armelf.em,v
retrieving revision 1.11
diff -c -3 -p -r1.11 armelf.em
*** armelf.em	1999/10/27 18:13:28	1.11
--- armelf.em	2000/01/10 16:50:28
*************** gld${EMULATION_NAME}_place_orphan (file,
*** 942,948 ****
    wild_doit (&os->children, s, os, file);
  
    lang_leave_output_section_statement
!     ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL);
    stat_ptr = &add;
  
    if (*ps == '\0' && config.build_constructors)
--- 942,949 ----
    wild_doit (&os->children, s, os, file);
  
    lang_leave_output_section_statement
!     ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL,
!      "*default*", (etree_type *)NULL, (etree_type *)NULL);
    stat_ptr = &add;
  
    if (*ps == '\0' && config.build_constructors)
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/binutils/binutils/ld/emultempl/elf32.em,v
retrieving revision 1.10
diff -c -3 -p -r1.10 elf32.em
*** elf32.em	1999/11/04 06:45:07	1.10
--- elf32.em	2000/01/10 16:50:29
*************** gld${EMULATION_NAME}_place_orphan (file,
*** 1024,1030 ****
    wild_doit (&os->children, s, os, file);
  
    lang_leave_output_section_statement
!     ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL);
    stat_ptr = &add;
  
    if (*ps == '\0' && config.build_constructors)
--- 1024,1031 ----
    wild_doit (&os->children, s, os, file);
  
    lang_leave_output_section_statement
!     ((bfd_vma) 0, "*default*", (struct lang_output_section_phdr_list *) NULL,
!      "*default*", (etree_type *)NULL, (etree_type *)NULL);
    stat_ptr = &add;
  
    if (*ps == '\0' && config.build_constructors)
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/binutils/binutils/ld/emultempl/pe.em,v
retrieving revision 1.17
diff -c -3 -p -r1.17 pe.em
*** pe.em	2000/01/04 23:48:31	1.17
--- pe.em	2000/01/10 16:50:34
*************** gld_${EMULATION_NAME}_place_orphan (file
*** 1146,1152 ****
  
        lang_leave_output_section_statement
  	((bfd_vma) 0, "*default*",
! 	 (struct lang_output_section_phdr_list *) NULL);
  
        /* Now stick the new statement list right after PLACE.  */
        if (place != NULL)
--- 1146,1153 ----
  
        lang_leave_output_section_statement
  	((bfd_vma) 0, "*default*",
! 	 (struct lang_output_section_phdr_list *) NULL,
! 	"*default*", (etree_type *)NULL, (etree_type *)NULL);
  
        /* Now stick the new statement list right after PLACE.  */
        if (place != NULL)
Index: ld/testsuite/ld-scripts/script.exp
===================================================================
RCS file: /cvs/binutils/binutils/ld/testsuite/ld-scripts/script.exp,v
retrieving revision 1.2
diff -c -3 -p -r1.2 script.exp
*** script.exp	1999/09/12 15:59:48	1.2
--- script.exp	2000/01/10 16:50:35
*************** proc check_script { } {
*** 24,34 ****
  	    verbose "bad output from nm"
  	    fail $testname
  	} else {
  	    if {$nm_output(text_start) != 0x100} {
  		send_log "text_start == $nm_output(text_start)\n"
  		verbose "text_start == $nm_output(text_start)"
  		fail $testname
! 	    } else { if {$nm_output(text_end) < 0x104 \
  			  || $nm_output(text_end) > 0x110} {
  		send_log "text_end == $nm_output(text_end)\n"
  		verbose "text_end == $nm_output(text_end)"
--- 24,40 ----
  	    verbose "bad output from nm"
  	    fail $testname
  	} else {
+ 	    set text_end 0x104
+ 	    set data_end 0x1004
+ 	    if [istarget *c54x*-*-*] then {
+ 		set text_end 0x102
+ 		set data_end 0x1002
+ 	    }
  	    if {$nm_output(text_start) != 0x100} {
  		send_log "text_start == $nm_output(text_start)\n"
  		verbose "text_start == $nm_output(text_start)"
  		fail $testname
! 	    } else { if {$nm_output(text_end) < $text_end \
  			  || $nm_output(text_end) > 0x110} {
  		send_log "text_end == $nm_output(text_end)\n"
  		verbose "text_end == $nm_output(text_end)"
*************** proc check_script { } {
*** 37,43 ****
  		send_log "data_start == $nm_output(data_start)\n"
  		verbose "data_start == $nm_output(data_start)"
  		fail $testname
! 	    } else { if {$nm_output(data_end) < 0x1004 \
  			 || $nm_output(data_end) > 0x1010} {
  		send_log "data_end == $nm_output(data_end)\n"
  		verbose "data_end == $nm_output(data_end)"
--- 43,49 ----
  		send_log "data_start == $nm_output(data_start)\n"
  		verbose "data_start == $nm_output(data_start)"
  		fail $testname
! 	    } else { if {$nm_output(data_end) < $data_end \
  			 || $nm_output(data_end) > 0x1010} {
  		send_log "data_end == $nm_output(data_end)\n"
  		verbose "data_end == $nm_output(data_end)"
Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/binutils/binutils/opcodes/Makefile.am,v
retrieving revision 1.5
diff -c -3 -p -r1.5 Makefile.am
*** Makefile.am	1999/09/04 17:14:37	1.5
--- Makefile.am	2000/01/10 16:50:43
*************** CFILES = \
*** 78,83 ****
--- 78,85 ----
  	sparc-dis.c \
  	sparc-opc.c \
  	tic30-dis.c \
+ 	tic54x-dis.c \
+ 	tic54x-opc.c \
  	tic80-dis.c \
  	tic80-opc.c \
  	v850-dis.c \
*************** ALL_MACHINES = \
*** 137,142 ****
--- 139,146 ----
  	sparc-dis.lo \
  	sparc-opc.lo \
  	tic30-dis.lo \
+ 	tic54x-dis.lo \
+ 	tic54x-opc.lo \
  	tic80-dis.lo \
  	tic80-opc.lo \
  	v850-dis.lo \
*************** sparc-dis.lo: sparc-dis.c $(INCDIR)/ansi
*** 353,358 ****
--- 357,365 ----
  sparc-opc.lo: sparc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/sparc.h
  tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/dis-asm.h \
    $(BFD_H) $(INCDIR)/opcode/tic30.h
+ tic54x-dis.lo: tic54x-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h \
+   $(INCDIR)/dis-asm.h $(BFD_H)
+ tic54x-opc.lo: tic54x-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h
  tic80-dis.lo: tic80-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h \
    $(INCDIR)/dis-asm.h $(BFD_H)
  tic80-opc.lo: tic80-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h
Index: opcodes/Makefile.in
===================================================================
RCS file: /cvs/binutils/binutils/opcodes/Makefile.in,v
retrieving revision 1.6
diff -c -3 -p -r1.6 Makefile.in
*** Makefile.in	1999/09/04 17:14:37	1.6
--- Makefile.in	2000/01/10 16:50:43
*************** CFILES = \
*** 184,189 ****
--- 184,191 ----
  	sparc-dis.c \
  	sparc-opc.c \
  	tic30-dis.c \
+ 	tic54x-dis.c \
+ 	tic54x-opc.c \
  	tic80-dis.c \
  	tic80-opc.c \
  	v850-dis.c \
*************** ALL_MACHINES = \
*** 244,249 ****
--- 246,253 ----
  	sparc-dis.lo \
  	sparc-opc.lo \
  	tic30-dis.lo \
+ 	tic54x-dis.lo \
+ 	tic54x-opc.lo \
  	tic80-dis.lo \
  	tic80-opc.lo \
  	v850-dis.lo \
*************** sparc-dis.lo: sparc-dis.c $(INCDIR)/ansi
*** 852,857 ****
--- 856,864 ----
  sparc-opc.lo: sparc-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/sparc.h
  tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/dis-asm.h \
    $(BFD_H) $(INCDIR)/opcode/tic30.h
+ tic54x-dis.lo: tic54x-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h \
+   $(INCDIR)/dis-asm.h $(BFD_H)
+ tic54x-opc.lo: tic54x-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic54x.h
  tic80-dis.lo: tic80-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h \
    $(INCDIR)/dis-asm.h $(BFD_H)
  tic80-opc.lo: tic80-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/tic80.h
Index: opcodes/configure
===================================================================
RCS file: /cvs/binutils/binutils/opcodes/configure,v
retrieving revision 1.3
diff -c -3 -p -r1.3 configure
*** configure	1999/09/14 23:29:35	1.3
--- configure	2000/01/10 16:50:50
*************** if test x${all_targets} = xfalse ; then
*** 4289,4294 ****
--- 4289,4295 ----
  	bfd_sparc_arch)		ta="$ta sparc-dis.lo sparc-opc.lo" ;;
  	bfd_tahoe_arch)		;;
  	bfd_tic30_arch)		ta="$ta tic30-dis.lo" ;;
+ 	bfd_tic54x_arch)	ta="$ta tic54x-dis.lo tic54x-opc.lo" ;;
  	bfd_tic80_arch)		ta="$ta tic80-dis.lo tic80-opc.lo" ;;
  	bfd_v850_arch)		ta="$ta v850-opc.lo v850-dis.lo" ;;
  	bfd_v850e_arch)		ta="$ta v850-opc.lo v850-dis.lo" ;;
Index: opcodes/configure.in
===================================================================
RCS file: /cvs/binutils/binutils/opcodes/configure.in,v
retrieving revision 1.3
diff -c -3 -p -r1.3 configure.in
*** configure.in	1999/09/14 23:29:35	1.3
--- configure.in	2000/01/10 16:50:50
*************** if test x${all_targets} = xfalse ; then
*** 160,165 ****
--- 160,166 ----
  	bfd_sparc_arch)		ta="$ta sparc-dis.lo sparc-opc.lo" ;;
  	bfd_tahoe_arch)		;;
  	bfd_tic30_arch)		ta="$ta tic30-dis.lo" ;;
+ 	bfd_tic54x_arch)	ta="$ta tic54x-dis.lo tic54x-opc.lo" ;;
  	bfd_tic80_arch)		ta="$ta tic80-dis.lo tic80-opc.lo" ;;
  	bfd_v850_arch)		ta="$ta v850-opc.lo v850-dis.lo" ;;
  	bfd_v850e_arch)		ta="$ta v850-opc.lo v850-dis.lo" ;;
Index: opcodes/dis-buf.c
===================================================================
RCS file: /cvs/binutils/binutils/opcodes/dis-buf.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 dis-buf.c
*** dis-buf.c	1999/08/10 15:02:41	1.3
--- dis-buf.c	2000/01/10 16:50:50
*************** buffer_read_memory (memaddr, myaddr, len
*** 29,39 ****
       int length;
       struct disassemble_info *info;
  {
    if (memaddr < info->buffer_vma
!       || memaddr - info->buffer_vma + length > info->buffer_length)
      /* Out of bounds.  Use EIO because GDB uses it.  */
      return EIO;
!   memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
    return 0;
  }
  
--- 29,45 ----
       int length;
       struct disassemble_info *info;
  {
+   int opb = info->octets_per_byte;
+   int end_addr_offset = length / opb;
+   int max_addr_offset = info->buffer_length / opb; 
+   int octets = (memaddr - info->buffer_vma) * opb;
+ 
    if (memaddr < info->buffer_vma
!       || memaddr + end_addr_offset > info->buffer_vma + max_addr_offset)
      /* Out of bounds.  Use EIO because GDB uses it.  */
      return EIO;
!   memcpy (myaddr, info->buffer + octets, length);
! 
    return 0;
  }
  
Index: opcodes/disassemble.c
===================================================================
RCS file: /cvs/binutils/binutils/opcodes/disassemble.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 disassemble.c
*** disassemble.c	1999/09/04 17:14:37	1.3
--- disassemble.c	2000/01/10 16:50:51
*************** Foundation, Inc., 59 Temple Place - Suit
*** 45,50 ****
--- 45,51 ----
  #define ARCH_sh
  #define ARCH_sparc
  #define ARCH_tic30
+ #define ARCH_tic54x
  #define ARCH_tic80
  #define ARCH_v850
  #define ARCH_vax
*************** disassembler (abfd)
*** 216,221 ****
--- 217,227 ----
  #ifdef ARCH_tic30
      case bfd_arch_tic30:
        disassemble = print_insn_tic30;
+       break;
+ #endif
+ #ifdef ARCH_tic54x
+     case bfd_arch_tic54x:
+       disassemble = print_insn_tic54x;
        break;
  #endif
  #ifdef ARCH_tic80

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]