* [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS
@ 2022-02-15 17:00 Philippe Mathieu-Daudé via
2022-02-15 17:00 ` [PATCH v2 1/8] osdep: Avoid using Clang-specific __builtin_available() Philippe Mathieu-Daudé via
` (7 more replies)
0 siblings, 8 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:00 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
Few fixes to be able to use GCC extensions which are not
available on Clang.
Since RFC:
- Split Clang __builtin_available() patch
- Do not un-inline qemu_thread_jit_execute/write
- Do not use #pragma diagnostic
- Demote ui/cocoa key arrays to static const
- Lookup scripts/entitlement.sh script once again
- Pass filtered QEMU_OBJCFLAGS configure -> meson
- Disable out-of-line atomic operations on Aarch64
Philippe Mathieu-Daudé (8):
osdep: Avoid using Clang-specific __builtin_available()
osdep: Ignore 'unguarded-availability-new' warnings on macOS Catalina
meson: Resolve the entitlement.sh script once for good
configure: Disable out-of-line atomic operations on Aarch64
meson: Log QEMU_CXXFLAGS content in summary
configure: Pass filtered QEMU_OBJCFLAGS to meson
audio: Rename coreaudio extension to use Objective-C compiler
ui/cocoa: Constify qkeycode translation arrays
audio/{coreaudio.c => coreaudio.m} | 0
audio/meson.build | 2 +-
configure | 35 ++++++++++++++++++++++++++++++
include/qemu/osdep.h | 10 +++------
meson.build | 11 ++++++++--
ui/cocoa.m | 4 ++--
6 files changed, 50 insertions(+), 12 deletions(-)
rename audio/{coreaudio.c => coreaudio.m} (100%)
--
2.34.1
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v2 1/8] osdep: Avoid using Clang-specific __builtin_available()
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
@ 2022-02-15 17:00 ` Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 2/8] osdep: Ignore 'unguarded-availability-new' warnings on macOS Catalina Philippe Mathieu-Daudé via
` (6 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:00 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
Remove the Clang specific __builtin_available() to allow building
with GCC, otherwise we get:
include/qemu/osdep.h: In function 'qemu_thread_jit_write':
include/qemu/osdep.h:787:9: warning: implicit declaration of function '__builtin_available'; did you mean '__builtin_scalbl'? [-Wimplicit-function-declaration]
787 | if (__builtin_available(macOS 11.0, *)) {
| ^~~~~~~~~~~~~~~~~~~
| __builtin_scalbl
include/qemu/osdep.h:787:9: warning: nested extern declaration of '__builtin_available' [-Wnested-externs]
include/qemu/osdep.h:787:29: error: 'macOS' undeclared (first use in this function)
787 | if (__builtin_available(macOS 11.0, *)) {
| ^~~~~
include/qemu/osdep.h:787:29: note: each undeclared identifier is reported only once for each function it appears in
include/qemu/osdep.h:787:34: error: expected ')' before numeric constant
787 | if (__builtin_available(macOS 11.0, *)) {
| ~ ^~~~~
| )
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/qemu/osdep.h | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index d1660d67fa..aecd2f66ec 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -777,16 +777,12 @@ size_t qemu_get_host_physmem(void);
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
static inline void qemu_thread_jit_execute(void)
{
- if (__builtin_available(macOS 11.0, *)) {
- pthread_jit_write_protect_np(true);
- }
+ pthread_jit_write_protect_np(true);
}
static inline void qemu_thread_jit_write(void)
{
- if (__builtin_available(macOS 11.0, *)) {
- pthread_jit_write_protect_np(false);
- }
+ pthread_jit_write_protect_np(false);
}
#else
static inline void qemu_thread_jit_write(void) {}
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 2/8] osdep: Ignore 'unguarded-availability-new' warnings on macOS Catalina
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
2022-02-15 17:00 ` [PATCH v2 1/8] osdep: Avoid using Clang-specific __builtin_available() Philippe Mathieu-Daudé via
@ 2022-02-15 17:01 ` Philippe Mathieu-Daudé via
2022-02-16 2:36 ` Akihiko Odaki
2022-02-15 17:01 ` [PATCH v2 3/8] meson: Resolve the entitlement.sh script once for good Philippe Mathieu-Daudé via
` (5 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:01 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
When building with GCC on macOS Catalina we get 2254 times:
include/qemu/osdep.h:780:5: warning: 'pthread_jit_write_protect_np' is only available on macOS 11.0 or newer [-Wunguarded-availability-new]
pthread_jit_write_protect_np(true);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix by using a stricker toolchain version low range, replacing
MAC_OS_X_VERSION_MAX_ALLOWED by MAC_OS_X_VERSION_MIN_REQUIRED.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/qemu/osdep.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index aecd2f66ec..1e7a002339 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -774,7 +774,7 @@ size_t qemu_get_host_physmem(void);
* for the current thread.
*/
#if defined(MAC_OS_VERSION_11_0) && \
- MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
+ MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0
static inline void qemu_thread_jit_execute(void)
{
pthread_jit_write_protect_np(true);
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 3/8] meson: Resolve the entitlement.sh script once for good
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
2022-02-15 17:00 ` [PATCH v2 1/8] osdep: Avoid using Clang-specific __builtin_available() Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 2/8] osdep: Ignore 'unguarded-availability-new' warnings on macOS Catalina Philippe Mathieu-Daudé via
@ 2022-02-15 17:01 ` Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64 Philippe Mathieu-Daudé via
` (4 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:01 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
Commit 235b523dba ("meson: Use find_program() to resolve the
entitlement.sh script") didn't correctly fixed the issue, as
the script is still resolved for each target. Move the check
earlier, before processing each target.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
meson.build | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index df25e7a5e7..287be51ff2 100644
--- a/meson.build
+++ b/meson.build
@@ -2894,6 +2894,10 @@ common_all = static_library('common',
feature_to_c = find_program('scripts/feature_to_c.sh')
+if targetos == 'darwin'
+ entitlement = find_program('scripts/entitlement.sh')
+endif
+
emulators = {}
foreach target : target_dirs
config_target = config_target_mak[target]
@@ -3051,7 +3055,6 @@ foreach target : target_dirs
install_input += meson.current_source_dir() / entitlements
endif
- entitlement = find_program('scripts/entitlement.sh')
emulators += {exe['name'] : custom_target(exe['name'],
input: build_input,
output: exe['name'],
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
` (2 preceding siblings ...)
2022-02-15 17:01 ` [PATCH v2 3/8] meson: Resolve the entitlement.sh script once for good Philippe Mathieu-Daudé via
@ 2022-02-15 17:01 ` Philippe Mathieu-Daudé via
2022-02-16 2:41 ` Akihiko Odaki
` (2 more replies)
2022-02-15 17:01 ` [PATCH v2 5/8] meson: Log QEMU_CXXFLAGS content in summary Philippe Mathieu-Daudé via
` (3 subsequent siblings)
7 siblings, 3 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:01 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé, Stefan Hajnoczi,
Paolo Bonzini
GCC 10.1 introduced the -moutline-atomics option on Aarch64.
This options is enabled by default, and triggers a link failure:
Undefined symbols for architecture arm64:
"___aarch64_cas1_acq_rel", referenced from:
_qmp_migrate_recover in migration_migration.c.o
_cpu_atomic_cmpxchgb_mmu in accel_tcg_cputlb.c.o
_cpu_atomic_fetch_sminb_mmu in accel_tcg_cputlb.c.o
_cpu_atomic_fetch_uminb_mmu in accel_tcg_cputlb.c.o
_cpu_atomic_fetch_smaxb_mmu in accel_tcg_cputlb.c.o
_cpu_atomic_fetch_umaxb_mmu in accel_tcg_cputlb.c.o
_cpu_atomic_smin_fetchb_mmu in accel_tcg_cputlb.c.o
...
"___aarch64_ldadd4_acq_rel", referenced from:
_multifd_recv_new_channel in migration_multifd.c.o
_monitor_event in monitor_hmp.c.o
_handle_hmp_command in monitor_hmp.c.o
_colo_compare_finalize in net_colo-compare.c.o
_flatview_unref in softmmu_memory.c.o
_virtio_scsi_hotunplug in hw_scsi_virtio-scsi.c.o
_tcg_register_thread in tcg_tcg.c.o
...
"___aarch64_swp4_acq", referenced from:
_qemu_spin_lock in softmmu_cpu-timers.c.o
_cpu_get_ticks in softmmu_cpu-timers.c.o
_qemu_spin_lock in softmmu_icount.c.o
_cpu_exec in accel_tcg_cpu-exec.c.o
_page_flush_tb_1.isra.0 in accel_tcg_translate-all.c.o
_page_entry_lock in accel_tcg_translate-all.c.o
_do_tb_phys_invalidate in accel_tcg_translate-all.c.o
...
QEMU implements its own atomic operations using C11 builtin helpers.
Disable the GCC out-of-line atomic ops.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Clearly out of my understanding, but at least it links and the qtests
pass.
---
configure | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/configure b/configure
index 06c03cebd3..3217aa22cb 100755
--- a/configure
+++ b/configure
@@ -2826,6 +2826,18 @@ else
avx512f_opt="no"
fi
+#########################################
+# Disable out-of-line atomic operations.
+
+case "$cpu" in
+ aarch64)
+ write_c_skeleton;
+ if compile_prog "$CPU_CFLAGS -Werror -mno-outline-atomics" "" ; then
+ CPU_CFLAGS="-mno-outline-atomics $CPU_CFLAGS"
+ fi
+ ;;
+esac
+
########################################
# check if __[u]int128_t is usable.
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 5/8] meson: Log QEMU_CXXFLAGS content in summary
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
` (3 preceding siblings ...)
2022-02-15 17:01 ` [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64 Philippe Mathieu-Daudé via
@ 2022-02-15 17:01 ` Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 6/8] configure: Pass filtered QEMU_OBJCFLAGS to meson Philippe Mathieu-Daudé via
` (2 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:01 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/meson.build b/meson.build
index 287be51ff2..215c253683 100644
--- a/meson.build
+++ b/meson.build
@@ -3305,6 +3305,7 @@ if link_args.length() > 0
summary_info += {'LDFLAGS': ' '.join(link_args)}
endif
summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
+summary_info += {'QEMU_CXXFLAGS': config_host['QEMU_CXXFLAGS']}
summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 6/8] configure: Pass filtered QEMU_OBJCFLAGS to meson
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
` (4 preceding siblings ...)
2022-02-15 17:01 ` [PATCH v2 5/8] meson: Log QEMU_CXXFLAGS content in summary Philippe Mathieu-Daudé via
@ 2022-02-15 17:01 ` Philippe Mathieu-Daudé via
2022-02-18 15:44 ` Paolo Bonzini
2022-02-15 17:01 ` [PATCH v2 7/8] audio: Rename coreaudio extension to use Objective-C compiler Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 8/8] ui/cocoa: Constify qkeycode translation arrays Philippe Mathieu-Daudé via
7 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:01 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
Filter unsupported Objective-C options, to avoid
'unknown-warning-option' warnings when using Clang:
[34/373] Compiling Objective-C object libcommon.fa.p/audio_coreaudio.m.o
warning: unknown warning option '-Wold-style-declaration'; did you mean '-Wout-of-line-declaration'? [-Wunknown-warning-option]
warning: unknown warning option '-Wimplicit-fallthrough=2'; did you mean '-Wimplicit-fallthrough'? [-Wunknown-warning-option]
2 warnings generated.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
configure | 23 +++++++++++++++++++++++
meson.build | 5 ++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index 3217aa22cb..df6eaec067 100755
--- a/configure
+++ b/configure
@@ -77,6 +77,7 @@ TMPB="qemu-conf"
TMPC="${TMPDIR1}/${TMPB}.c"
TMPO="${TMPDIR1}/${TMPB}.o"
TMPCXX="${TMPDIR1}/${TMPB}.cxx"
+TMPM="${TMPDIR1}/${TMPB}.m"
TMPE="${TMPDIR1}/${TMPB}.exe"
rm -f config.log
@@ -148,6 +149,10 @@ do_cxx() {
do_compiler "$cxx" $CPU_CFLAGS "$@"
}
+do_objc() {
+ do_compiler "$objcc" $CPU_CFLAGS "$@"
+}
+
# Append $2 to the variable named $1, with space separation
add_to() {
eval $1=\${$1:+\"\$$1 \"}\$2
@@ -1616,10 +1621,27 @@ cc_has_warning_flag() {
compile_prog "-Werror $optflag" ""
}
+objcc_has_warning_flag() {
+ cat > $TMPM <<EOF
+int main(void) { return 0; }
+EOF
+
+ # Use the positive sense of the flag when testing for -Wno-wombat
+ # support (gcc will happily accept the -Wno- form of unknown
+ # warning options).
+ optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
+ do_objc -Werror $optflag \
+ $OBJCFLAGS $EXTRA_OBJCFLAGS $CONFIGURE_OBJCFLAGS $QEMU_OBJCFLAGS \
+ -o $TMPE $TMPM $QEMU_LDFLAGS
+}
+
for flag in $gcc_flags; do
if cc_has_warning_flag $flag ; then
QEMU_CFLAGS="$QEMU_CFLAGS $flag"
fi
+ if objcc_has_warning_flag $flag ; then
+ QEMU_OBJCFLAGS="$QEMU_OBJCFLAGS $flag"
+ fi
done
if test "$stack_protector" != "no"; then
@@ -3579,6 +3601,7 @@ echo "LD=$ld" >> $config_host_mak
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
+echo "QEMU_OBJCFLAGS=$QEMU_OBJCFLAGS" >> $config_host_mak
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 215c253683..7b78235a39 100644
--- a/meson.build
+++ b/meson.build
@@ -199,9 +199,11 @@ if get_option('fuzzing')
endif
add_global_arguments(config_host['QEMU_CFLAGS'].split(),
- native: false, language: ['c', 'objc'])
+ native: false, language: ['c'])
add_global_arguments(config_host['QEMU_CXXFLAGS'].split(),
native: false, language: 'cpp')
+add_global_arguments(config_host['QEMU_OBJCFLAGS'].split(),
+ native: false, language: ['objc'])
add_global_link_arguments(config_host['QEMU_LDFLAGS'].split(),
native: false, language: ['c', 'cpp', 'objc'])
@@ -3306,6 +3308,7 @@ if link_args.length() > 0
endif
summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
summary_info += {'QEMU_CXXFLAGS': config_host['QEMU_CXXFLAGS']}
+summary_info += {'QEMU_OBJCFLAGS': config_host['QEMU_OBJCFLAGS']}
summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 7/8] audio: Rename coreaudio extension to use Objective-C compiler
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
` (5 preceding siblings ...)
2022-02-15 17:01 ` [PATCH v2 6/8] configure: Pass filtered QEMU_OBJCFLAGS to meson Philippe Mathieu-Daudé via
@ 2022-02-15 17:01 ` Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 8/8] ui/cocoa: Constify qkeycode translation arrays Philippe Mathieu-Daudé via
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:01 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
The coreaudio library includes Objective-C declarations (using the
caret '^' symbol to declare block references [*]). When building
with a C compiler we get:
[175/839] Compiling C object libcommon.fa.p/audio_coreaudio.c.o
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h:18,
from ../../audio/coreaudio.c:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardware.h:162:2: error: expected identifier or '(' before '^' token
162 | (^AudioObjectPropertyListenerBlock)( UInt32 inNumberAddresses,
| ^
FAILED: libcommon.fa.p/audio_coreaudio.c.o
Rename the file to use the Objective-C default extension (.m) so
meson calls the correct compiler.
[*] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
audio/{coreaudio.c => coreaudio.m} | 0
audio/meson.build | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename audio/{coreaudio.c => coreaudio.m} (100%)
diff --git a/audio/coreaudio.c b/audio/coreaudio.m
similarity index 100%
rename from audio/coreaudio.c
rename to audio/coreaudio.m
diff --git a/audio/meson.build b/audio/meson.build
index d9b295514f..94dab16891 100644
--- a/audio/meson.build
+++ b/audio/meson.build
@@ -7,7 +7,7 @@ softmmu_ss.add(files(
'wavcapture.c',
))
-softmmu_ss.add(when: coreaudio, if_true: files('coreaudio.c'))
+softmmu_ss.add(when: coreaudio, if_true: files('coreaudio.m'))
softmmu_ss.add(when: dsound, if_true: files('dsoundaudio.c', 'audio_win_int.c'))
audio_modules = {}
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v2 8/8] ui/cocoa: Constify qkeycode translation arrays
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
` (6 preceding siblings ...)
2022-02-15 17:01 ` [PATCH v2 7/8] audio: Rename coreaudio extension to use Objective-C compiler Philippe Mathieu-Daudé via
@ 2022-02-15 17:01 ` Philippe Mathieu-Daudé via
7 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-15 17:01 UTC (permalink / raw)
To: qemu-devel
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Philippe Mathieu-Daudé
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
ui/cocoa.m | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 30702d31a5..7a3a610212 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -651,7 +651,7 @@ QemuCocoaView *cocoaView;
/* translates Macintosh keycodes to QEMU's keysym */
- int without_control_translation[] = {
+ static const int without_control_translation[] = {
[0 ... 0xff] = 0, // invalid key
[kVK_UpArrow] = QEMU_KEY_UP,
@@ -666,7 +666,7 @@ QemuCocoaView *cocoaView;
[kVK_Delete] = QEMU_KEY_BACKSPACE,
};
- int with_control_translation[] = {
+ static const int with_control_translation[] = {
[0 ... 0xff] = 0, // invalid key
[kVK_UpArrow] = QEMU_KEY_CTRL_UP,
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v2 2/8] osdep: Ignore 'unguarded-availability-new' warnings on macOS Catalina
2022-02-15 17:01 ` [PATCH v2 2/8] osdep: Ignore 'unguarded-availability-new' warnings on macOS Catalina Philippe Mathieu-Daudé via
@ 2022-02-16 2:36 ` Akihiko Odaki
0 siblings, 0 replies; 21+ messages in thread
From: Akihiko Odaki @ 2022-02-16 2:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Peter Maydell, Roman Bolshakov, Christian Schoenebeck,
qemu Developers
On Wed, Feb 16, 2022 at 2:01 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> When building with GCC on macOS Catalina we get 2254 times:
>
> include/qemu/osdep.h:780:5: warning: 'pthread_jit_write_protect_np' is only available on macOS 11.0 or newer [-Wunguarded-availability-new]
> pthread_jit_write_protect_np(true);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fix by using a stricker toolchain version low range, replacing
> MAC_OS_X_VERSION_MAX_ALLOWED by MAC_OS_X_VERSION_MIN_REQUIRED.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> include/qemu/osdep.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index aecd2f66ec..1e7a002339 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -774,7 +774,7 @@ size_t qemu_get_host_physmem(void);
> * for the current thread.
> */
> #if defined(MAC_OS_VERSION_11_0) && \
> - MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
> + MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0
> static inline void qemu_thread_jit_execute(void)
> {
> pthread_jit_write_protect_np(true);
> --
> 2.34.1
>
This should be squashed with "[PATCH v2 1/8] osdep: Avoid using
Clang-specific __builtin_available()"; Removing __builtin_available
makes it incompatible with macOS < 11.0, hence this change is needed.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-15 17:01 ` [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64 Philippe Mathieu-Daudé via
@ 2022-02-16 2:41 ` Akihiko Odaki
2022-02-16 10:19 ` Richard Henderson
2022-02-18 15:42 ` Paolo Bonzini
2 siblings, 0 replies; 21+ messages in thread
From: Akihiko Odaki @ 2022-02-16 2:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Peter Maydell, Christian Schoenebeck, qemu Developers,
Roman Bolshakov, Stefan Hajnoczi, Paolo Bonzini
On Wed, Feb 16, 2022 at 2:01 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> GCC 10.1 introduced the -moutline-atomics option on Aarch64.
> This options is enabled by default, and triggers a link failure:
>
> Undefined symbols for architecture arm64:
> "___aarch64_cas1_acq_rel", referenced from:
> _qmp_migrate_recover in migration_migration.c.o
> _cpu_atomic_cmpxchgb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_sminb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_uminb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_smaxb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_umaxb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_smin_fetchb_mmu in accel_tcg_cputlb.c.o
> ...
> "___aarch64_ldadd4_acq_rel", referenced from:
> _multifd_recv_new_channel in migration_multifd.c.o
> _monitor_event in monitor_hmp.c.o
> _handle_hmp_command in monitor_hmp.c.o
> _colo_compare_finalize in net_colo-compare.c.o
> _flatview_unref in softmmu_memory.c.o
> _virtio_scsi_hotunplug in hw_scsi_virtio-scsi.c.o
> _tcg_register_thread in tcg_tcg.c.o
> ...
> "___aarch64_swp4_acq", referenced from:
> _qemu_spin_lock in softmmu_cpu-timers.c.o
> _cpu_get_ticks in softmmu_cpu-timers.c.o
> _qemu_spin_lock in softmmu_icount.c.o
> _cpu_exec in accel_tcg_cpu-exec.c.o
> _page_flush_tb_1.isra.0 in accel_tcg_translate-all.c.o
> _page_entry_lock in accel_tcg_translate-all.c.o
> _do_tb_phys_invalidate in accel_tcg_translate-all.c.o
> ...
>
> QEMU implements its own atomic operations using C11 builtin helpers.
> Disable the GCC out-of-line atomic ops.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
>
> Clearly out of my understanding, but at least it links and the qtests
> pass.
> ---
> configure | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/configure b/configure
> index 06c03cebd3..3217aa22cb 100755
> --- a/configure
> +++ b/configure
> @@ -2826,6 +2826,18 @@ else
> avx512f_opt="no"
> fi
>
> +#########################################
> +# Disable out-of-line atomic operations.
> +
> +case "$cpu" in
> + aarch64)
> + write_c_skeleton;
> + if compile_prog "$CPU_CFLAGS -Werror -mno-outline-atomics" "" ; then
> + CPU_CFLAGS="-mno-outline-atomics $CPU_CFLAGS"
> + fi
> + ;;
> +esac
> +
> ########################################
> # check if __[u]int128_t is usable.
>
> --
> 2.34.1
>
This change would (slightly) increase the code size and is harmful to
the other proper GCC installations. The flag should be specified by
the user (or the user should fix the GCC installation.)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-15 17:01 ` [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64 Philippe Mathieu-Daudé via
2022-02-16 2:41 ` Akihiko Odaki
@ 2022-02-16 10:19 ` Richard Henderson
2022-02-16 15:08 ` Philippe Mathieu-Daudé via
2022-02-18 15:42 ` Paolo Bonzini
2 siblings, 1 reply; 21+ messages in thread
From: Richard Henderson @ 2022-02-16 10:19 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, Akihiko Odaki, Christian Schoenebeck,
Roman Bolshakov, Stefan Hajnoczi, Paolo Bonzini
On 2/16/22 04:01, Philippe Mathieu-Daudé via wrote:
> GCC 10.1 introduced the -moutline-atomics option on Aarch64.
> This options is enabled by default, and triggers a link failure:
>
> Undefined symbols for architecture arm64:
> "___aarch64_cas1_acq_rel", referenced from:
> _qmp_migrate_recover in migration_migration.c.o
> _cpu_atomic_cmpxchgb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_sminb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_uminb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_smaxb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_fetch_umaxb_mmu in accel_tcg_cputlb.c.o
> _cpu_atomic_smin_fetchb_mmu in accel_tcg_cputlb.c.o
> ...
> "___aarch64_ldadd4_acq_rel", referenced from:
> _multifd_recv_new_channel in migration_multifd.c.o
> _monitor_event in monitor_hmp.c.o
> _handle_hmp_command in monitor_hmp.c.o
> _colo_compare_finalize in net_colo-compare.c.o
> _flatview_unref in softmmu_memory.c.o
> _virtio_scsi_hotunplug in hw_scsi_virtio-scsi.c.o
> _tcg_register_thread in tcg_tcg.c.o
> ...
> "___aarch64_swp4_acq", referenced from:
> _qemu_spin_lock in softmmu_cpu-timers.c.o
> _cpu_get_ticks in softmmu_cpu-timers.c.o
> _qemu_spin_lock in softmmu_icount.c.o
> _cpu_exec in accel_tcg_cpu-exec.c.o
> _page_flush_tb_1.isra.0 in accel_tcg_translate-all.c.o
> _page_entry_lock in accel_tcg_translate-all.c.o
> _do_tb_phys_invalidate in accel_tcg_translate-all.c.o
> ...
>
> QEMU implements its own atomic operations using C11 builtin helpers.
> Disable the GCC out-of-line atomic ops.
>
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> ---
> Cc: Stefan Hajnoczi<stefanha@redhat.com>
> Cc: Paolo Bonzini<pbonzini@redhat.com>
>
> Clearly out of my understanding, but at least it links and the qtests
> pass.
> ---
> configure | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
These should have been supplied by libgcc.a, which we're supposed to be linking against.
Something is wrong with your installation.
r~
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-16 10:19 ` Richard Henderson
@ 2022-02-16 15:08 ` Philippe Mathieu-Daudé via
2022-02-16 16:42 ` Akihiko Odaki
0 siblings, 1 reply; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-16 15:08 UTC (permalink / raw)
To: Richard Henderson, qemu-devel, Paolo Bonzini
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Akihiko Odaki, Stefan Hajnoczi, Andrew Jones
On 16/2/22 11:19, Richard Henderson wrote:
> On 2/16/22 04:01, Philippe Mathieu-Daudé via wrote:
>> GCC 10.1 introduced the -moutline-atomics option on Aarch64.
>> This options is enabled by default, and triggers a link failure:
>>
>> Undefined symbols for architecture arm64:
>> "___aarch64_cas1_acq_rel", referenced from:
>> _qmp_migrate_recover in migration_migration.c.o
>> _cpu_atomic_cmpxchgb_mmu in accel_tcg_cputlb.c.o
>> _cpu_atomic_fetch_sminb_mmu in accel_tcg_cputlb.c.o
>> _cpu_atomic_fetch_uminb_mmu in accel_tcg_cputlb.c.o
>> _cpu_atomic_fetch_smaxb_mmu in accel_tcg_cputlb.c.o
>> _cpu_atomic_fetch_umaxb_mmu in accel_tcg_cputlb.c.o
>> _cpu_atomic_smin_fetchb_mmu in accel_tcg_cputlb.c.o
>> ...
>> "___aarch64_ldadd4_acq_rel", referenced from:
>> _multifd_recv_new_channel in migration_multifd.c.o
>> _monitor_event in monitor_hmp.c.o
>> _handle_hmp_command in monitor_hmp.c.o
>> _colo_compare_finalize in net_colo-compare.c.o
>> _flatview_unref in softmmu_memory.c.o
>> _virtio_scsi_hotunplug in hw_scsi_virtio-scsi.c.o
>> _tcg_register_thread in tcg_tcg.c.o
>> ...
>> "___aarch64_swp4_acq", referenced from:
>> _qemu_spin_lock in softmmu_cpu-timers.c.o
>> _cpu_get_ticks in softmmu_cpu-timers.c.o
>> _qemu_spin_lock in softmmu_icount.c.o
>> _cpu_exec in accel_tcg_cpu-exec.c.o
>> _page_flush_tb_1.isra.0 in accel_tcg_translate-all.c.o
>> _page_entry_lock in accel_tcg_translate-all.c.o
>> _do_tb_phys_invalidate in accel_tcg_translate-all.c.o
>> ...
>>
>> QEMU implements its own atomic operations using C11 builtin helpers.
>> Disable the GCC out-of-line atomic ops.
>>
>> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
>> ---
>> Cc: Stefan Hajnoczi<stefanha@redhat.com>
>> Cc: Paolo Bonzini<pbonzini@redhat.com>
>>
>> Clearly out of my understanding, but at least it links and the qtests
>> pass.
>> ---
>> configure | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>
> These should have been supplied by libgcc.a, which we're supposed to be
> linking against. Something is wrong with your installation.
I don't have gobjc/g++ installed, so ./configure defaulted to Clang to
compile these languages, but compiled C files using GCC. At the end the
Clang linker is used (the default c++ symlink).
Could there be a mismatch between Clang (-mno-outline-atomics) and GCC
(-moutline-atomics)?
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-16 15:08 ` Philippe Mathieu-Daudé via
@ 2022-02-16 16:42 ` Akihiko Odaki
2022-02-16 17:18 ` Philippe Mathieu-Daudé via
0 siblings, 1 reply; 21+ messages in thread
From: Akihiko Odaki @ 2022-02-16 16:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Richard Henderson, qemu-devel,
Paolo Bonzini
Cc: Peter Maydell, Roman Bolshakov, Christian Schoenebeck,
Andrew Jones, Stefan Hajnoczi
On 2022/02/17 0:08, Philippe Mathieu-Daudé wrote:
> On 16/2/22 11:19, Richard Henderson wrote:
>> On 2/16/22 04:01, Philippe Mathieu-Daudé via wrote:
>>> GCC 10.1 introduced the -moutline-atomics option on Aarch64.
>>> This options is enabled by default, and triggers a link failure:
>>>
>>> Undefined symbols for architecture arm64:
>>> "___aarch64_cas1_acq_rel", referenced from:
>>> _qmp_migrate_recover in migration_migration.c.o
>>> _cpu_atomic_cmpxchgb_mmu in accel_tcg_cputlb.c.o
>>> _cpu_atomic_fetch_sminb_mmu in accel_tcg_cputlb.c.o
>>> _cpu_atomic_fetch_uminb_mmu in accel_tcg_cputlb.c.o
>>> _cpu_atomic_fetch_smaxb_mmu in accel_tcg_cputlb.c.o
>>> _cpu_atomic_fetch_umaxb_mmu in accel_tcg_cputlb.c.o
>>> _cpu_atomic_smin_fetchb_mmu in accel_tcg_cputlb.c.o
>>> ...
>>> "___aarch64_ldadd4_acq_rel", referenced from:
>>> _multifd_recv_new_channel in migration_multifd.c.o
>>> _monitor_event in monitor_hmp.c.o
>>> _handle_hmp_command in monitor_hmp.c.o
>>> _colo_compare_finalize in net_colo-compare.c.o
>>> _flatview_unref in softmmu_memory.c.o
>>> _virtio_scsi_hotunplug in hw_scsi_virtio-scsi.c.o
>>> _tcg_register_thread in tcg_tcg.c.o
>>> ...
>>> "___aarch64_swp4_acq", referenced from:
>>> _qemu_spin_lock in softmmu_cpu-timers.c.o
>>> _cpu_get_ticks in softmmu_cpu-timers.c.o
>>> _qemu_spin_lock in softmmu_icount.c.o
>>> _cpu_exec in accel_tcg_cpu-exec.c.o
>>> _page_flush_tb_1.isra.0 in accel_tcg_translate-all.c.o
>>> _page_entry_lock in accel_tcg_translate-all.c.o
>>> _do_tb_phys_invalidate in accel_tcg_translate-all.c.o
>>> ...
>>>
>>> QEMU implements its own atomic operations using C11 builtin helpers.
>>> Disable the GCC out-of-line atomic ops.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
>>> ---
>>> Cc: Stefan Hajnoczi<stefanha@redhat.com>
>>> Cc: Paolo Bonzini<pbonzini@redhat.com>
>>>
>>> Clearly out of my understanding, but at least it links and the qtests
>>> pass.
>>> ---
>>> configure | 12 ++++++++++++
>>> 1 file changed, 12 insertions(+)
>>
>> These should have been supplied by libgcc.a, which we're supposed to
>> be linking against. Something is wrong with your installation.
>
> I don't have gobjc/g++ installed, so ./configure defaulted to Clang to
> compile these languages, but compiled C files using GCC. At the end the
> Clang linker is used (the default c++ symlink).
>
> Could there be a mismatch between Clang (-mno-outline-atomics) and GCC
> (-moutline-atomics)?
I think you have to instruct Clang to use libgcc instead of compiler-rt
and link the objects with GCC. Here is the documentation of Clang about
the runtime I could find:
https://clang.llvm.org/docs/Toolchain.html#libgcc-s-gnu
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-16 16:42 ` Akihiko Odaki
@ 2022-02-16 17:18 ` Philippe Mathieu-Daudé via
2022-02-16 17:19 ` Peter Maydell
2022-02-18 1:46 ` Richard Henderson
0 siblings, 2 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-02-16 17:18 UTC (permalink / raw)
To: Akihiko Odaki, Richard Henderson, qemu-devel, Paolo Bonzini
Cc: Roman Bolshakov, Peter Maydell, Christian Schoenebeck,
Stefan Hajnoczi, Andrew Jones
On 16/2/22 17:42, Akihiko Odaki wrote:
> On 2022/02/17 0:08, Philippe Mathieu-Daudé wrote:
>> On 16/2/22 11:19, Richard Henderson wrote:
>>> On 2/16/22 04:01, Philippe Mathieu-Daudé via wrote:
>>>> GCC 10.1 introduced the -moutline-atomics option on Aarch64.
>>>> This options is enabled by default, and triggers a link failure:
>>>>
>>>> Undefined symbols for architecture arm64:
>>>> "___aarch64_cas1_acq_rel", referenced from:
>>>> _qmp_migrate_recover in migration_migration.c.o
>>>> _cpu_atomic_cmpxchgb_mmu in accel_tcg_cputlb.c.o
>>>> _cpu_atomic_fetch_sminb_mmu in accel_tcg_cputlb.c.o
>>>> _cpu_atomic_fetch_uminb_mmu in accel_tcg_cputlb.c.o
>>>> _cpu_atomic_fetch_smaxb_mmu in accel_tcg_cputlb.c.o
>>>> _cpu_atomic_fetch_umaxb_mmu in accel_tcg_cputlb.c.o
>>>> _cpu_atomic_smin_fetchb_mmu in accel_tcg_cputlb.c.o
>>>> ...
>>>> "___aarch64_ldadd4_acq_rel", referenced from:
>>>> _multifd_recv_new_channel in migration_multifd.c.o
>>>> _monitor_event in monitor_hmp.c.o
>>>> _handle_hmp_command in monitor_hmp.c.o
>>>> _colo_compare_finalize in net_colo-compare.c.o
>>>> _flatview_unref in softmmu_memory.c.o
>>>> _virtio_scsi_hotunplug in hw_scsi_virtio-scsi.c.o
>>>> _tcg_register_thread in tcg_tcg.c.o
>>>> ...
>>>> "___aarch64_swp4_acq", referenced from:
>>>> _qemu_spin_lock in softmmu_cpu-timers.c.o
>>>> _cpu_get_ticks in softmmu_cpu-timers.c.o
>>>> _qemu_spin_lock in softmmu_icount.c.o
>>>> _cpu_exec in accel_tcg_cpu-exec.c.o
>>>> _page_flush_tb_1.isra.0 in accel_tcg_translate-all.c.o
>>>> _page_entry_lock in accel_tcg_translate-all.c.o
>>>> _do_tb_phys_invalidate in accel_tcg_translate-all.c.o
>>>> ...
>>>>
>>>> QEMU implements its own atomic operations using C11 builtin helpers.
>>>> Disable the GCC out-of-line atomic ops.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
>>>> ---
>>>> Cc: Stefan Hajnoczi<stefanha@redhat.com>
>>>> Cc: Paolo Bonzini<pbonzini@redhat.com>
>>>>
>>>> Clearly out of my understanding, but at least it links and the qtests
>>>> pass.
>>>> ---
>>>> configure | 12 ++++++++++++
>>>> 1 file changed, 12 insertions(+)
>>>
>>> These should have been supplied by libgcc.a, which we're supposed to
>>> be linking against. Something is wrong with your installation.
>>
>> I don't have gobjc/g++ installed, so ./configure defaulted to Clang to
>> compile these languages, but compiled C files using GCC. At the end the
>> Clang linker is used (the default c++ symlink).
>>
>> Could there be a mismatch between Clang (-mno-outline-atomics) and GCC
>> (-moutline-atomics)?
>
> I think you have to instruct Clang to use libgcc instead of compiler-rt
> and link the objects with GCC. Here is the documentation of Clang about
> the runtime I could find:
> https://clang.llvm.org/docs/Toolchain.html#libgcc-s-gnu
Thanks for the pointer. And the next section is
https://clang.llvm.org/docs/Toolchain.html#atomics-library :)
Clang does not currently automatically link against libatomic when
using libgcc_s. You may need to manually add -latomic to support
this configuration when using non-native atomic operations (if you
see link errors referring to __atomic_* functions).
I'll try that.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-16 17:18 ` Philippe Mathieu-Daudé via
@ 2022-02-16 17:19 ` Peter Maydell
2022-02-18 1:46 ` Richard Henderson
1 sibling, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2022-02-16 17:19 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Andrew Jones, Stefan Hajnoczi, Richard Henderson,
Christian Schoenebeck, qemu-devel, Roman Bolshakov, Akihiko Odaki,
Paolo Bonzini
On Wed, 16 Feb 2022 at 17:18, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Thanks for the pointer. And the next section is
> https://clang.llvm.org/docs/Toolchain.html#atomics-library :)
>
> Clang does not currently automatically link against libatomic when
> using libgcc_s. You may need to manually add -latomic to support
> this configuration when using non-native atomic operations (if you
> see link errors referring to __atomic_* functions).
We deliberately don't link against libatomic at the moment...
-- PMM
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-16 17:18 ` Philippe Mathieu-Daudé via
2022-02-16 17:19 ` Peter Maydell
@ 2022-02-18 1:46 ` Richard Henderson
2022-02-18 15:36 ` Paolo Bonzini
1 sibling, 1 reply; 21+ messages in thread
From: Richard Henderson @ 2022-02-18 1:46 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Akihiko Odaki, qemu-devel,
Paolo Bonzini
Cc: Peter Maydell, Roman Bolshakov, Christian Schoenebeck,
Andrew Jones, Stefan Hajnoczi
On 2/17/22 04:18, Philippe Mathieu-Daudé wrote:
> On 16/2/22 17:42, Akihiko Odaki wrote:
>> On 2022/02/17 0:08, Philippe Mathieu-Daudé wrote:
>>> On 16/2/22 11:19, Richard Henderson wrote:
>>>> These should have been supplied by libgcc.a, which we're supposed to be linking
>>>> against. Something is wrong with your installation.
>>>
>>> I don't have gobjc/g++ installed, so ./configure defaulted to Clang to
>>> compile these languages, but compiled C files using GCC. At the end the
>>> Clang linker is used (the default c++ symlink).
This is another form of compiler mis-configuration.
If you don't have g++ to go with gcc, use --cxx=false to avoid picking up a different
compiler.
>>> Could there be a mismatch between Clang (-mno-outline-atomics) and GCC
>>> (-moutline-atomics)?
I have no idea if those options do the same thing.
>> I think you have to instruct Clang to use libgcc instead of compiler-rt and link the
>> objects with GCC. Here is the documentation of Clang about the runtime I could find:
>> https://clang.llvm.org/docs/Toolchain.html#libgcc-s-gnu
>
> Thanks for the pointer. And the next section is
> https://clang.llvm.org/docs/Toolchain.html#atomics-library :)
>
> Clang does not currently automatically link against libatomic when
> using libgcc_s. You may need to manually add -latomic to support
> this configuration when using non-native atomic operations (if you
> see link errors referring to __atomic_* functions).
>
> I'll try that.
-moutline-atomics is *not* the same as libatomic.
You should not need libatomic at all.
r~
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-18 1:46 ` Richard Henderson
@ 2022-02-18 15:36 ` Paolo Bonzini
2022-03-06 22:21 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 21+ messages in thread
From: Paolo Bonzini @ 2022-02-18 15:36 UTC (permalink / raw)
To: Richard Henderson, Philippe Mathieu-Daudé, Akihiko Odaki,
qemu-devel
Cc: Peter Maydell, Roman Bolshakov, Christian Schoenebeck,
Andrew Jones, Stefan Hajnoczi
On 2/18/22 02:46, Richard Henderson wrote:
>>>>
>>>> I don't have gobjc/g++ installed, so ./configure defaulted to Clang to
>>>> compile these languages, but compiled C files using GCC. At the end the
>>>> Clang linker is used (the default c++ symlink).
>
> This is another form of compiler mis-configuration.
> If you don't have g++ to go with gcc, use --cxx=false to avoid picking
> up a different compiler.
This would be the kind of problem that this test is trying to cover:
if do_cxx $CXXFLAGS $EXTRA_CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
# C++ compiler $cxx works ok with C compiler $cc
:
else
echo "C++ compiler $cxx does not work with C compiler $cc"
echo "Disabling C++ specific optional code"
cxx=
fi
In the past it detected issues with libasan/libtsan incompatibilities.
We should either add a test for atomic operations, or just drop the
test.
Paolo
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-15 17:01 ` [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64 Philippe Mathieu-Daudé via
2022-02-16 2:41 ` Akihiko Odaki
2022-02-16 10:19 ` Richard Henderson
@ 2022-02-18 15:42 ` Paolo Bonzini
2 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2022-02-18 15:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, Roman Bolshakov, Christian Schoenebeck,
Stefan Hajnoczi, Akihiko Odaki
On 2/15/22 18:01, Philippe Mathieu-Daudé via wrote:
> +
> +case "$cpu" in
> + aarch64)
> + write_c_skeleton;
> + if compile_prog "$CPU_CFLAGS -Werror -mno-outline-atomics" "" ; then
> + CPU_CFLAGS="-mno-outline-atomics $CPU_CFLAGS"
> + fi
> + ;;
Apart from the question of whether/how to work around this issue, this
should not be added to CPU_CFLAGS. CPU_CFLAGS is only for things that
change the ABI.
Paolo
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 6/8] configure: Pass filtered QEMU_OBJCFLAGS to meson
2022-02-15 17:01 ` [PATCH v2 6/8] configure: Pass filtered QEMU_OBJCFLAGS to meson Philippe Mathieu-Daudé via
@ 2022-02-18 15:44 ` Paolo Bonzini
0 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2022-02-18 15:44 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, Roman Bolshakov, Christian Schoenebeck,
Akihiko Odaki
On 2/15/22 18:01, Philippe Mathieu-Daudé via wrote:
> Filter unsupported Objective-C options, to avoid
> 'unknown-warning-option' warnings when using Clang:
>
> [34/373] Compiling Objective-C object libcommon.fa.p/audio_coreaudio.m.o
> warning: unknown warning option '-Wold-style-declaration'; did you mean '-Wout-of-line-declaration'? [-Wunknown-warning-option]
> warning: unknown warning option '-Wimplicit-fallthrough=2'; did you mean '-Wimplicit-fallthrough'? [-Wunknown-warning-option]
> 2 warnings generated.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> configure | 23 +++++++++++++++++++++++
> meson.build | 5 ++++-
> 2 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 3217aa22cb..df6eaec067 100755
> --- a/configure
> +++ b/configure
> @@ -77,6 +77,7 @@ TMPB="qemu-conf"
> TMPC="${TMPDIR1}/${TMPB}.c"
> TMPO="${TMPDIR1}/${TMPB}.o"
> TMPCXX="${TMPDIR1}/${TMPB}.cxx"
> +TMPM="${TMPDIR1}/${TMPB}.m"
> TMPE="${TMPDIR1}/${TMPB}.exe"
>
> rm -f config.log
> @@ -148,6 +149,10 @@ do_cxx() {
> do_compiler "$cxx" $CPU_CFLAGS "$@"
> }
>
> +do_objc() {
> + do_compiler "$objcc" $CPU_CFLAGS "$@"
> +}
> +
> # Append $2 to the variable named $1, with space separation
> add_to() {
> eval $1=\${$1:+\"\$$1 \"}\$2
> @@ -1616,10 +1621,27 @@ cc_has_warning_flag() {
> compile_prog "-Werror $optflag" ""
> }
>
> +objcc_has_warning_flag() {
> + cat > $TMPM <<EOF
> +int main(void) { return 0; }
> +EOF
> +
> + # Use the positive sense of the flag when testing for -Wno-wombat
> + # support (gcc will happily accept the -Wno- form of unknown
> + # warning options).
> + optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')"
> + do_objc -Werror $optflag \
> + $OBJCFLAGS $EXTRA_OBJCFLAGS $CONFIGURE_OBJCFLAGS $QEMU_OBJCFLAGS \
> + -o $TMPE $TMPM $QEMU_LDFLAGS
> +}
> +
> for flag in $gcc_flags; do
> if cc_has_warning_flag $flag ; then
> QEMU_CFLAGS="$QEMU_CFLAGS $flag"
> fi
> + if objcc_has_warning_flag $flag ; then
> + QEMU_OBJCFLAGS="$QEMU_OBJCFLAGS $flag"
> + fi
> done
>
> if test "$stack_protector" != "no"; then
> @@ -3579,6 +3601,7 @@ echo "LD=$ld" >> $config_host_mak
> echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
> echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
> echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
> +echo "QEMU_OBJCFLAGS=$QEMU_OBJCFLAGS" >> $config_host_mak
> echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
> echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
> echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak
> diff --git a/meson.build b/meson.build
> index 215c253683..7b78235a39 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -199,9 +199,11 @@ if get_option('fuzzing')
> endif
>
> add_global_arguments(config_host['QEMU_CFLAGS'].split(),
> - native: false, language: ['c', 'objc'])
> + native: false, language: ['c'])
> add_global_arguments(config_host['QEMU_CXXFLAGS'].split(),
> native: false, language: 'cpp')
> +add_global_arguments(config_host['QEMU_OBJCFLAGS'].split(),
> + native: false, language: ['objc'])
> add_global_link_arguments(config_host['QEMU_LDFLAGS'].split(),
> native: false, language: ['c', 'cpp', 'objc'])
>
> @@ -3306,6 +3308,7 @@ if link_args.length() > 0
> endif
> summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
> summary_info += {'QEMU_CXXFLAGS': config_host['QEMU_CXXFLAGS']}
> +summary_info += {'QEMU_OBJCFLAGS': config_host['QEMU_OBJCFLAGS']}
> summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
> summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
> summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64
2022-02-18 15:36 ` Paolo Bonzini
@ 2022-03-06 22:21 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-03-06 22:21 UTC (permalink / raw)
To: Paolo Bonzini, Richard Henderson, Philippe Mathieu-Daudé,
Akihiko Odaki, qemu-devel
Cc: Peter Maydell, Roman Bolshakov, Christian Schoenebeck,
Andrew Jones, Stefan Hajnoczi
On 18/2/22 16:36, Paolo Bonzini wrote:
> On 2/18/22 02:46, Richard Henderson wrote:
>>>>>
>>>>> I don't have gobjc/g++ installed, so ./configure defaulted to Clang to
>>>>> compile these languages, but compiled C files using GCC. At the end
>>>>> the
>>>>> Clang linker is used (the default c++ symlink).
>>
>> This is another form of compiler mis-configuration.
>> If you don't have g++ to go with gcc, use --cxx=false to avoid picking
>> up a different compiler.
>
> This would be the kind of problem that this test is trying to cover:
>
> if do_cxx $CXXFLAGS $EXTRA_CXXFLAGS $CONFIGURE_CXXFLAGS
> $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
> # C++ compiler $cxx works ok with C compiler $cc
> :
> else
> echo "C++ compiler $cxx does not work with C compiler $cc"
> echo "Disabling C++ specific optional code"
> cxx=
> fi
>
> In the past it detected issues with libasan/libtsan incompatibilities.
> We should either add a test for atomic operations, or just drop the
> test.
We shouldn't assume gcc is GCC:
$ c++ --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2022-03-06 22:22 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 17:00 [PATCH v2 0/8] buildsys: More fixes to use GCC on macOS Philippe Mathieu-Daudé via
2022-02-15 17:00 ` [PATCH v2 1/8] osdep: Avoid using Clang-specific __builtin_available() Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 2/8] osdep: Ignore 'unguarded-availability-new' warnings on macOS Catalina Philippe Mathieu-Daudé via
2022-02-16 2:36 ` Akihiko Odaki
2022-02-15 17:01 ` [PATCH v2 3/8] meson: Resolve the entitlement.sh script once for good Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 4/8] configure: Disable out-of-line atomic operations on Aarch64 Philippe Mathieu-Daudé via
2022-02-16 2:41 ` Akihiko Odaki
2022-02-16 10:19 ` Richard Henderson
2022-02-16 15:08 ` Philippe Mathieu-Daudé via
2022-02-16 16:42 ` Akihiko Odaki
2022-02-16 17:18 ` Philippe Mathieu-Daudé via
2022-02-16 17:19 ` Peter Maydell
2022-02-18 1:46 ` Richard Henderson
2022-02-18 15:36 ` Paolo Bonzini
2022-03-06 22:21 ` Philippe Mathieu-Daudé
2022-02-18 15:42 ` Paolo Bonzini
2022-02-15 17:01 ` [PATCH v2 5/8] meson: Log QEMU_CXXFLAGS content in summary Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 6/8] configure: Pass filtered QEMU_OBJCFLAGS to meson Philippe Mathieu-Daudé via
2022-02-18 15:44 ` Paolo Bonzini
2022-02-15 17:01 ` [PATCH v2 7/8] audio: Rename coreaudio extension to use Objective-C compiler Philippe Mathieu-Daudé via
2022-02-15 17:01 ` [PATCH v2 8/8] ui/cocoa: Constify qkeycode translation arrays Philippe Mathieu-Daudé via
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).