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]

[PATCH] tic54x BFD load page support


This patch fixes the load page support for tic54x that was previously
stubbed out.  It also fixes the tic54x TI COFF backend so that it
accepts bfd_arch_unknown for better binary image handling.




? bfd/diffs.txt
Index: bfd/ChangeLog
===================================================================
RCS file: /cvs/src/src/bfd/ChangeLog,v
retrieving revision 1.384
diff -d -c -p -r1.384 ChangeLog
*** ChangeLog	2000/04/11 04:11:02	1.384
--- ChangeLog	2000/04/17 23:11:11
***************
*** 1,3 ****
--- 1,13 ----
+ 2000-04-17  Timothy Wall  <twall@cygnus.com>
+ 
+ 	* bfd-in2.h: Add prototypes for tic54x load page access.
+ 	* bfd-in.h: Regenerate.
+ 	* coff-tic54x.c: Add load page functions; allow bfd_arch_unknown
+ 	in customized _set_arch_mach function.
+ 	* coffcode.h (coff_set_alignment_hook): Set section load page if
+ 	the appropriate macro is defined. 
+ 	(write_object_contents): Read section load page.
+ 	
  2000-04-11  Timothy Wall  <twall@cygnus.com>
  
  	* coff-tic54x.c: Now builds with all targets.
Index: bfd/bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.8
diff -d -c -p -r1.8 bfd-in.h
*** bfd-in.h	2000/03/01 20:39:07	1.8
--- bfd-in.h	2000/04/17 23:11:11
*************** extern boolean bfd_elf32_arm_process_bef
*** 748,751 ****
--- 748,758 ----
  extern boolean bfd_elf32_arm_get_bfd_for_interworking
    PARAMS ((bfd *, struct bfd_link_info *));
  
+ /* TI COFF load page support. */
+ extern void bfd_ticoff_set_section_load_page
+   PARAMS ((struct sec *, int));
+ 
+ extern int bfd_ticoff_get_section_load_page
+   PARAMS ((struct sec *));
+ 
  /* And more from the source.  */
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.40
diff -d -c -p -r1.40 bfd-in2.h
*** bfd-in2.h	2000/04/08 00:10:49	1.40
--- bfd-in2.h	2000/04/17 23:11:11
*************** extern boolean bfd_elf32_arm_process_bef
*** 748,753 ****
--- 748,760 ----
  extern boolean bfd_elf32_arm_get_bfd_for_interworking
    PARAMS ((bfd *, struct bfd_link_info *));
  
+ /* TI COFF load page support. */
+ extern void bfd_ticoff_set_section_load_page
+   PARAMS ((struct sec *, int));
+ 
+ extern int bfd_ticoff_get_section_load_page
+   PARAMS ((struct sec *));
+ 
  /* And more from the source.  */
  void 
  bfd_init PARAMS ((void));
Index: bfd/coff-tic54x.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-tic54x.c,v
retrieving revision 1.3
diff -d -c -p -r1.3 coff-tic54x.c
*** coff-tic54x.c	2000/04/11 04:11:02	1.3
--- coff-tic54x.c	2000/04/17 23:11:12
*************** tic54x_getl_signed_32 (addr)
*** 76,81 ****
--- 76,130 ----
    return COERCE32 (v);
  }
  
+ #define coff_get_section_load_page bfd_ticoff_get_section_load_page
+ 
+ void 
+ bfd_ticoff_set_section_load_page (sect, page)
+   asection *sect;
+   int page;
+ {
+   sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
+ }
+ 
+ 
+ int
+ bfd_ticoff_get_section_load_page (sect)
+   asection *sect;
+ {
+   int page;
+ 
+   /* Provide meaningful defaults for predefined sections. */
+   if (sect == &bfd_com_section)
+     page = PG_DATA;
+ 
+   else if (sect == &bfd_und_section
+       || sect == &bfd_abs_section
+       || sect == &bfd_ind_section)
+     page = PG_PROG;
+ 
+   else
+     page = FLAG_TO_PG (sect->lma);
+ 
+   return page;
+ }
+ 
+ /* Set the architecture appropriately.  Allow unkown architectures
+    (e.g. binary). */ 
+ static boolean
+ tic54x_set_arch_mach (abfd, arch, machine)
+      bfd *abfd;
+      enum bfd_architecture arch;
+      unsigned long machine;
+ {
+   if (arch == bfd_arch_unknown)
+     arch = bfd_arch_tic54x;
+ 
+   else if (arch != bfd_arch_tic54x)
+     return false;
+ 
+   return bfd_default_set_arch_mach (abfd, arch, machine);
+ }
+ 
  static bfd_reloc_status_type
  tic54x_relocation (abfd, reloc_entry, symbol, data, input_section, 
                     output_bfd, error_message)
