SEC_SHARED_LIBRARY for clarity. Changed all uses.
* bfd-in2.h: Rebuilt.
* coffcode.h (sec_to_styp_flags): If SEC_COFF_SHARED_LIBRARY is
set, set STYP_NOLOAD.
* coffgen.c (coff_section_from_bfd_index): Don't get an assertion
failure because of a bad shared library.
+Tue May 10 14:23:43 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * section.c (SEC_COFF_SHARED_LIBRARY): Renamed from
+ SEC_SHARED_LIBRARY for clarity. Changed all uses.
+ * bfd-in2.h: Rebuilt.
+ * coffcode.h (sec_to_styp_flags): If SEC_COFF_SHARED_LIBRARY is
+ set, set STYP_NOLOAD.
+ * coffgen.c (coff_section_from_bfd_index): Don't get an assertion
+ failure because of a bad shared library.
+
Mon May 9 18:53:40 1994 Bill Cox (bill@rtl.cygnus.com)
* linker.c: Add missing comment terminator.
void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
+\f
+/* Externally visible ECOFF routines. */
-/* ECOFF linking routines. */
#if defined(__STDC__) || defined(ALMOST_STDC)
struct ecoff_debug_info;
struct ecoff_debug_swap;
struct symbol_cache_entry;
struct bfd_link_info;
#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));
+extern boolean bfd_ecoff_set_regmasks
+ PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
+ unsigned long *cprmask));
extern PTR bfd_ecoff_debug_init
PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
const struct ecoff_debug_swap *output_swap,
#define SEC_HAS_CONTENTS 0x200
/* An instruction to the linker to not output the section
- even if it has information which would normally be written. */
+ even if it has information which would normally be written. */
#define SEC_NEVER_LOAD 0x400
- /* The section is a shared library section. The linker must leave
- these completely alone, as the vma and size are used when
- the executable is loaded. */
-#define SEC_SHARED_LIBRARY 0x800
+ /* The section is a COFF shared library section. This flag is
+ only for the linker. If this type of section appears in
+ the input file, the linker must copy it to the output file
+ without changing the vma or size. FIXME: Although this
+ was originally intended to be general, it really is COFF
+ specific (and the flag was renamed to indicate this). It
+ might be cleaner to have some more general mechanism to
+ allow the back end to control what the linker does with
+ sections. */
+#define SEC_COFF_SHARED_LIBRARY 0x800
/* The section is a common section (symbols may be defined
multiple times, the value of a symbol is the amount of
}
#ifdef STYP_NOLOAD
- if (sec_flags & SEC_NEVER_LOAD)
+ if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0)
styp_flags |= STYP_NOLOAD;
#endif
if (styp_flags & STYP_TEXT)
{
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;
}
else if (styp_flags & STYP_DATA)
{
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;
}
{
#ifdef BSS_NOLOAD_IS_SHARED_LIBRARY
if (sec_flags & SEC_NEVER_LOAD)
- sec_flags |= SEC_ALLOC | SEC_SHARED_LIBRARY;
+ sec_flags |= SEC_ALLOC | SEC_COFF_SHARED_LIBRARY;
else
#endif
sec_flags |= SEC_ALLOC;
coffsymbol (section->symbol)->native =
(combined_entry_type *) bfd_zalloc (abfd,
sizeof (combined_entry_type) * 10);
+
+#ifdef COFF_SPARC
+ /* This is to allow double-word operations on addresses in data or bss. */
+ if (strcmp (section->name, ".data") == 0
+ || strcmp (section->name, ".bss") == 0)
+ section->alignment_power = 3;
+#endif /* COFF_SPARC */
+
return true;
}
break;
#endif
-#ifdef SHMAGIC
- case SHMAGIC:
+#ifdef SH_ARCH_MAGIC
+ case SH_ARCH_MAGIC:
arch = bfd_arch_sh;
machine = 0;
break;
#ifdef SPARCMAGIC
case SPARCMAGIC:
+#ifdef LYNXCOFFMAGIC
+ case LYNXCOFFMAGIC:
+#endif
arch = bfd_arch_sparc;
machine = 0;
break;
break;
#endif
-#ifdef SHMAGIC
+#ifdef SH_ARCH_MAGIC
case bfd_arch_sh:
- *magicp = SHMAGIC;
+ *magicp = SH_ARCH_MAGIC;
return true;
break;
#endif
{
unsigned dummy1;
unsigned short dummy2;
- bfd_default_set_arch_mach (abfd, arch, machine);
+
+ if (! bfd_default_set_arch_mach (abfd, arch, machine))
+ return false;
if (arch != bfd_arch_unknown &&
coff_set_flags (abfd, &dummy1, &dummy2) != true)
return false; /* We can't represent this type */
+
return true; /* We're easy ... */
}
/* At least on i386-coff, the line number count for a shared library
section must be ignored. */
- if ((return_section->flags & SEC_SHARED_LIBRARY) != 0)
+ if ((return_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
return_section->lineno_count = 0;
if (hdr->s_nreloc != 0)
}
/* Seek past the opt hdr stuff */
- bfd_seek(abfd, (file_ptr) (internal_f.f_opthdr + filhsz), SEEK_SET);
+ if (bfd_seek(abfd, (file_ptr) (internal_f.f_opthdr + filhsz), SEEK_SET)
+ != 0)
+ return NULL;
return coff_real_object_p(abfd, nscns, &internal_f,
(internal_f.f_opthdr != 0
return answer;
answer = answer->next;
}
- BFD_ASSERT(0);
- return &bfd_und_section; /* For gcc -W and lint. Never executed. */
+
+ /* We should not reach this point, but the SCO 3.2v4 /lib/libc_s.a
+ has a bad symbol table in biglitpow.o. */
+ return &bfd_und_section;
}
/* Get the upper bound of a COFF symbol table. */
bfd_byte buffer[4];
bfd_h_put_32 (abfd, size, buffer);
- bfd_write ((PTR) buffer, 1, sizeof (buffer), abfd);
+ if (bfd_write ((PTR) buffer, 1, sizeof (buffer), abfd) != sizeof (buffer))
+ return false;
for (p = abfd->outsymbols, i = 0;
i < limit;
i++, p++)
for (s = abfd->sections; s != (asection *) NULL; s = s->next) {
if (s->lineno_count) {
asymbol **q = abfd->outsymbols;
- bfd_seek(abfd, s->line_filepos, SEEK_SET);
+ if (bfd_seek(abfd, s->line_filepos, SEEK_SET) != 0)
+ return false;
/* Find all the linenumbers in this section */
while (*q) {
asymbol *p = *q;
out.l_lnno = 0;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out(abfd, &out, buff);
- bfd_write(buff, 1, linesz, abfd);
+ if (bfd_write(buff, 1, linesz, abfd) != linesz)
+ return false;
l++;
while (l->line_number) {
out.l_lnno = l->line_number;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out(abfd, &out, buff);
- bfd_write(buff, 1, linesz, abfd);
+ if (bfd_write(buff, 1, linesz, abfd) != linesz)
+ return false;
l++;
}
}
Then read debug section and reset the file pointer. */
position = bfd_tell (abfd);
- bfd_seek (abfd, sect->filepos, SEEK_SET);
- if (bfd_read (debug_section,
- bfd_get_section_size_before_reloc (sect), 1, abfd)
- != bfd_get_section_size_before_reloc(sect))
+ if (bfd_seek (abfd, sect->filepos, SEEK_SET) != 0
+ || (bfd_read (debug_section,
+ bfd_get_section_size_before_reloc (sect), 1, abfd)
+ != bfd_get_section_size_before_reloc(sect))
+ || bfd_seek (abfd, position, SEEK_SET) != 0)
return NULL;
- bfd_seek (abfd, position, SEEK_SET);
return debug_section;
}
else if (strcmp (section->name, _LIB) == 0)
{
/* An Irix 4 shared libary. */
- section->flags |= SEC_SHARED_LIBRARY;
+ 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
{