[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH] rules.mak: Use -r instead of -Wl, -r to fix b

From: Paolo Bonzini
Subject: Re: [Qemu-trivial] [PATCH] rules.mak: Use -r instead of -Wl, -r to fix building when PIE is default
Date: Mon, 28 Nov 2016 16:38:50 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 28/11/2016 16:24, Adrian Bunk wrote:
> On Mon, Nov 28, 2016 at 04:05:33PM +0100, Paolo Bonzini wrote:
>> On 27/11/2016 17:28, Adrian Bunk wrote:
>>> Building qemu fails in distributions where gcc enables PIE
>>> by default (e.g. Debian unstable) with:
>>> /usr/bin/ld: -r and -pie may not be used together
>>> -r and -pie cannot be used together in the linker,
>>> and position independent is already relocatable.
>>> Use -r instead of -Wl,-r to avoid gcc passing -r to the
>>> linker when PIE is enabled.
>>> Signed-off-by: Adrian Bunk <address@hidden>
>> I think this is a bug in the linker.  If the linker is producing
>> relocatable objects by default, it has no reason to refuse -r.  Have you
>> tried asking the binutils folks about it too?
> The linker knows nothing about this default, gcc is passing -pie
> to the linker.

The linker is receiving "-r -pie".  It can satisfy the requirement of
producing a relocatable object by discarding the "-r", but it doesn't.
That'd be a linker bug.

But in fact ELF makes PIE ET_DYN and relocatable ET_REL.  That would
make the linker error the right thing, but then I don't understand what
you mean by "position independent is already relocatable".


reply via email to

[Prev in Thread] Current Thread [Next in Thread]