This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: LMA XXX Overlaps Previous Sections When Using PHDRS


Hi Anthony,

/opt/cross-tools/binutils-2.17-gcc-4.1.1-newlib-1.14.0/lib/gcc/i686-elf/
4.1.1/../../../../i686-elf/bin/ld: test.elf: section .section_0 lma
0x1000 overlaps previous sections

This is a bogus error message due to a spurious check in the linker. Please try the attached patch and let me know if you have any problems.


Cheers
  Nick

bfd/ChangeLog

2007-12-24 Nick Clifton <nickc@redhat.com>

	* elf.c (assign_file_positions_for_load_sections): Do not complain
	when then LMA is lower than the VMA.

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.426
diff -c -3 -p -r1.426 elf.c
*** bfd/elf.c	11 Dec 2007 13:13:59 -0000	1.426
--- bfd/elf.c	24 Dec 2007 17:18:50 -0000
*************** assign_file_positions_for_load_sections 
*** 4339,4357 ****
  		      && ((this_hdr->sh_flags & SHF_TLS) == 0
  			  || p->p_type == PT_TLS)))
  		{
! 		  if (adjust < 0)
  		    {
! 		      (*_bfd_error_handler)
! 			(_("%B: section %A lma 0x%lx overlaps previous sections"),
! 			 abfd, sec, (unsigned long) sec->lma);
! 		      adjust = 0;
! 		    }
! 		  p->p_memsz += adjust;
  
! 		  if (this_hdr->sh_type != SHT_NOBITS)
! 		    {
! 		      off += adjust;
! 		      p->p_filesz += adjust;
  		    }
  		}
  	    }
--- 4339,4353 ----
  		      && ((this_hdr->sh_flags & SHF_TLS) == 0
  			  || p->p_type == PT_TLS)))
  		{
! 		  if (adjust > 0)
  		    {
! 		      p->p_memsz += adjust;
  
! 		      if (this_hdr->sh_type != SHT_NOBITS)
! 			{
! 			  off += adjust;
! 			  p->p_filesz += adjust;
! 			}
  		    }
  		}
  	    }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]