summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorTimothy Wall <twall@alum.mit.edu>2000-04-18 02:21:27 +0000
committerTimothy Wall <twall@alum.mit.edu>2000-04-18 02:21:27 +0000
commit654d636defaf401ad1382788e6128b55c13720de (patch)
treef46ac54f15b9e4495eb2a11a753eba4ac8c36c86 /bfd
parent45c68d3b99cb5c11b8d3c9af9740b20e1d5410fc (diff)
downloadbinutils-redhat-654d636defaf401ad1382788e6128b55c13720de.tar.gz
Clean up load page support for tic54x.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/bfd-in.h7
-rw-r--r--bfd/bfd-in2.h7
-rw-r--r--bfd/coff-tic54x.c86
-rw-r--r--bfd/coffcode.h7
5 files changed, 105 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 72d289611d..a58eefbfcf 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 1f67c0c3a2..91b7868c58 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 79080cbaad..a3f15c90a3 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 d27522a8c8..4cfa27ebb7 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 40ba6ae725..a6e8b088a1 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;