*************** ticoff_bfd_is_local_label_name (abfd, na
*** 295,300 ****
--- 344,361 ----
  #define BADMAG(x) COFF2_BADMAG(x)
  #include "coffcode.h"
  
+ static boolean
+ tic54x_set_section_contents (abfd, section, location, offset, bytes_to_do)
+      bfd *abfd;
+      sec_ptr section;
+      PTR location;
+      file_ptr offset;
+      bfd_size_type bytes_to_do;
+ {
+   return coff_set_section_contents (abfd, section, location, 
+                                     offset, bytes_to_do);
+ }
+ 
  static void
  tic54x_reloc_processing (relent, reloc, symbols, abfd, section)
       arelent *relent;
*************** const bfd_target tic54x_coff0_vec =
*** 420,426 ****
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
--- 481,487 ----
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
*************** const bfd_target tic54x_coff0_vec =
*** 446,452 ****
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (coff),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
    NULL,
--- 507,513 ----
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (tic54x),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
    NULL,
*************** const bfd_target tic54x_coff0_beh_vec =
*** 464,470 ****
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
--- 525,531 ----
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
*************** const bfd_target tic54x_coff0_beh_vec =
*** 490,496 ****
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (coff),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
--- 551,557 ----
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (tic54x),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
*************** const bfd_target tic54x_coff1_vec =
*** 509,515 ****
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
--- 570,576 ----
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
*************** const bfd_target tic54x_coff1_vec =
*** 535,541 ****
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (coff),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
--- 596,602 ----
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (tic54x),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
*************** const bfd_target tic54x_coff1_beh_vec =
*** 554,560 ****
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
--- 615,621 ----
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
*************** const bfd_target tic54x_coff1_beh_vec =
*** 580,586 ****
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (coff),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
--- 641,647 ----
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (tic54x),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
*************** const bfd_target tic54x_coff2_vec =
*** 599,605 ****
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
--- 660,666 ----
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
*************** const bfd_target tic54x_coff2_vec =
*** 625,631 ****
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (coff),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
--- 686,692 ----
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (tic54x),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
*************** const bfd_target tic54x_coff2_beh_vec =
*** 644,650 ****
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
--- 705,711 ----
  
    (HAS_RELOC | EXEC_P |		/* object flags */
     HAS_LINENO | HAS_DEBUG |
!    HAS_SYMS | HAS_LOCALS | WP_TEXT ),
  
    (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
    '_',				/* leading symbol underscore */
*************** const bfd_target tic54x_coff2_beh_vec =
*** 670,676 ****
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (coff),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
--- 731,737 ----
    BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
    BFD_JUMP_TABLE_SYMBOLS (coff),
    BFD_JUMP_TABLE_RELOCS (coff),
!   BFD_JUMP_TABLE_WRITE (tic54x),
    BFD_JUMP_TABLE_LINK (coff),
    BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.36
diff -d -c -p -r1.36 coffcode.h
*** coffcode.h	2000/04/11 04:11:02	1.36
--- coffcode.h	2000/04/17 23:11:12
*************** coff_set_alignment_hook (abfd, section, 
*** 1531,1536 ****
--- 1531,1540 ----
    i = COFF_DECODE_ALIGNMENT(hdr->s_flags);
  #endif
    section->alignment_power = i;
+ 
+ #ifdef coff_set_section_load_page
+   coff_set_section_load_page (section, hdr->s_page);
+ #endif
  }
  
  #else /* ! COFF_ALIGN_IN_SECTION_HEADER */
*************** coff_write_object_contents (abfd)
*** 3249,3254 ****
--- 3253,3261 ----
        section.s_vaddr = current->vma;
        section.s_paddr = current->lma;
        section.s_size =  current->_raw_size;
+ #ifdef coff_get_section_load_page
+       section.s_page = coff_get_section_load_page (current); 
+ #endif
  
  #ifdef COFF_WITH_PE
        section.s_paddr = 0;
Index: include/coff/ChangeLog
===================================================================
RCS file: /cvs/src/src/include/coff/ChangeLog,v
retrieving revision 1.17
diff -d -c -p -r1.17 ChangeLog
*** ChangeLog	2000/04/11 04:11:03	1.17
--- ChangeLog	2000/04/17 23:11:13
***************
*** 1,3 ****
--- 1,8 ----
+ 2000-04-17  Timothy Wall  <twall@cygnus.com>
+ 	
+ 	* ti.h: Load page cleanup.
+ 	* intental.h: Add load page field.
+ 	
  2000-04-11  Timothy Wall  <twall@cygnus.com>
  
  	* ti.h: Remove load page references until load pages are
Index: include/coff/internal.h
===================================================================
RCS file: /cvs/src/src/include/coff/internal.h,v
retrieving revision 1.6
diff -d -c -p -r1.6 internal.h
*** internal.h	2000/04/07 17:06:58	1.6
--- internal.h	2000/04/17 23:11:13
*************** struct internal_scnhdr
*** 301,306 ****
--- 301,307 ----
    unsigned long s_nlnno;	/* number of line number entries*/
    long s_flags;			/* flags			*/
    long s_align;			/* used on I960			*/
+   unsigned char s_page;         /* TI COFF load page            */
  };
  
  /*
Index: include/coff/ti.h
===================================================================
RCS file: /cvs/src/src/include/coff/ti.h,v
retrieving revision 1.3
diff -d -c -p -r1.3 ti.h
*** ti.h	2000/04/11 04:11:03	1.3
--- ti.h	2000/04/17 23:11:13
*************** struct external_filehdr {
*** 71,82 ****
  #define COFF2_BADMAG(x) ((x).f_magic != TICOFF2MAGIC || (x).f_target_id != TI_TARGET_ID)
  
  /* we need to read/write an extra field in the coff file header */
- /* FIXME load page */
  #ifndef COFF_ADJUST_FILEHDR_IN_POST
  #define COFF_ADJUST_FILEHDR_IN_POST(abfd,src,dst) \
  do { ((struct internal_filehdr *)(dst))->f_target_id = \
  bfd_h_get_16(abfd, (bfd_byte *)(((FILHDR *)(src))->f_target_id)); \
- /*((struct internal_filehdr *)(dst))->f_flags |= F_LDPAGE;*/ \
  } while(0)
  #endif
  
--- 71,80 ----
*************** struct external_scnhdr {
*** 161,169 ****
  /*
   * Special section flags
   */
- /* recognized load pages */
- #define PG_PROG         0x0         /* PROG page */
- #define PG_DATA         0x1         /* DATA page */
  
  /* TI COFF defines these flags; 
     STYP_CLINK: the section should be excluded from the final
--- 159,164 ----
*************** bfd_h_put_8 (ABFD,VAL,(PTR)-7), bfd_h_pu
*** 212,229 ****
  #define PUT_SCNHDR_SIZE(ABFD,SZ,SZP) \
  bfd_h_put_32(ABFD,(SZ)/bfd_octets_per_byte(ABFD),SZP)
  
- /* FIXME load page
  #define COFF_ADJUST_SCNHDR_IN_POST(ABFD,EXT,INT) \
  do { ((struct internal_scnhdr *)(INT))->s_page = \
  GET_SCNHDR_PAGE(ABFD,(bfd_byte *)((SCNHDR *)(EXT))->s_page); \
  } while(0)
- */
  
  /* The line number and reloc overflow checking in coff_swap_scnhdr_out in
     coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc.
     Due to different sized v0/v1/v2 section headers, we have to re-write these
     fields.
-    FIXME load page
   */
  #define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \
  do { \
--- 207,221 ----
*************** PUT_SCNHDR_NRELOC(ABFD,((struct internal
*** 233,245 ****
                  (bfd_byte *)((SCNHDR *)(EXT))->s_nreloc); \
  PUT_SCNHDR_FLAGS(ABFD,((struct internal_scnhdr *)(INT))->s_flags, \
                  (bfd_byte *)((SCNHDR *)(EXT))->s_flags); \
! /*PUT_SCNHDR_PAGE(ABFD,((struct internal_scnhdr *)(INT))->s_page, \
!   (bfd_byte *)((SCNHDR *)(EXT))->s_page);*/ \
  } while(0)
  
! /* page macros
  
!    the first GDB port requires flags in its remote memory access commands to
     distinguish between data/prog space.  hopefully we can make this go away
     eventually.  stuff the page in the upper bits of a 32-bit address, since
     the c5x family only uses 16 or 23 bits.
--- 225,237 ----
                  (bfd_byte *)((SCNHDR *)(EXT))->s_nreloc); \
  PUT_SCNHDR_FLAGS(ABFD,((struct internal_scnhdr *)(INT))->s_flags, \
                  (bfd_byte *)((SCNHDR *)(EXT))->s_flags); \
! PUT_SCNHDR_PAGE(ABFD,((struct internal_scnhdr *)(INT))->s_page, \
!                 (bfd_byte *)((SCNHDR *)(EXT))->s_page); \
  } while(0)
  
! /* Page macros
  
!    The first GDB port requires flags in its remote memory access commands to
     distinguish between data/prog space.  hopefully we can make this go away
     eventually.  stuff the page in the upper bits of a 32-bit address, since
     the c5x family only uses 16 or 23 bits.
*************** PUT_SCNHDR_FLAGS(ABFD,((struct internal_
*** 250,259 ****
     addresses. 
  */
  
! #define LONG_ADDRESSES  1
! #define PG_SHIFT        (LONG_ADDRESSES ? 30 : 16)
  #define ADDR_MASK       ((1ul<<PG_SHIFT)-1)/* 16 or 24-bit addresses */
! #define PG_MASK         (3ul<<PG_SHIFT)
  #define PG_TO_FLAG(p)   ((p)<<PG_SHIFT)
  #define FLAG_TO_PG(f)   (((f)&PG_MASK)>>PG_SHIFT)
  
--- 242,254 ----
     addresses. 
  */
  
! /* recognized load pages */
! #define PG_PROG         0x0         /* PROG page */
! #define PG_DATA         0x1         /* DATA page */
! 
! #define PG_SHIFT        24
  #define ADDR_MASK       ((1ul<<PG_SHIFT)-1)/* 16 or 24-bit addresses */
! #define PG_MASK         ((unsigned long)0xFF<<PG_SHIFT)
  #define PG_TO_FLAG(p)   ((p)<<PG_SHIFT)
  #define FLAG_TO_PG(f)   (((f)&PG_MASK)>>PG_SHIFT)
  

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