This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/14215: ld creates bad GNU_RELRO segment
On Sun, Jun 10, 2012 at 4:30 PM, Alan Modra <amodra@gmail.com> wrote:
> On Sun, Jun 10, 2012 at 06:52:42AM -0700, H.J. Lu wrote:
>> > We should check if .got.plt section exists before putting the first N
>> > bytes in PT_GNU_RELRO segment.
>
> Hard coding .got.plt into DATA_SEGMENT_RELRO_END evaluation isn't
> really nice. ?How about doing the size test in the script instead?
> Since .got.plt is after the occurrence of DATA_SEGMENT_RELRO_END, we
> just need to allow forward references when evaluating SIZEOF. ?This
> should be OK now that we always run a preliminary section sizing pass
> for strip_excluded_output_sections.
>
> I haven't given this patch much of a test. ?Please try it out and
> commit if you think the idea is good.
>
> ? ? ? ?PR ld/14215
> ? ? ? ?* ldexp.c (fold_name <SIZEOF, ALIGNOF>): Allow forward section
> ? ? ? ?references.
> ? ? ? ?* emulparams/elf32_x86_64.sh (SEPARATE_GOTPLT): Depend on size of
> ? ? ? ?.got.plt.
> ? ? ? ?* emulparams/elf32mb_linux.sh (SEPARATE_GOTPLT): Likewise.
> ? ? ? ?* emulparams/elf32tilegx.sh (SEPARATE_GOTPLT): Likewise.
> ? ? ? ?* emulparams/elf32tilepro.sh (SEPARATE_GOTPLT): Likewise.
> ? ? ? ?* emulparams/elf64tilegx.sh (SEPARATE_GOTPLT): Likewise.
> ? ? ? ?* emulparams/elf_i386.sh (SEPARATE_GOTPLT): Likewise.
> ? ? ? ?* emulparams/elf_k1om.sh (SEPARATE_GOTPLT): Likewise.
> ? ? ? ?* emulparams/elf_l1om.sh (SEPARATE_GOTPLT): Likewise.
> ? ? ? ?* emulparams/elf_x86_64.sh (SEPARATE_GOTPLT): Likewise.
>
It works. I checked it in together with my testcases.
Thanks.
--
H.J.