* xcofflink.c: Extensive changes to support linking shared objects

and generating a .loader section.
	* libcoff-in.h (struct xcoff_tdata): Add import_file_id field.
	(struct xcoff_section_tdata): Add first_symndx, last_symndx,
	and ldrel_count fields.
	* libcoff.h: Rebuild.
	* coff-rs6000.c (xcoff_howto_table): Correct reloc names.
	* coffcode.h (styp_to_sec_flags): Don't set any flags if STYP_PAD
	is set.
	* bfd-in.h (bfd_xcoff_import_symbol): Declare.
	(bfd_xcoff_export_symbol): Declare.
	(bfd_xcoff_size_dynamic_sections): Declare.
	* bfd-in2.h: Rebuild.
This commit is contained in:
Ian Lance Taylor 1995-10-25 15:37:47 +00:00
parent e54bf1c1a4
commit 28a0c10399
8 changed files with 2616 additions and 449 deletions

View File

@ -1,3 +1,19 @@
Wed Oct 25 11:32:54 1995 Ian Lance Taylor <ian@cygnus.com>
* xcofflink.c: Extensive changes to support linking shared objects
and generating a .loader section.
* libcoff-in.h (struct xcoff_tdata): Add import_file_id field.
(struct xcoff_section_tdata): Add first_symndx, last_symndx,
and ldrel_count fields.
* libcoff.h: Rebuild.
* coff-rs6000.c (xcoff_howto_table): Correct reloc names.
* coffcode.h (styp_to_sec_flags): Don't set any flags if STYP_PAD
is set.
* bfd-in.h (bfd_xcoff_import_symbol): Declare.
(bfd_xcoff_export_symbol): Declare.
(bfd_xcoff_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuild.
Tue Oct 24 17:44:20 1995 Stan Shebs <shebs@andros.cygnus.com>
* configure.in: Add xcofflink.o to pmac_xcoff_vec.

View File

@ -511,6 +511,7 @@ struct ecoff_debug_swap;
struct ecoff_extr;
struct symbol_cache_entry;
struct bfd_link_info;
struct bfd_link_hash_entry;
#endif
extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
@ -586,6 +587,8 @@ extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean bfd_sunos_record_link_assignment
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_sunos_size_dynamic_sections
@ -597,4 +600,17 @@ extern boolean bfd_sunos_size_dynamic_sections
extern boolean bfd_linux_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
/* XCOFF support routines for the linker. */
extern boolean bfd_xcoff_import_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
bfd_vma, const char *, const char *, const char *));
extern boolean bfd_xcoff_export_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
boolean));
extern boolean bfd_xcoff_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
unsigned long, unsigned long, unsigned long, boolean,
int, boolean));
/* And more from the source. */

View File

@ -511,6 +511,7 @@ struct ecoff_debug_swap;
struct ecoff_extr;
struct symbol_cache_entry;
struct bfd_link_info;
struct bfd_link_hash_entry;
#endif
extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
@ -586,6 +587,8 @@ extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean bfd_sunos_record_link_assignment
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_sunos_size_dynamic_sections
@ -597,6 +600,19 @@ extern boolean bfd_sunos_size_dynamic_sections
extern boolean bfd_linux_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
/* XCOFF support routines for the linker. */
extern boolean bfd_xcoff_import_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
bfd_vma, const char *, const char *, const char *));
extern boolean bfd_xcoff_export_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
boolean));
extern boolean bfd_xcoff_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
unsigned long, unsigned long, unsigned long, boolean,
int, boolean));
/* And more from the source. */
void
bfd_init PARAMS ((void));

View File

@ -395,7 +395,7 @@ static reloc_howto_type xcoff_howto_table[] =
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_REL", /* name */
"R_CREL", /* name */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
@ -440,7 +440,7 @@ static reloc_howto_type xcoff_howto_table[] =
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"R_REL", /* name */
"R_RBR", /* name */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
@ -455,7 +455,7 @@ static reloc_howto_type xcoff_howto_table[] =
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"R_REL", /* name */
"R_RBRC", /* name */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */

View File

