Treat special MIPS common sections as common

Nick Clifton nickc@redhat.com
Tue Jul 18 08:56:00 GMT 2006


Hi Guys,

  I am checking in a patch that has been in my local sources for a
  little while.  It adds code so that the special MIPS sections
  SHN_MIPS_ACOMMON and SHN_MIPS_SCOMMON are treated as common sections
  by the BFD library.  This is necessary in order for the correct
  alignment of these sections when they are partially linked.

Cheers
  Nick

bfd/ChangeLog
2006-07-18  Nick Clifton  <nickc@redhat.com>

	* elfxx-mips.c (_bfd_mips_elf_common_definition): New function.
	Consider SHN_MIPS_ACOMMON and SHN_MIPS_SCOMMON as being common
	sections.
	* elfxx-mips.h 	(_bfd_mips_elf_common_definition): Prototype.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.174
diff -c -3 -p -r1.174 elfxx-mips.c
*** bfd/elfxx-mips.c	20 Jun 2006 02:22:13 -0000	1.174
--- bfd/elfxx-mips.c	18 Jul 2006 08:52:38 -0000
*************** _bfd_mips_elf_ignore_undef_symbol (struc
*** 11128,11130 ****
--- 11128,11138 ----
  {
    return ELF_MIPS_IS_OPTIONAL (h->other) ? TRUE : FALSE;
  }
+ 
+ bfd_boolean
+ _bfd_mips_elf_common_definition (Elf_Internal_Sym *sym)
+ {
+   return (sym->st_shndx == SHN_COMMON
+ 	  || sym->st_shndx == SHN_MIPS_ACOMMON
+ 	  || sym->st_shndx == SHN_MIPS_SCOMMON);
+ }
Index: bfd/elfxx-mips.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.h,v
retrieving revision 1.34
diff -c -3 -p -r1.34 elfxx-mips.h
*** bfd/elfxx-mips.h	19 Jun 2006 13:17:43 -0000	1.34
--- bfd/elfxx-mips.h	18 Jul 2006 08:52:38 -0000
*************** extern bfd_boolean _bfd_mips_elf_ignore_
*** 142,147 ****
--- 142,150 ----
  
  extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections [];
  
+ extern bfd_boolean _bfd_mips_elf_common_definition (Elf_Internal_Sym *);
+ 
+ #define elf_backend_common_definition   _bfd_mips_elf_common_definition
  #define elf_backend_name_local_section_symbols \
    _bfd_mips_elf_name_local_section_symbols
  #define elf_backend_special_sections _bfd_mips_elf_special_sections



More information about the Binutils mailing list