struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
struct internal_aouthdr *internal_a = (struct internal_aouthdr *) aouthdr;
ecoff_data_type *ecoff;
- asection *regsec;
if (ecoff_mkobject (abfd) == false)
return NULL;
ecoff->gp_size = 8;
ecoff->sym_filepos = internal_f->f_symptr;
- /* Create the .reginfo section to give programs outside BFD a way to
- see the information stored in the a.out header. See the comment
- in coff/ecoff.h. */
- regsec = bfd_make_section (abfd, REGINFO);
- if (regsec == NULL)
- return NULL;
-
if (internal_a != (struct internal_aouthdr *) NULL)
{
int i;
else if (strcmp (section->name, _LIB) == 0)
{
/* An Irix 4 shared libary. */
- section->flags |= SEC_SHARED_LIBRARY;
- }
- else if (strcmp (section->name, REGINFO) == 0)
- {
- /* Setting SEC_SHARED_LIBRARY should make the linker leave the
- section completely alone. */
- section->flags |= (SEC_SHARED_LIBRARY
- | SEC_HAS_CONTENTS
- | SEC_NEVER_LOAD);
- section->_raw_size = sizeof (struct ecoff_reginfo);
+ section->flags |= SEC_COFF_SHARED_LIBRARY;
}
/* Probably any other section name is SEC_NEVER_LOAD, but I'm
|| (styp_flags & STYP_ECOFF_FINI))
{
if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_CODE | SEC_SHARED_LIBRARY;
+ sec_flags |= SEC_CODE | SEC_COFF_SHARED_LIBRARY;
else
sec_flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC;
}
|| styp_flags == STYP_XDATA)
{
if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_DATA | SEC_SHARED_LIBRARY;
+ sec_flags |= SEC_DATA | SEC_COFF_SHARED_LIBRARY;
else
sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC;
if ((styp_flags & STYP_RDATA)
}
else if (styp_flags & STYP_ECOFF_LIB)
{
- sec_flags |= SEC_SHARED_LIBRARY;
+ sec_flags |= SEC_COFF_SHARED_LIBRARY;
}
else
{
char *pdr_ptr;
char *pdr_end;
PDR pdr;
+ bfd_vma first_off;
unsigned char *line_ptr;
unsigned char *line_end;
int lineno;
+ fdr_ptr->ipdFirst * external_pdr_size);
pdr_end = pdr_ptr + fdr_ptr->cpd * external_pdr_size;
(*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
+ if (offset < pdr.adr)
+ return false;
/* The address of the first PDR is an offset which applies to the
addresses of all the PDR's. */
- offset += pdr.adr;
+ first_off = pdr.adr;
for (pdr_ptr += external_pdr_size;
pdr_ptr < pdr_end;
pdr_ptr -= external_pdr_size;
(*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr);
- offset -= pdr.adr;
+ offset -= pdr.adr - first_off;
lineno = pdr.lnLow;
line_ptr = (ecoff_data (abfd)->debug_info.line
+ fdr_ptr->cbLineOffset
{
struct ecoff_debug_info *iinfo = &ecoff_data (ibfd)->debug_info;
struct ecoff_debug_info *oinfo = &ecoff_data (obfd)->debug_info;
+ register int i;
asymbol **sym_ptr_ptr;
size_t c;
boolean local;
BFD_ASSERT (ibfd->xvec == obfd->xvec);
+ /* Copy the GP value and the register masks. */
+ ecoff_data (obfd)->gp = ecoff_data (ibfd)->gp;
+ ecoff_data (obfd)->gprmask = ecoff_data (ibfd)->gprmask;
+ ecoff_data (obfd)->fprmask = ecoff_data (ibfd)->fprmask;
+ for (i = 0; i < 3; i++)
+ ecoff_data (obfd)->cprmask[i] = ecoff_data (ibfd)->cprmask[i];
+
+ /* Copy the version stamp. */
oinfo->symbolic_header.vstamp = iinfo->symbolic_header.vstamp;
/* If there are no symbols, don't copy any debugging information. */
return arch == ecoff_backend (abfd)->arch;
}
-/* Get the size of the section headers. We do not output the .reginfo
- section. */
+/* Get the size of the section headers. */
/*ARGSUSED*/
int
for (current = abfd->sections;
current != (asection *)NULL;
current = current->next)
- if (strcmp (current->name, REGINFO) != 0)
- ++c;
+ ++c;
ret = (bfd_coff_filhsz (abfd)
+ bfd_coff_aoutsz (abfd)
return BFD_ALIGN (ret, 16);
}
-/* Get the contents of a section. This is where we handle reading the
- .reginfo section, which implicitly holds the contents of an
- ecoff_reginfo structure. */
+/* Get the contents of a section. */
boolean
ecoff_get_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
- ecoff_data_type *tdata = ecoff_data (abfd);
- struct ecoff_reginfo s;
- int i;
-
- if (strcmp (section->name, REGINFO) != 0)
- return _bfd_generic_get_section_contents (abfd, section, location,
- offset, count);
-
- s.gp_value = tdata->gp;
- s.gprmask = tdata->gprmask;
- for (i = 0; i < 4; i++)
- s.cprmask[i] = tdata->cprmask[i];
- s.fprmask = tdata->fprmask;
-
- /* bfd_get_section_contents has already checked that the offset and
- size is reasonable. We don't have to worry about swapping or any
- such thing; the .reginfo section is defined such that the
- contents are an ecoff_reginfo structure as seen on the host. */
- memcpy (location, ((char *) &s) + offset, (size_t) count);
- return true;
+ return _bfd_generic_get_section_contents (abfd, section, location,
+ offset, count);
}
/* Calculate the file position for each section, and set
unsigned int alignment_power;
/* Only deal with sections which have contents */
- if ((current->flags & (SEC_HAS_CONTENTS | SEC_LOAD)) == 0
- || strcmp (current->name, REGINFO) == 0)
+ if ((current->flags & (SEC_HAS_CONTENTS | SEC_LOAD)) == 0)
continue;
/* For the Alpha ECOFF .pdata section the lnnoptr field is
current != (asection *)NULL;
current = current->next)
{
- if (strcmp (current->name, REGINFO) == 0)
- continue;
if (current->reloc_count == 0)
current->rel_filepos = 0;
else
return reloc_size;
}
-/* Set the contents of a section. This is where we handle setting the
- contents of the .reginfo section, which implicitly holds a
- ecoff_reginfo structure. */
+/* Set the contents of a section. */
boolean
ecoff_set_section_contents (abfd, section, location, offset, count)
if (count == 0)
return true;
- if (strcmp (section->name, REGINFO) == 0)
+ if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0
+ || bfd_write (location, 1, count, abfd) != count)
+ return false;
+
+ return true;
+}
+
+/* Get the GP value for an ECOFF file. This is a hook used by
+ nlmconv. */
+
+bfd_vma
+bfd_ecoff_get_gp_value (abfd)
+ bfd *abfd;
+{
+ if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
+ || bfd_get_format (abfd) != bfd_object)
{
- ecoff_data_type *tdata = ecoff_data (abfd);
- struct ecoff_reginfo s;
- int i;
+ bfd_set_error (bfd_error_invalid_operation);
+ return 0;
+ }
+
+ return ecoff_data (abfd)->gp;
+}
- /* If the caller is only changing part of the structure, we must
- retrieve the current information before the memcpy. */
- if (offset != 0 || count != sizeof (struct ecoff_reginfo))
- {
- s.gp_value = tdata->gp;
- s.gprmask = tdata->gprmask;
- for (i = 0; i < 4; i++)
- s.cprmask[i] = tdata->cprmask[i];
- s.fprmask = tdata->fprmask;
- }
+/* Set the GP value for an ECOFF file. This is a hook used by the
+ assembler. */
- /* bfd_set_section_contents has already checked that the offset
- and size is reasonable. We don't have to worry about
- swapping or any such thing; the .reginfo section is defined
- such that the contents are an ecoff_reginfo structure as seen
- on the host. */
- memcpy (((char *) &s) + offset, location, (size_t) count);
+boolean
+bfd_ecoff_set_gp_value (abfd, gp_value)
+ bfd *abfd;
+ bfd_vma gp_value;
+{
+ if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
+ || bfd_get_format (abfd) != bfd_object)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return false;
+ }
- tdata->gp = s.gp_value;
- tdata->gprmask = s.gprmask;
- for (i = 0; i < 4; i++)
- tdata->cprmask[i] = s.cprmask[i];
- tdata->fprmask = s.fprmask;
+ ecoff_data (abfd)->gp = gp_value;
- return true;
+ return true;
+}
+
+/* Set the register masks for an ECOFF file. This is a hook used by
+ the assembler. */
+
+boolean
+bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
+ bfd *abfd;
+ unsigned long gprmask;
+ unsigned long fprmask;
+ unsigned long *cprmask;
+{
+ ecoff_data_type *tdata;
+
+ if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour
+ || bfd_get_format (abfd) != bfd_object)
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ return false;
}
- if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0
- || bfd_write (location, 1, count, abfd) != count)
- return false;
+ tdata = ecoff_data (abfd);
+ tdata->gprmask = gprmask;
+ tdata->fprmask = fprmask;
+ if (cprmask != (unsigned long *) NULL)
+ {
+ register int i;
+
+ for (i = 0; i < 3; i++)
+ tdata->cprmask[i] = cprmask[i];
+ }
return true;
}
current != (asection *)NULL;
current = current->next)
{
- if (strcmp (current->name, REGINFO) == 0)
- continue;
current->target_index = count;
++count;
}
struct internal_scnhdr section;
bfd_vma vma;
- if (strcmp (current->name, REGINFO) == 0)
- {
- BFD_ASSERT (current->reloc_count == 0);
- continue;
- }
-
++internal_f.f_nscns;
strncpy (section.s_name, current->name, sizeof section.s_name);
name = ssext + esym.asym.iss;
+ h = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name, BSF_GLOBAL, section, value,
(const char *) NULL, true, true,
for (o = abfd->sections; o != (asection *) NULL; o = o->next)
{
- /* Ignore any link_orders for the .reginfo section, which does
- not really exist. */
- if (strcmp (o->name, REGINFO) == 0)
- continue;
-
for (p = o->link_order_head;
p != (struct bfd_link_order *) NULL;
p = p->next)