diff options
author | Timothy Wall <twall@alum.mit.edu> | 2000-04-18 02:21:27 +0000 |
---|---|---|
committer | Timothy Wall <twall@alum.mit.edu> | 2000-04-18 02:21:27 +0000 |
commit | b9af77f58f609c230732b9acdbf1a6f747766733 (patch) | |
tree | 0cb26da3871aa90de804d13bc8089d3970d61b79 /bfd | |
parent | 63fa1674919c94757f30a6e050f015eba30ee229 (diff) | |
download | fsf-binutils-gdb-b9af77f58f609c230732b9acdbf1a6f747766733.zip fsf-binutils-gdb-b9af77f58f609c230732b9acdbf1a6f747766733.tar.gz fsf-binutils-gdb-b9af77f58f609c230732b9acdbf1a6f747766733.tar.bz2 |
Clean up load page support for tic54x.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/bfd-in.h | 7 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 7 | ||||
-rw-r--r-- | bfd/coff-tic54x.c | 86 | ||||
-rw-r--r-- | bfd/coffcode.h | 7 |
5 files changed, 105 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 72d2896..a58eefb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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-13 Alan Modra <alan@linuxcare.com.au> * elf32-hppa.h: Update copyright date. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 1f67c0c..91b7868 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -748,4 +748,11 @@ extern boolean bfd_elf32_arm_process_before_allocation 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. */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 79080cb..a3f15c9 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -748,6 +748,13 @@ extern boolean bfd_elf32_arm_process_before_allocation 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)); diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index d27522a..4cfa27e 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -76,6 +76,56 @@ tic54x_getl_signed_32 (addr) 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) @@ -295,6 +345,18 @@ ticoff_bfd_is_local_label_name (abfd, name) #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; @@ -420,7 +482,7 @@ const bfd_target tic54x_coff0_vec = (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 */ @@ -446,7 +508,7 @@ const bfd_target tic54x_coff0_vec = 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, @@ -464,7 +526,7 @@ const bfd_target tic54x_coff0_beh_vec = (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 */ @@ -490,7 +552,7 @@ const bfd_target tic54x_coff0_beh_vec = 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), @@ -509,7 +571,7 @@ const bfd_target tic54x_coff1_vec = (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 */ @@ -535,7 +597,7 @@ const bfd_target tic54x_coff1_vec = 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), @@ -554,7 +616,7 @@ const bfd_target tic54x_coff1_beh_vec = (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 */ @@ -580,7 +642,7 @@ const bfd_target tic54x_coff1_beh_vec = 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), @@ -599,7 +661,7 @@ const bfd_target tic54x_coff2_vec = (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 */ @@ -625,7 +687,7 @@ const bfd_target tic54x_coff2_vec = 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), @@ -644,7 +706,7 @@ const bfd_target tic54x_coff2_beh_vec = (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 */ @@ -670,7 +732,7 @@ const bfd_target tic54x_coff2_beh_vec = 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), diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 40ba6ae..a6e8b08 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1531,6 +1531,10 @@ coff_set_alignment_hook (abfd, section, scnhdr) 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 */ @@ -3249,6 +3253,9 @@ coff_write_object_contents (abfd) 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; |