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: PATCH: PR ld/4504: Copy relocation doesn't preserve section alignment


On Tue, May 15, 2007 at 06:46:20AM -0700, H. J. Lu wrote:
> +  orig_power_of_two = bfd_get_section_alignment (sec->owner, sec);
> +
> +  if (orig_power_of_two > power_of_two)
> +    {
> +      /* Adjust the section alignment if needed.  */
> +      if (! bfd_set_section_alignment (dynbss->owner, dynbss,
> +				       orig_power_of_two))
> +	return FALSE;
> +    }
> +
> +  /* We make sure that the symbol will be aligned properly.  Since we
> +     don't know its alignment requirement, we start with the maximum
> +     alignment and check low bits of the symbol address for the
> +     minimum alignment.  */
> +  mask = ((bfd_vma) 1 << orig_power_of_two) - 1;
> +  while ((h->root.u.def.value & mask) != 0)
> +    {
> +       mask >>= 1;
> +       --orig_power_of_two;
> +    }

You didn't put this loop where I suggested, before setting .dynbss
alignment.  Why?  There is no need to align .dynbss more than the
required symbol alignment.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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