qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 2/2] Build *-user targets as PIE


From: Kirill A. Shutemov
Subject: [Qemu-devel] Re: [PATCH 2/2] Build *-user targets as PIE
Date: Wed, 2 Sep 2009 21:59:46 +0300

On Wed, Sep 2, 2009 at 8:34 PM, Juan Quintela<address@hidden> wrote:
> "Kirill A. Shutemov" <address@hidden> wrote:
>> Now we can drop link hack for i386 and fix text relocations on i386 host.
>>
>> Signed-off-by: Kirill A. Shutemov <address@hidden>
>
> Some comments.
>
> This patch moves files from being compiled only once (in Makefile),
> to be compiled for aech target.
>
>> ---
>>  Makefile          |   10 +---------
>>  Makefile.target   |   19 +++++++++++++++----
>>  configure         |   17 ++++++-----------
>>  linux-user/main.c |   20 --------------------
>>  4 files changed, 22 insertions(+), 44 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index bdac9b3..634ea81 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -39,8 +39,6 @@ subdir-%:
>>       $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" 
>> TARGET_DIR="$*/" all,)
>>
>>  $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
>> -$(filter %-user,$(SUBDIR_RULES)): libqemu_user.a
>> -
>>
>>  ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
>>  romsubdir-%:
>> @@ -74,7 +72,7 @@ block-obj-y +=  $(addprefix block/, $(block-nested-y))
>>  # CPUs and machines.
>>
>>  obj-y = $(block-obj-y)
>> -obj-y += readline.o console.no host-utils.o
>> +obj-y += readline.o console.o
>
> What is the problem here? libqemu_common.o is not used for *-user targets?

No.

We need all object files for *-user built with -fpie. For softmmu they
build without
it.

>>
>> +ifdef CONFIG_USER_ONLY
>> +# hack to compile with -fpie for *-user targets
>> +obj-y += cutils-user.o cache-utils-user.o
>> +cutils-user.c cache-utils-user.c:
>> +     @echo "  LN     $(TARGET_DIR)$@"
>> +     @ln -s $(SRC_PATH)/$(@:%-user.c=%.c) $@
>> +endif
>
> Why is this needed?  Why cutils.o/cache-utils.o is not enough?
>
> I thought that:
>
> obj-$(CONFIG_USER_ONLY) += cutils.o cache-utils.o
>
> should be enough here.  Why is needed the link?

We need to build it with -fpie. Without symlink it will be linked with
cutils.o and
cache-utils.o which was built for softmmu without -fpie and we will get text
relocation in executable.




reply via email to

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