* bfd-in.h (bfd_record_phdr): Declare.
* bfd_in2.h: Rebuild.
Fri Dec 1 14:46:51 1995 Ian Lance Taylor <ian@cygnus.com>
+ * elf.c (assign_file_positions_for_segments): Sort the sections in
+ each segment.
+ (get_program_header_size): Return the right size if segment_map is
+ not NULL.
+ (copy_private_bfd_data): Don't bother to sort the sections.
+
+ * bfd.c (bfd_record_phdr): New function.
+ * bfd-in.h (bfd_record_phdr): Declare.
+ * bfd_in2.h: Rebuild.
+
* elf32-sparc.c (elf32_sparc_relocate_section): Remove bogus
BFD_ASSERT.
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
+extern boolean bfd_record_phdr
+ PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
+ boolean, boolean, unsigned int, struct sec **));
+
/* Byte swapping routines. */
bfd_vma bfd_getb64 PARAMS ((const unsigned char *));
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));
+ int, boolean, struct sec **));
/* And more from the source. */
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
+extern boolean bfd_record_phdr
+ PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
+ boolean, boolean, unsigned int, struct sec **));
+
/* Byte swapping routines. */
bfd_vma bfd_getb64 PARAMS ((const unsigned char *));
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));
+ int, boolean, struct sec **));
/* And more from the source. */
void
boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
/* Called to print private BFD data */
- boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, void *));
+ boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME)\
. struct _oasys_ar_data *oasys_ar_data;
. struct coff_tdata *coff_obj_data;
. struct pe_tdata *pe_obj_data;
+. struct xcoff_tdata *xcoff_obj_data;
. struct ecoff_tdata *ecoff_obj_data;
. struct ieee_data_struct *ieee_data;
. struct ieee_ar_data_struct *ieee_ar_data;
#include "libcoff.h"
#include "libecoff.h"
#undef obj_symbols
-#include "libelf.h"
+#include "elf-bfd.h"
#include <ctype.h>
\f
const char *file;
int line;
{
- (*_bfd_error_handler) ("bfd assertion fail %s:%d\n", file, line);
+ (*_bfd_error_handler) ("bfd assertion fail %s:%d", file, line);
}
return (*fn) (abfd, link_info, link_order, data, relocateable, symbols);
}
+/* Record information about an ELF program header. */
+boolean
+bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at,
+ includes_filehdr, includes_phdrs, count, secs)
+ bfd *abfd;
+ unsigned long type;
+ boolean flags_valid;
+ flagword flags;
+ boolean at_valid;
+ bfd_vma at;
+ boolean includes_filehdr;
+ boolean includes_phdrs;
+ unsigned int count;
+ asection **secs;
+{
+ struct elf_segment_map *m, **pm;
+
+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
+ return true;
+ m = ((struct elf_segment_map *)
+ bfd_alloc (abfd,
+ (sizeof (struct elf_segment_map)
+ + (count - 1) * sizeof (asection *))));
+ if (m == NULL)
+ return false;
+
+ m->next = NULL;
+ m->p_type = type;
+ m->p_flags = flags;
+ m->p_paddr = at;
+ m->p_flags_valid = flags_valid;
+ m->p_paddr_valid = at_valid;
+ m->includes_filehdr = includes_filehdr;
+ m->includes_phdrs = includes_phdrs;
+ m->count = count;
+ if (count > 0)
+ memcpy (m->sections, secs, count * sizeof (asection *));
+
+ for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; pm = &(*pm)->next)
+ ;
+ *pm = m;
+
+ return true;
+}