+Tue Jan 26 11:43:14 1993 Ian Lance Taylor (ian@cygnus.com)
+
+ * section.c (SEC_IS_COMMON): New section flag, needed for MIPS
+ ECOFF which has two common sections.
+ (bfd_com_section): Set SEC_IS_COMMON flag.
+ * bfd-in.h (bfd_is_com_section): New macro to test SEC_IS_COMMON.
+ * aoutx.h, archive.c, bout.c, coff-a29k.c, coff-m88k.c,
+ coff-mips.c, coffgen.c, ieee.c, oasys.c, reloc.c, syms.: Use
+ bfd_is_com_section macro rather than checking for equality to
+ bfd_com_section.
+
Mon Jan 25 15:27:36 1993 Ian Lance Taylor (ian@cygnus.com)
* coffcode.h (_bfd_coff_mkobject_hook): Pass aouthdr argument.
{
sym_pointer->e_type[0] = (N_UNDF | N_EXT);
}
- else if (bfd_get_output_section(cache_ptr) == &bfd_com_section) {
+ else if (bfd_is_com_section (bfd_get_output_section (cache_ptr))) {
sym_pointer->e_type[0] = (N_UNDF | N_EXT);
}
else {
*/
- if (output_section == &bfd_com_section
+ if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
|| output_section == &bfd_und_section)
{
check for that here
*/
- if (output_section == &bfd_com_section
+ if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
|| output_section == &bfd_und_section)
{
/* now the fun stuff */
if (abfd->xvec->header_byteorder_big_p != false) {
- r_index = ( ((int) bytes->r_index[0] << 16)
- | ((int) bytes->r_index[1] << 8)
- | (int) bytes->r_index[2]);
+ r_index = (bytes->r_index[0] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[2];
r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG));
r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG)
>> RELOC_EXT_BITS_TYPE_SH_BIG;
} else {
- r_index = ( ((int) bytes->r_index[2] << 16)
- | ((int) bytes->r_index[1] << 8)
- | (int) bytes->r_index[0]);
+ r_index = (bytes->r_index[2] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[0];
r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
>> RELOC_EXT_BITS_TYPE_SH_LITTLE;
/* now the fun stuff */
if (abfd->xvec->header_byteorder_big_p != false) {
- r_index = ( ((int) bytes->r_index[0] << 16)
- | ((int) bytes->r_index[1] << 8)
- | (int) bytes->r_index[2]);
+ r_index = (bytes->r_index[0] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[2];
r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG));
r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
>> RELOC_STD_BITS_LENGTH_SH_BIG;
} else {
- r_index = ( ((int) bytes->r_index[2] << 16)
- | ((int) bytes->r_index[1] << 8)
- | (int) bytes->r_index[0]);
+ r_index = (bytes->r_index[2] << 16)
+ | (bytes->r_index[1] << 8)
+ | bytes->r_index[0];
r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE));
cache_ptr->howto = 0;
if (abfd->xvec->header_byteorder_big_p)
{
- symnum = ((int) raw[4] << 16) | ((int) raw[5] << 8) | (int) raw[6];
+ symnum = (raw[4] << 16) | (raw[5] << 8) | raw[6];
}
else
{
- symnum = ((int) raw[6] << 16) | ((int) raw[5] << 8) | (int) raw[4];
+ symnum = (raw[6] << 16) | (raw[5] << 8) | raw[4];
}
if (raw[7] & extern_mask)
if (r_idx != 0)
/* already mucked with r_extern, r_idx */;
- else if (output_section == &bfd_com_section
+ else if (bfd_is_com_section (output_section)
|| output_section == &bfd_abs_section
|| output_section == &bfd_und_section)
{
{
long relocation = 0;
- if (symbol->section == &bfd_com_section)
+ if (bfd_is_com_section (symbol->section))
{
relocation = 0;
}
section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
else if (strcmp (section->name, _BSS) == 0
|| strcmp (section->name, _SBSS) == 0)
- section->flags |= SEC_ALLOC;
+ section->flags |= SEC_ALLOC | SEC_IS_COMMON;
/* Probably any other section name is SEC_NEVER_LOAD, but I'm
uncertain about .init on some systems and I don't know how shared
asym->value -= asym->section->vma;
break;
case scSBss:
- /* FIXME: putting global .sbss symbols in the common section is
- wrong, because it means they may not be accessible via the gp
- register. But the linker checks the section a symbol is in
- rather than checking the flags. */
- if (ext)
- asym->section = &bfd_com_section;
- else
- {
- asym->section = bfd_make_section_old_way (abfd, ".sbss");
- asym->value -= asym->section->vma;
- }
+ asym->section = bfd_make_section_old_way (abfd, ".sbss");
+ asym->value -= asym->section->vma;
break;
case scRData:
asym->section = bfd_make_section_old_way (abfd, ".rdata");
asym->flags = BSF_DEBUGGING;
break;
case scCommon:
- case scSCommon:
asym->section = &bfd_com_section;
break;
+ case scSCommon:
+ asym->section = bfd_make_section_old_way (abfd, ".sbss");
+ asym->value -= asym->section->vma;
+ break;
case scVarRegister:
case scVariant:
asym->flags = BSF_DEBUGGING;
BFD_ASSERT (rello->howto->type == ECOFF_R_REFLO
&& *rello->sym_ptr_ptr == *reloc_entry->sym_ptr_ptr);
- if (symbol->section == &bfd_com_section)
+ if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
}
}
- if (symbol->section == &bfd_com_section)
+ if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
SYMR sym;
ecoff_swap_sym_in (input_bfd, esym_ptr->native.lnative, &sym);
- if (esym_ptr->symbol.section != &bfd_com_section
+ if (! bfd_is_com_section (esym_ptr->symbol.section)
&& (esym_ptr->symbol.flags & BSF_DEBUGGING) == 0
&& esym_ptr->symbol.section != &bfd_und_section)
sym.value = (esym_ptr->symbol.value
esym.asym.iss = symhdr->issExtMax;
- if (sym_ptr->section == &bfd_com_section
+ if (bfd_is_com_section (sym_ptr->section)
|| sym_ptr->section == &bfd_und_section)
esym.asym.value = sym_ptr->value;
else