This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
PATCH load page addendum
- To: nickc at cygnus dot com, binutils at sourceware dot cygnus dot com
- Subject: PATCH load page addendum
- From: Timothy Wall <twall at tiac dot net>
- Date: Thu, 13 Jan 2000 20:27:55 -0500
Forgot to include this file in the previous diff:
* include/coff/internal.h: Added s_page and associated flag.
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/14 01:25:11
*************** 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.28
diff -c -3 -p -r1.28 bfd-in2.h
*** bfd-in2.h 2000/01/13 22:10:36 1.28
--- bfd-in2.h 2000/01/14 01:25:14
*************** 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
*** 1065,1070 ****
--- 1070,1081 ----
information. */
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 octets, as it will be output.
Contains a value even if the section has no contents (e.g., the
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/binutils/binutils/bfd/coffcode.h,v
retrieving revision 1.27
diff -c -3 -p -r1.27 coffcode.h
*** coffcode.h 2000/01/13 23:55:21 1.27
--- coffcode.h 2000/01/14 01:25:17
*************** coff_write_object_contents (abfd)
*** 3126,3131 ****
--- 3126,3132 ----
#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
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/coffgen.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 coffgen.c
*** coffgen.c 2000/01/13 22:10:36 1.10
--- coffgen.c 2000/01/14 01:25:18
*************** 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
*** 227,235 ****
}
/* make_abs_section (abfd); */
-
- if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
- goto fail;
return abfd->xvec;
--- 235,240 ----
Index: bfd/linker.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/linker.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 linker.c
*** linker.c 2000/01/13 22:10:36 1.4
--- linker.c 2000/01/14 01:25:22
*************** default_indirect_link_order (output_bfd,
*** 2749,2755 ****
/* 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/section.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/section.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 section.c
*** section.c 2000/01/13 22:10:36 1.10
--- section.c 2000/01/14 01:25:25
*************** CODE_FRAGMENT
*** 369,374 ****
--- 369,380 ----
.
. 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 octets, 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. *}
*************** static const asymbol global_syms[] =
*** 536,549 ****
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, \
--- 542,555 ----
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[] =
*** 562,571 ****
}
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
/*
--- 568,577 ----
}
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
/*
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/14 01:25:28
*************** 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_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 */
};
/*