This is the mail archive of the binutils@sources.redhat.com 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: PATCH: Fix removed sections (Re: 2.12.90.0.12 Kernel Miscompile)


"Leonard N. Zubkoff" <lnz@dandelion.com> writes:
> From looking at the source code, I suspect that the problem lies with resolving
> __start___ex_table or __stop___ex_table-1.

Leonard, thanks for reducing the test case.

The problem was that we didn't set os->region->current for the removed
sections, but left os->bfd_section non-null.  So this code in
lang_do_assignments() still triggered:

	    if (os->bfd_section != NULL)
	      {
		dot = os->bfd_section->vma;
		(void) lang_do_assignments (os->children.head, os,
					    os->fill, dot);
		dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;

	      }

effectively setting "." to 0.  The patch below fixes the test case,
and shows no regressions on i686-pc-linux-gnu.  FWIW, I don't mind
whether we go with this patch or HJ's.

I'll test some other targets in a minute, and try to come up with
a dejagnu version of the test case.

Richard

        * ldlang.c (lang_size_sections_1): Clear os->bfd_section when
        skipping a removed section.

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.91
diff -c -p -d -r1.91 ldlang.c
*** ld/ldlang.c	1 Jul 2002 08:07:29 -0000	1.91
--- ld/ldlang.c	3 Jul 2002 18:03:29 -0000
*************** lang_size_sections_1 (s, output_section_
*** 2909,2915 ****
  	    if (!link_info.relocateable
  		&& (bfd_get_section_flags (output_bfd, os->bfd_section)
  		    & SEC_EXCLUDE) != 0)
! 	      break;
  
  	    /* If this is a COFF shared library section, use the size and
  	       address from the input section.  FIXME: This is COFF
--- 2909,2918 ----
  	    if (!link_info.relocateable
  		&& (bfd_get_section_flags (output_bfd, os->bfd_section)
  		    & SEC_EXCLUDE) != 0)
! 	      {
! 		os->bfd_section = 0;
! 		break;
! 	      }
  
  	    /* If this is a COFF shared library section, use the size and
  	       address from the input section.  FIXME: This is COFF




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