[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: disable-pie build
From: |
Volker Rümelin |
Subject: |
Re: disable-pie build |
Date: |
Sat, 11 Nov 2023 21:09:23 +0100 |
User-agent: |
Mozilla Thunderbird |
Am 11.11.23 um 17:09 schrieb Paolo Bonzini:
> On Sat, Nov 11, 2023 at 3:40 AM Michael Tokarev <mjt@tls.msk.ru> wrote:
>> Hi!
>>
>> It looks like --disable-pie configure, which uses -fno-pie -no-pie flags
>> for the compiler, is broken: it does not not tell the *linker* about the
>> option, so the link fails (at least on debian bookworm):
> Looks good, if you can send a patch perhaps Stefan can apply it (or
> someone else can handle it in my stead, because I'm away next week).
>
> Paolo
No, this doesn't look good. This patch again breaks the native Windows
build with MSYS2 and mingw64 cross compile probably too.
See
https://gitlab.com/qemu-project/qemu/-/issues/1664
https://lore.kernel.org/qemu-devel/20230522080816.66320-1-pbonzini@redhat.com/
https://lore.kernel.org/qemu-devel/20230523073029.19549-1-pbonzini@redhat.com/
and the big comment above the changed lines in meson.build.
With best regards,
Volker
>> /usr/bin/ld: libcommon.fa.p/hw_core_cpu-common.c.o: relocation R_X86_64_32
>> against `.rodata' can not be used when making a PIE object; recompile with
>> -fPIE
>> /usr/bin/ld: failed to set dynamic section sizes: bad value
>>
>> This is failing for *all* executables, including tests, qemu-img, etc.
>>
>> The following change fixes it:
>>
>> diff --git a/meson.build b/meson.build
>> index a9c4f28247..0b7ca45d48 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -278,7 +278,8 @@ endif
>> # tries to build an executable instead of a shared library and fails. So
>> # don't add -no-pie anywhere and cross fingers. :(
>> if not get_option('b_pie')
>> - qemu_common_flags += cc.get_supported_arguments('-fno-pie', '-no-pie')
>> + qemu_common_flags += cc.get_supported_arguments('-fno-pie')
>> + qemu_ldflags += cc.get_supported_arguments('-no-pie')
>> endif
>>
>> if not get_option('stack_protector').disabled()