[PATCH] powerpc/boot: request no dynamic linker for boot wrapper

Michael Ellerman mpe at ellerman.id.au
Mon Nov 28 22:07:39 AEDT 2016


Nicholas Piggin <npiggin at gmail.com> writes:

> The boot wrapper performs its own relocations and does not require
> PT_INTERP segment.
>
> Without this option, binutils 2.28 and newer tries to create a program
> header segment due to PT_INTERP, and the link fails because there is no
> space for it.

2.28 is not released yet though is it?

So can we just declare versions with that behaviour broken?

> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
> index 404b3aa..cd941a8 100755
> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -181,6 +181,13 @@ case "$elfformat" in
>      elf32-powerpc)	format=elf32ppc	;;
>  esac
>  
> +# Do not include PT_INTERP segment when linking pie. Non-pie linking
> +# just ignores this option.
> +LD_VERSION=$(${CROSS}ld --version | $srctree/scripts/ld-version.sh)
> +LD_NO_DL_MIN_VERSION=$(echo 2.26 | $srctree/scripts/ld-version.sh)
> +if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VERSION" ] ; then
> +	nodl="--no-dynamic-linker"
> +fi

Some distros (RHEL at least?), ship the wrapper as a standalone script.
So I don't think we can call things in $srctree. Or at least I don't
know how that's supposed to work when it's shipped standalone.

We're also basically reinventing ld-option, which is a PITA.

cheers


More information about the Linuxppc-dev mailing list