Thu Mar 31 11:52:15 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+ Added some support for Irix 4 shared libraries.
+ * ecoff.c (ecoff_new_section_hook): Set SEC_SHARED_LIBRARY for a
+ .lib section.
+ (ecoff_sec_to_styp_flags): Set SEC_SHARED_LIBRARY if
+ STYP_ECOFF_LIB bit is set.
+ (ecoff_compute_section_file_positions): Round the contents of a
+ .lib section up to the next page boundary.
+ (ecoff_set_section_contents): If we see a .lib section, increment
+ the vma by one to count the number of shared libraries we have.
+ (ecoff_write_object_contents): Don't crash if we see a
+ STYP_ECOFF_LIB section, and don't adjust text_start or data_start
+ or bss_size either.
+
* coffcode.h (CALC_ADDEND): Change to fetch original symbol value
from original BFD, rather than using value of current BFD symbol.
Needed for new linker.
else if (strcmp (section->name, _BSS) == 0
|| strcmp (section->name, _SBSS) == 0)
section->flags |= SEC_ALLOC;
+ 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
styp = STYP_PDATA;
else if (strcmp (name, _XDATA) == 0)
styp = STYP_XDATA;
+ else if (strcmp (name, _LIB) == 0)
+ styp = STYP_ECOFF_LIB;
else if (flags & SEC_CODE)
styp = STYP_TEXT;
else if (flags & SEC_DATA)
{
sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
}
+ else if (styp_flags & STYP_ECOFF_LIB)
+ {
+ sec_flags |= SEC_SHARED_LIBRARY;
+ }
else
{
sec_flags |= SEC_ALLOC | SEC_LOAD;
sofar = (sofar + round - 1) &~ (round - 1);
first_data = false;
}
+ else if (strcmp (current->name, _LIB) == 0)
+ {
+ const bfd_vma round = ecoff_backend (abfd)->round;
+ /* On Irix 4, the location of contents of the .lib section
+ from a shared library section is also rounded up to a
+ page boundary. */
+
+ sofar = (sofar + round - 1) &~ (round - 1);
+ }
/* Align the sections in the file to the same boundary on
which they are aligned in virtual memory. */
if (abfd->output_has_begun == false)
ecoff_compute_section_file_positions (abfd);
+ /* If this is a .lib section, bump the vma address so that it winds
+ up being the number of .lib sections output. This is right for
+ Irix 4. Ian Taylor <ian@cygnus.com>. */
+ if (strcmp (section->name, _LIB) == 0)
+ ++section->vma;
+
if (count == 0)
return true;
strncpy (section.s_name, current->name, sizeof section.s_name);
- /* FIXME: is this correct for shared libraries? I think it is
- but I have no platform to check. Ian Lance Taylor. */
+ /* This seems to be correct for Irix 4 shared libraries. */
vma = bfd_get_section_vma (abfd, current);
if (strcmp (current->name, _LIB) == 0)
section.s_vaddr = 0;
else if ((section.s_flags & STYP_BSS) != 0
|| (section.s_flags & STYP_SBSS) != 0)
bss_size += bfd_get_section_size_before_reloc (current);
+ else if ((section.s_flags & STYP_ECOFF_LIB) != 0)
+ /* Do nothing */ ;
else
abort ();
}