[PATCH] PR ld/16322: ld fails to generate GNU_RELRO segment

Alan Modra amodra@gmail.com
Thu Jan 9 04:13:00 GMT 2014


On Wed, Jan 08, 2014 at 06:01:49AM -0800, H.J. Lu wrote:
> >> +         /* If PT_LOAD segment doesn't fit PT_GNU_RELRO segment,
> >> +            adjust its p_filesz and p_memsz.  */

This is broken.  What if there is another LOAD segment following
the one you're adjusting?

> >>               if (expld.dataseg.base - (1 << max_alignment_power) < old_base)
> >>                 expld.dataseg.base += expld.dataseg.pagesize;
> >> -             expld.dataseg.base -= (1 << max_alignment_power);
> >> +             /* Properly align base to max_alignment_power.  */
> >> +             expld.dataseg.base &= ~((1 << max_alignment_power) - 1);
> >>               lang_reset_memory_regions ();
> >>               one_lang_size_sections_pass (relax, check_regions);

This also doesn't look correct to me.  Please explain why you think
this is a good idea.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list