qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Yeqi Fu" <fufuyqqqqqq@gmail.com>,
	richard.henderson@linaro.org, qemu-devel@nongnu.org,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Riku Voipio" <riku.voipio@iki.fi>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [RFC v2 1/6] build: Add configure options for native calls
Date: Mon, 12 Jun 2023 14:02:22 +0100	[thread overview]
Message-ID: <87ilbs7rwb.fsf@linaro.org> (raw)
In-Reply-To: <87mt147ue9.fsf@linaro.org>


Alex Bennée <alex.bennee@linaro.org> writes:

> Yeqi Fu <fufuyqqqqqq@gmail.com> writes:
>
>> Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
>> ---
>>  Makefile                            |  4 +++
>>  common-user/native/Makefile.include |  9 ++++++
>>  common-user/native/Makefile.target  | 22 +++++++++++++
>>  configure                           | 50 +++++++++++++++++++++++++++++
>>  docs/devel/build-system.rst         |  4 +++
>>  meson.build                         |  8 +++++
>>  meson_options.txt                   |  2 ++
>>  scripts/meson-buildoptions.sh       |  4 +++
>>  8 files changed, 103 insertions(+)
>>  create mode 100644 common-user/native/Makefile.include
>>  create mode 100644 common-user/native/Makefile.target
>>
>> diff --git a/Makefile b/Makefile
>> index 3c7d67142f..923da109bf 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -185,6 +185,10 @@ SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet)
>>  
>>  include $(SRC_PATH)/tests/Makefile.include
>>  
>> +ifeq ($(CONFIG_USER_NATIVE),y)
>> +	include $(SRC_PATH)/common-user/native/Makefile.include
>> +endif
>> +
>>  all: recurse-all
>>  
>>  ROMS_RULES=$(foreach t, all clean distclean, $(addsuffix /$(t), $(ROMS)))
>> diff --git a/common-user/native/Makefile.include b/common-user/native/Makefile.include
>> new file mode 100644
>> index 0000000000..40d20bcd4c
>> --- /dev/null
>> +++ b/common-user/native/Makefile.include
>> @@ -0,0 +1,9 @@
>> +.PHONY: build-native
>> +build-native: $(NATIVE_TARGETS:%=build-native-library-%)
>> +$(NATIVE_TARGETS:%=build-native-library-%): build-native-library-%:
>> +	$(call quiet-command, \
>> +	    $(MAKE) -C common-user/native/$* $(SUBDIR_MAKEFLAGS), \
>> +	"BUILD","$* native library")
>> +# endif
>> +
>> +all: build-native
>
> I think it would be better if we could add the targets via meson and let
> it deal with the multiple versions. I will defer to Paolo on how to do
> this though.

OK Paolo said we won't expose cross compilers to meson so we are stuck
with pure makefiles for now... however:

<snip>
>> +
>> +(config_host_mak=common-user/native/config-host.mak
>> +mkdir -p common-user/native
>> +echo "# Automatically generated by configure - do not modify" > $config_host_mak
>> +echo "SRC_PATH=$source_path" >> $config_host_mak
>> +echo "HOST_CC=$host_cc" >> $config_host_mak
>> +
>> +native_targets=
>> +for target in $target_list; do
>> +  arch=${target%%-*}
>> +
>> +  case $target in
>> +    *-linux-user|*-bsd-user)
>> +    if probe_target_compiler $target || test -n "$container_image"; then
>> +        mkdir -p "common-user/native/$target"
>> +        config_target_mak=common-user/native/$target/config-target.mak
>> +        ln -sf "$source_path/common-user/native/Makefile.target" "common-user/native/$target/Makefile"
>> +        echo "# Automatically generated by configure - do not modify" > "$config_target_mak"
>> +        echo "TARGET_NAME=$arch" >> "$config_target_mak"
>> +        echo "TARGET=$target" >> "$config_target_mak"
>> +        eval "target_native_flag=\${native_flag_$target_arch}"
>> +        target_cflags="$target_cflags $target_native_flag"
>> +        write_target_makefile "build-native-library-$target" >> "$config_target_mak"
>> +        native_targets="$native_targets $target"
>> +    fi
>> +  ;;
>> +  esac
>> +done
>
> This is basically replicating what we already have in
> tests/tcg/FOO-linux-user/config-target.mak. I would suggest moving those
> into a common location ($BUILD/targets/foo/compiler.mak) and then fixing
> up TCG tests to use the new location. When you add the native libs you
> can use the same configs.

This should be merged with the existing config_target code.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-06-12 13:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 16:47 [RFC v2 0/6] Native Library Calls Yeqi Fu
2023-06-07 16:47 ` [RFC v2 1/6] build: Add configure options for native calls Yeqi Fu
2023-06-09  5:08   ` Manos Pitsidianakis
2023-06-12 11:54   ` Alex Bennée
2023-06-12 13:02     ` Alex Bennée [this message]
2023-06-07 16:47 ` [RFC v2 2/6] Add the libnative library Yeqi Fu
2023-06-15  7:59   ` Alex Bennée
2023-06-07 16:47 ` [RFC v2 3/6] target/i386: Add native library calls Yeqi Fu
2023-06-07 19:08   ` Richard Henderson
2023-06-07 19:19   ` Richard Henderson
2023-06-07 16:47 ` [RFC v2 4/6] target/mips: " Yeqi Fu
2023-06-07 19:15   ` Richard Henderson
2023-06-07 16:47 ` [RFC v2 5/6] target/arm: " Yeqi Fu
2023-06-07 16:47 ` [RFC v2 6/6] linux-user: Add '-native-bypass' option Yeqi Fu
2023-06-09  5:24   ` Manos Pitsidianakis
2023-06-12 13:06     ` Alex Bennée
2023-06-12 13:23   ` Alex Bennée

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=87ilbs7rwb.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=fufuyqqqqqq@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=riku.voipio@iki.fi \
    --cc=thuth@redhat.com \
    /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).