add darwin-user-* to config script

This commit is contained in:
tehzz 2020-04-03 14:46:22 -04:00
parent 6d7d1fde2f
commit 985d4e97f5
8 changed files with 84 additions and 19 deletions

View File

@ -129,6 +129,19 @@ obj-y += gdbstub.o
endif #CONFIG_BSD_USER endif #CONFIG_BSD_USER
#########################################################
# macOS user emulator target
ifdef CONFIG_DARWIN_USER
QEMU_CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ABI_DIR) \
-I$(SRC_PATH)/darwin-user/$(HOST_VARIANT_DIR)
obj-y += darwin-user/
obj-y += gdbstub.o
endif #CONFIG_DARWIN_USER
######################################################### #########################################################
# System emulator target # System emulator target
ifdef CONFIG_SOFTMMU ifdef CONFIG_SOFTMMU

81
configure vendored
View File

@ -249,6 +249,12 @@ supported_target() {
return 1 return 1
fi fi
;; ;;
*-darwin-user)
if test "$darwin" != "yes"; then
print_error "Target '$target' is only available on a Darwin host"
return 1
fi
;;
*) *)
print_error "Invalid target name '$target'" print_error "Invalid target name '$target'"
return 1 return 1
@ -390,6 +396,7 @@ cocoa="no"
softmmu="yes" softmmu="yes"
linux_user="no" linux_user="no"
bsd_user="no" bsd_user="no"
darwin_user="no"
blobs="yes" blobs="yes"
pkgversion="" pkgversion=""
pie="" pie=""
@ -766,6 +773,7 @@ OpenBSD)
Darwin) Darwin)
bsd="yes" bsd="yes"
darwin="yes" darwin="yes"
darwin_user="yes"
hax="yes" hax="yes"
hvf="yes" hvf="yes"
LDFLAGS_SHARED="-bundle -undefined dynamic_lookup" LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
@ -1119,6 +1127,7 @@ for opt do
--disable-user) --disable-user)
linux_user="no" ; linux_user="no" ;
bsd_user="no" ; bsd_user="no" ;
darwin_user="no" ;
;; ;;
--enable-user) ;; --enable-user) ;;
--disable-linux-user) linux_user="no" --disable-linux-user) linux_user="no"
@ -1129,6 +1138,10 @@ for opt do
;; ;;
--enable-bsd-user) bsd_user="yes" --enable-bsd-user) bsd_user="yes"
;; ;;
--disable-darwin-user) darwin_user="no"
;;
--enable-darwin-user) darwin_user="yes"
;;
--enable-pie) pie="yes" --enable-pie) pie="yes"
;; ;;
--disable-pie) pie="no" --disable-pie) pie="no"
@ -1439,6 +1452,7 @@ QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
if [ "$ARCH" = "unknown" ]; then if [ "$ARCH" = "unknown" ]; then
bsd_user="no" bsd_user="no"
linux_user="no" linux_user="no"
darwin_user="no"
fi fi
default_target_list="" default_target_list=""
@ -1454,6 +1468,10 @@ fi
if [ "$bsd_user" = "yes" ]; then if [ "$bsd_user" = "yes" ]; then
mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak" mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
fi fi
if [ "$darwin_user" = "yes" ]; then
mak_wilds="${mak_wilds} $source_path/default-configs/*-darwin-user.mak"
fi
for config in $mak_wilds; do for config in $mak_wilds; do
default_target_list="${default_target_list} $(basename "$config" .mak)" default_target_list="${default_target_list} $(basename "$config" .mak)"
@ -1548,6 +1566,7 @@ disabled with --disable-FEATURE, default is enabled if available:
user supported user emulation targets user supported user emulation targets
linux-user all linux usermode emulation targets linux-user all linux usermode emulation targets
bsd-user all BSD usermode emulation targets bsd-user all BSD usermode emulation targets
darwin-user all MacOS usermode emulation targets
docs build documentation docs build documentation
guest-agent build the QEMU Guest Agent guest-agent build the QEMU Guest Agent
guest-agent-msi build guest agent Windows MSI installation package guest-agent-msi build guest agent Windows MSI installation package
@ -5577,7 +5596,7 @@ if test "$cpu" = "s390x" ; then
fi fi
# Probe for the need for relocating the user-only binary. # Probe for the need for relocating the user-only binary.
if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] || [ "$darwin_user" = yes ] ) && [ "$pie" = no ]; then
textseg_addr= textseg_addr=
case "$cpu" in case "$cpu" in
arm | i386 | ppc* | s390* | sparc* | x86_64 | x32) arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
@ -5590,31 +5609,53 @@ if ( [ "$linux_user" = yes ] || [ "$bsd_user" = yes ] ) && [ "$pie" = no ]; then
textseg_addr=0x60000000 textseg_addr=0x60000000
;; ;;
esac esac
if [ -n "$textseg_addr" ]; then if [ -n "$textseg_addr" ]; then
cat > $TMPC <<EOF cat > $TMPC <<EOF
int main(void) { return 0; } int main(void) { return 0; }
EOF EOF
textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr" # 64bit macOS reserves 4GB for page zero to catch truncated pointer to int casts.
if ! compile_prog "" "$textseg_ldflags"; then # Follow suggested Wine configuration from:
# In case ld does not support -Ttext-segment, edit the default linker # https://stackoverflow.com/questions/46916112/osx-ld-why-does-pagezero-size-default-to-4gb-on-64b-osx
# script via sed to set the .text start addr. This is needed on FreeBSD if [ "$darwin_user" = yes ] ; then
# at least. pz_size_flag=",-pagezero_size,0x1000"
if ! $ld --verbose >/dev/null 2>&1; then else
error_exit \ pz_size_flag=""
"We need to link the QEMU user mode binaries at a" \ fi
"specific text address. Unfortunately your linker" \
"doesn't support either the -Ttext-segment option or" \
"printing the default linker script with --verbose." \
"If you don't want the user mode binaries, pass the" \
"--disable-user option to configure."
fi
# Check three different sets of ld flags:
# default_... for standard gnu ld (Linux)
# clang_... for llvm clang
# macos_... for macOS built-in ld
# If none of the above options are supported, edit the default linker
# script via sed to set the .text start addr. This is needed on FreeBSD
# at least.
default_ldflags="-Wl,-Ttext-segment=$textseg_addr"
clang_ldflags="-Wl,-image-base,${textseg_addr}${pz_size_flag}"
macos_ldflags="-Wl,-image_base,${textseg_addr}${pz_size_flag}"
if compile_prog "" "$default_ldflags"; then
textseg_ldflags="$default_ldflags"
elif compile_prog "" "$clang_ldflags"; then
textseg_ldflags="$clang_ldflags"
elif compile_prog "" "$macos_ldflags"; then
textseg_ldflags="$macos_ldflags"
elif $ld --verbose >/dev/null 2>&1; then
$ld --verbose | sed \ $ld --verbose | sed \
-e '1,/==================================================/d' \ -e '1,/==================================================/d' \
-e '/==================================================/,$d' \ -e '/==================================================/,$d' \
-e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \ -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
-e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
textseg_ldflags="-Wl,-T../config-host.ld" textseg_ldflags="-Wl,-T../config-host.ld"
else
error_exit \
"We need to link the QEMU user mode binaries at a" \
"specific text address. Unfortunately your linker" \
"doesn't support either the -Ttext-segment option," \
"-image_base, -image-base, or printing the default" \
"linker script with --verbose." \
"If you don't want the user mode binaries, pass the" \
"--disable-user option to configure."
fi fi
fi fi
fi fi
@ -6677,6 +6718,7 @@ target_softmmu="no"
target_user_only="no" target_user_only="no"
target_linux_user="no" target_linux_user="no"
target_bsd_user="no" target_bsd_user="no"
target_darwin_user="no"
case "$target" in case "$target" in
${target_name}-softmmu) ${target_name}-softmmu)
target_softmmu="yes" target_softmmu="yes"
@ -6689,6 +6731,10 @@ case "$target" in
target_user_only="yes" target_user_only="yes"
target_bsd_user="yes" target_bsd_user="yes"
;; ;;
${target_name}-darwin-user)
target_user_only="yes"
target_darwin_user="yes"
;;
*) *)
error_exit "Target '$target' not recognised" error_exit "Target '$target' not recognised"
exit 1 exit 1
@ -6936,6 +6982,9 @@ fi
if test "$target_linux_user" = "yes" ; then if test "$target_linux_user" = "yes" ; then
echo "CONFIG_LINUX_USER=y" >> $config_target_mak echo "CONFIG_LINUX_USER=y" >> $config_target_mak
fi fi
if test "$target_darwin_user" = "yes" ; then
echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
fi
list="" list=""
if test ! -z "$gdb_xml_files" ; then if test ! -z "$gdb_xml_files" ; then
for x in $gdb_xml_files; do for x in $gdb_xml_files; do
@ -7050,7 +7099,7 @@ if test "$gprof" = "yes" ; then
fi fi
fi fi
if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" -o "$target_darwin_user" = "yes" ; then
ldflags="$ldflags $textseg_ldflags" ldflags="$ldflags $textseg_ldflags"
fi fi

View File

@ -0,0 +1 @@
# Default configuration for irix-darwin-user

View File

@ -1 +1 @@
# Default configuration for mips-linux-user # Default configuration for irix-linux-user

View File

@ -0,0 +1 @@
# Default configuration for irix64-darwin-user

View File

@ -1 +1 @@
# Default configuration for mips64-linux-user # Default configuration for irix64-linux-user

View File

@ -0,0 +1 @@
# Default configuration for irixn32-darwin-user

View File

@ -1 +1 @@
# Default configuration for mipsn32-linux-user # Default configuration for irixn32-linux-user