Re: [PATCH v3 16/27] compiler: Option to add PROVIDE_HIDDEN replacement for weak symbols

Randy Dunlap
2018-05-23T21:16:11Z

On 05/23/2018 12:54 PM, Thomas Garnier wrote:
> Provide an option to have a PROVIDE_HIDDEN (linker script) entry for
> each weak symbol. This option solve an error in x86_64 where the linker

solves

> optimizes pie generate code to be non-pie because --emit-relocs was used

generated

> instead of -pie (to reduce dynamic relocations).
>
> Signed-off-by: Thomas Garnier <thgarnie@google.com>
> ---
> init/Kconfig | 7 +++++++
> scripts/link-vmlinux.sh | 14 ++++++++++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index 0fc3a58d9f2f..2866cca86b4a 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1954,6 +1954,13 @@ config ASN1
> inform it as to what tags are to be expected in a stream and what
> functions to call on what tags.
>
> +config WEAK_PROVIDE_HIDDEN
> + bool
> + help
> + Generate linker script PROVIDE_HIDDEN entries for all weak symbols. It
> + allows to prevent non-pie code being replaced by the linker if the

non-PIE

> + emit-relocs option is used instead of pie (useful for x86_64 pie).

PIE PIE).

> +

--
~Randy