From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Juan Quintela <quintela@trasno.org>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 2/2] Build *-user targets as PIE
Date: Wed, 2 Sep 2009 21:59:46 +0300 [thread overview]
Message-ID: <cc557aab0909021159i348abb6bw546dfbe9b4bf262d@mail.gmail.com> (raw)
In-Reply-To: <m3iqg1ckts.fsf@neno.mitica>
On Wed, Sep 2, 2009 at 8:34 PM, Juan Quintela<quintela@trasno.org> wrote:
> "Kirill A. Shutemov" <kirill@shutemov.name> wrote:
>> Now we can drop link hack for i386 and fix text relocations on i386 host.
>>
>> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
>
> 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.
prev parent reply other threads:[~2009-09-02 18:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 15:21 [Qemu-devel] [PATCH 1/2] Do not link *-user target with libhw*.a Kirill A. Shutemov
2009-09-02 15:21 ` [Qemu-devel] [PATCH 2/2] Build *-user targets as PIE Kirill A. Shutemov
2009-09-02 14:24 ` [Qemu-devel] " Paolo Bonzini
2009-09-02 14:35 ` Kirill A. Shutemov
2009-09-02 15:46 ` [Qemu-devel] " Arnaud Patard
2009-09-02 15:52 ` Kirill A. Shutemov
2009-09-02 16:03 ` Arnaud Patard
2009-09-03 12:15 ` [Qemu-devel] [PATCH v2] " Kirill A. Shutemov
2009-09-03 12:00 ` Reimar Döffinger
2009-09-03 14:21 ` Kirill A. Shutemov
2009-09-03 14:38 ` Paul Brook
2009-09-03 14:52 ` [Qemu-devel] " Paolo Bonzini
2009-09-03 15:07 ` [Qemu-devel] " Kirill A. Shutemov
2009-09-03 17:17 ` Reimar Döffinger
2009-09-04 4:33 ` Kirill A. Shutemov
2009-09-04 7:51 ` Reimar Döffinger
2009-09-04 8:03 ` Kirill A. Shutemov
[not found] ` <m3ws4g9qqe.fsf@neno.mitica>
2009-09-03 12:51 ` [Qemu-devel] " Kirill A. Shutemov
2009-09-03 14:39 ` [Qemu-devel] " Paul Brook
2009-09-03 15:08 ` Kirill A. Shutemov
2009-09-02 18:54 ` [Qemu-devel] [PATCH 2/2] " Riku Voipio
[not found] ` <m3iqg1ckts.fsf@neno.mitica>
2009-09-02 18:59 ` Kirill A. Shutemov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc557aab0909021159i348abb6bw546dfbe9b4bf262d@mail.gmail.com \
--to=kirill@shutemov.name \
--cc=qemu-devel@nongnu.org \
--cc=quintela@trasno.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).