> Date: Sat, 6 Aug 2016 20:27:24 -0700
> From: Philip Guenther <[email protected]>
>
> powerpc has two models of GOT+PLT placement: secure PLT (the new default)
> and BSS PLT. ld handles the two possibilities in linker scripts by
> including both locations in the script, but putting a constraint "SPECIAL"
> on them, ala:
> .plt : SPECIAL { *(.plt) }
>
> As part of my RELRO hacking, I tried moving the padding logic *into* one
> of those output sections and it worked Just Fine...until I used the -M
> option to dump the link map, at which point the -M logic exploded because
> it expected stuff to have been filled in by the Real Logic of ld, but it
> was skipped because of the SPECIAL constraint.
>
> So, diff below teachs ld -M to skip sections which the Real Logic of ld
> skips because of constraints.
>
> A solution to this isn't required immediately, but will be for RELRO to
> work on powerpc.
>
> ok?
ok kettenis@
> Index: gnu/usr.bin/binutils-2.17/ld/ldlang.c
> ===================================================================
> RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/ld/ldlang.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 ldlang.c
> --- gnu/usr.bin/binutils-2.17/ld/ldlang.c 31 May 2016 17:05:04 -0000
> 1.4
> +++ gnu/usr.bin/binutils-2.17/ld/ldlang.c 7 Aug 2016 03:18:37 -0000
> @@ -3292,6 +3292,9 @@ print_output_section_statement
> asection *section = output_section_statement->bfd_section;
> int len;
>
> + if (output_section_statement->constraint == -1)
> + return;
> +
> if (output_section_statement != abs_output_section)
> {
> minfo ("\n%s", output_section_statement->name);
>
>