@ -477,6 +477,10 @@ styp_to_sec_flags (abfd, hdr, name)
sec_flags |= SEC_DEBUGGING;
#endif
}
else if (styp_flags & STYP_PAD)
{
sec_flags = 0;
}
else if (strcmp (name, _TEXT) == 0)
{
if (sec_flags & SEC_NEVER_LOAD)
@ -2299,6 +2303,8 @@ coff_write_object_contents (abfd)
if (bss_sec)
{
internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec);
if (internal_a.bsize && bss_sec->vma < internal_a.data_start)
internal_a.data_start = bss_sec->vma;
}
internal_a.entry = bfd_get_start_address (abfd);

View File

@ -125,6 +125,11 @@ struct xcoff_tdata
/* maxstack from optional header. */
bfd_size_type maxstack;
/* Used by the XCOFF backend linker. */
asection **csects;
unsigned long *debug_indices;
unsigned int import_file_id;
};
#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
@ -159,6 +164,25 @@ struct coff_section_tdata
#define coff_section_data(abfd, sec) \
((struct coff_section_tdata *) (sec)->used_by_bfd)
/* Tdata for sections in XCOFF files. This is used by the linker. */
struct xcoff_section_tdata
{
/* Used for XCOFF csects created by the linker; points to the real
XCOFF section which contains this csect. */
asection *enclosing;
/* The first and one past the last symbol indices for symbols used
by this csect. */
unsigned long first_symndx;
unsigned long last_symndx;
/* The number of .loader relocs in this csect. */
size_t ldrel_count;
};
/* An accessor macro the xcoff_section_tdata structure. */
#define xcoff_section_data(abfd, sec) \
((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
/* COFF linker hash table entries. */
struct coff_link_hash_entry
@ -280,5 +304,17 @@ extern boolean _bfd_coff_generic_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
/* Functions in xcofflink.c. */
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
PARAMS ((bfd *));
extern boolean _bfd_xcoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_xcoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_ppc_xcoff_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
/* And more taken from the source .. */

View File

@ -93,6 +93,7 @@ typedef struct pe_tdata
struct internal_extra_pe_aouthdr pe_opthdr;
int dll;
int has_reloc_section;
boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
} pe_data_type;
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
@ -116,11 +117,19 @@ struct xcoff_tdata
/* modtype from optional header. */
short modtype;
/* cputype from optional header. */
short cputype;
/* maxdata from optional header. */
bfd_size_type maxdata;
/* maxstack from optional header. */
bfd_size_type maxstack;
/* Used by the XCOFF backend linker. */
asection **csects;
unsigned long *debug_indices;
unsigned int import_file_id;
};
#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
@ -155,6 +164,25 @@ struct coff_section_tdata
#define coff_section_data(abfd, sec) \
((struct coff_section_tdata *) (sec)->used_by_bfd)
/* Tdata for sections in XCOFF files. This is used by the linker. */
struct xcoff_section_tdata
{
/* Used for XCOFF csects created by the linker; points to the real
XCOFF section which contains this csect. */
asection *enclosing;
/* The first and one past the last symbol indices for symbols used
by this csect. */
unsigned long first_symndx;
unsigned long last_symndx;
/* The number of .loader relocs in this csect. */
size_t ldrel_count;
};
/* An accessor macro the xcoff_section_tdata structure. */
#define xcoff_section_data(abfd, sec) \
((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
/* COFF linker hash table entries. */
struct coff_link_hash_entry
@ -254,6 +282,13 @@ extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
/* Functions in cofflink.c. */
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
extern boolean _bfd_coff_link_hash_table_init
PARAMS ((struct coff_link_hash_table *, bfd *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *)));
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
PARAMS ((bfd *));
extern const char *_bfd_coff_internal_syment_name
@ -269,6 +304,18 @@ extern boolean _bfd_coff_generic_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
/* Functions in xcofflink.c. */
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
PARAMS ((bfd *));
extern boolean _bfd_xcoff_bfd_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_xcoff_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *));
extern boolean _bfd_ppc_xcoff_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **));
/* And more taken from the source .. */
typedef struct coff_ptr_struct

File diff suppressed because it is too large Load Diff