return COERCE32 (v);
}
+#define coff_get_section_load_page bfd_ticoff_get_section_load_page
+#define coff_set_section_load_page bfd_ticoff_set_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)
#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;
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
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_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
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_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
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_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
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_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
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_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
- HAS_SYMS | HAS_LOCALS | WP_TEXT /*| HAS_LOAD_PAGE*/ ),
+ HAS_SYMS | HAS_LOCALS | WP_TEXT ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
'_', /* leading symbol underscore */
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_WRITE (tic54x),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
#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
/*
* 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
#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 { \
(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);*/ \
+PUT_SCNHDR_PAGE(ABFD,((struct internal_scnhdr *)(INT))->s_page, \
+ (bfd_byte *)((SCNHDR *)(EXT))->s_page); \
} while(0)
-/* page macros
+/* Page macros
- the first GDB port requires flags in its remote memory access commands to
+ 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.
addresses.
*/
-#define LONG_ADDRESSES 1
-#define PG_SHIFT (LONG_ADDRESSES ? 30 : 16)
-#define ADDR_MASK (((unsigned long) 1 << PG_SHIFT) - 1)
-#define PG_MASK ((unsigned long) 3 << PG_SHIFT)
-#define PG_TO_FLAG(p) ((p) << PG_SHIFT)
-#define FLAG_TO_PG(f) (((f) & PG_MASK) >> PG_SHIFT)
+/* recognized load pages */
+#define PG_PROG 0x0 /* PROG page */
+#define PG_DATA 0x1 /* DATA page */
+
+#define ADDR_MASK 0x00FFFFFF
+#define PG_TO_FLAG(p) (((unsigned long)(p) & 0xFF) << 24)
+#define FLAG_TO_PG(f) (((f) >> 24) & 0xFF)
/*
* names of "special" sections