compiling issues on arm+neon with LTO
Hi,
(I'm the new fedora package maintainer, picked waypipe up a month or two ago)
On fedora33 mass rebuild, it looks like linking the final binaries now also require passing -mfpu=neon
when you try to link with kernel_neon.a
(and by extension kernel_libs or lib_waypipe_src probably)
Here's logs: https://kojipkgs.fedoraproject.org//work/tasks/2576/48362576/build.log
Here's bz for failure: https://bugzilla.redhat.com/show_bug.cgi?id=1865619
I assume that is due to LTO rather than new compiler version, so it might be possible to test with an older/existing compiler if you have an arm machine around, but I unfortunately don't (well I could try on my phone I guess but it's a bit short on everything) So, first thing first, would you happen to be able to test?
If so I believe the following patch should fix it (happy to open a MR but I don't like untested code) If you can't test I'll just try it at random and push another fedora build and keep you up to date/submit a MR once fixed :(
diff --git a/src/meson.build b/src/meson.build
index bfdb56275661..ccec8081ae47 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -37,6 +37,7 @@ if cc.has_argument('-msse3')
kernel_libs += static_library('kernel_sse3', 'kernel_sse3.c', c_args:['-msse3'])
config_data.set('HAVE_SSE3', 1, description: 'Compiler supports SSE 3')
endif
+neon_args = []
if host_machine.cpu_family() == 'aarch64' or cc.has_argument('-mfpu=neon')
neon_args = host_machine.cpu_family() == 'aarch64' ? [] : ['-mfpu=neon']
@@ -65,11 +66,13 @@ lib_waypipe_src = static_library(
include_directories: waypipe_includes,
link_with: kernel_libs,
dependencies: waypipe_deps,
+ c_args: neon_args,
)
waypipe_prog = executable(
'waypipe',
['waypipe.c', 'bench.c', 'client.c', 'server.c'],
link_with: lib_waypipe_src,
- install: true
+ install: true,
+ c_args: neon_args,
)
diff --git a/test/meson.build b/test/meson.build
index bf1a0cc45c03..249b9646f098 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -4,14 +4,16 @@ test_diff = executable(
'diff_roundtrip',
['diff_roundtrip.c'],
include_directories: waypipe_includes,
- link_with: lib_waypipe_src
+ link_with: lib_waypipe_src,
+ c_args: neon_args,
)
test('Whether diff operations successfully roundtrip', test_diff, timeout: 60)
test_damage = executable(
'damage_merge',
['damage_merge.c'],
include_directories: waypipe_includes,
- link_with: lib_waypipe_src
+ link_with: lib_waypipe_src,
+ c_args: neon_args,
)
test('If damage rectangles merge efficiently', test_damage, timeout: 5)
test_mirror = executable(
@@ -19,7 +21,8 @@ test_mirror = executable(
['fd_mirror.c'],
include_directories: waypipe_includes,
link_with: lib_waypipe_src,
- dependencies: [libgbm]
+ dependencies: [libgbm],
+ c_args: neon_args,
)
# disable leak checking, because library code is often responsible
test('How well buffers are replicated', test_mirror, env: ['ASAN_OPTIONS=detect_leaks=0'], timeout: 40)
@@ -27,7 +30,8 @@ test_pipe = executable(
'pipe_mirror',
['pipe_mirror.c'],
include_directories: waypipe_includes,
- link_with: lib_waypipe_src
+ link_with: lib_waypipe_src,
+ c_args: neon_args,
)
test('How well pipes are replicated', test_pipe, timeout: 20)
test_fnlist = files('test_fnlist.txt')
@@ -48,7 +52,8 @@ test_parse = executable(
['wire_parse.c', testproto_src, testproto_header],
include_directories: waypipe_includes,
link_with: lib_waypipe_src,
- dependencies: [protos]
+ dependencies: [protos],
+ c_args: neon_args,
)
test('That protocol parsing fails cleanly', test_parse, timeout: 5)
@@ -100,12 +105,14 @@ fuzz_hook_ext = executable(
['fuzz_hook_ext.c'],
include_directories: waypipe_includes,
link_with: lib_waypipe_src,
- dependencies: [pthreads]
+ dependencies: [pthreads],
+ c_args: neon_args,
)
fuzz_hook_int = executable(
'fuzz_hook_int',
['fuzz_hook_int.c'],
include_directories: waypipe_includes,
link_with: lib_waypipe_src,
- dependencies: [pthreads]
+ dependencies: [pthreads],
+ c_args: neon_args,
)