size_input_section calcs output_offset incorrectly for merged sections

Michael Eager
Mon Jan 7 17:23:00 GMT 2008

I'm seeing a problem in size_input_section() when it
processes a merged section.  If the merged section is to
be included in the output, the output_offset value is
computed as:

    i->output_offset = dot - output_section_statement->bfd_section->vma;

If the section has been eliminated and is marked as SEC_EXCLUDE,
the section's output_offset value is computed as:

   i->output_offset = i->vma - output_section_statement->bfd_section->vma;

i->vma is zero, which results in output_offset being the inverse
of the output vma.  Later, during relaxation, output_offset is
added to vma resulting in an incorrect symbol address of zero.

It seems to me that output_offset should be the same in both
cases.  I've run a couple tests which work with this change.

Does this seem correct?

Michael Eager
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

More information about the Binutils mailing list