aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2020-06-05 12:57:04 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2020-06-05 12:57:04 +0000
commit5c9b4f4a8bbe0cf29979edc2885a4466a65d6bd4 (patch)
tree9e932ef63b7fc3263a665a4252715a5dfbf4a72b /graphics
parenta3f5645083ffc7a4612617d6514aa0b71e0af4bb (diff)
downloadports-5c9b4f4a8bbe0cf29979edc2885a4466a65d6bd4.tar.gz
ports-5c9b4f4a8bbe0cf29979edc2885a4466a65d6bd4.zip
mesa*: Fix build on i386
Fix build related to libatomic on i386. Simply copy the patch from mesa-devel. Reported by: jbeich Approved by: zeising (x11@ implicit)
Notes
Notes: svn path=/head/; revision=538015
Diffstat (limited to 'graphics')
-rw-r--r--graphics/mesa-dri/files/patch-i38653
1 files changed, 53 insertions, 0 deletions
diff --git a/graphics/mesa-dri/files/patch-i386 b/graphics/mesa-dri/files/patch-i386
new file mode 100644
index 000000000000..eda3c160bcb5
--- /dev/null
+++ b/graphics/mesa-dri/files/patch-i386
@@ -0,0 +1,53 @@
+FreeBSD doesn't ship libatomic for Clang to use, so use __sync* atomics.
+https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230888
+
+Checking if "GCC atomic builtins" compiles: YES
+Checking if "GCC atomic builtins required -latomic" links: NO
+
+meson.build:1098:4: ERROR: C library 'atomic' not found
+
+ld.lld: error: undefined symbol: __atomic_load_8
+>>> referenced by testfile.c
+>>> /tmp/testfile-055958.o:(main)
+
+ld.lld: error: undefined symbol: __atomic_fetch_add_8
+>>> referenced by testfile.c
+>>> /tmp/testfile-055958.o:(main)
+cc: error: linker command failed with exit code 1 (use -v to see invocation)
+
+--- meson.build.orig 2020-05-30 21:28:01 UTC
++++ meson.build
+@@ -1068,7 +1068,7 @@ endif
+ # Check for GCC style atomics
+ dep_atomic = null_dep
+
+-if cc.compiles('''#include <stdint.h>
++if cc.links('''#include <stdint.h>
+ int main() {
+ struct {
+ uint64_t *v;
+@@ -1079,24 +1079,6 @@ if cc.compiles('''#include <stdint.h>
+ }''',
+ name : 'GCC atomic builtins')
+ pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
+-
+- # Not all atomic calls can be turned into lock-free instructions, in which
+- # GCC will make calls into the libatomic library. Check whether we need to
+- # link with -latomic.
+- #
+- # This can happen for 64-bit atomic operations on 32-bit architectures such
+- # as ARM.
+- if not cc.links('''#include <stdint.h>
+- int main() {
+- struct {
+- uint64_t *v;
+- } x;
+- return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
+- (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
+- }''',
+- name : 'GCC atomic builtins required -latomic')
+- dep_atomic = cc.find_library('atomic')
+- endif
+ endif
+ if not cc.links('''#include <stdint.h>
+ uint64_t v;