shithub: dav1d

Download patch

ref: b53a99b97f93d0eb15d1f532739ca062fe44b4ca
parent: 7677c12018ac859374bdd864e42cc394fab878b2
author: Janne Grunau <janne-vlc@jannau.net>
date: Sun Dec 16 07:27:55 EST 2018

arm: define PIC if the compiler uses pic by default

Necessary for the way fedora enables `-fPIE` by default for package
builds. Fixes #221.

--- a/meson.build
+++ b/meson.build
@@ -230,6 +230,23 @@
 '''
     have_as_func = cc.compiles(as_func_code)
     cdata.set10('HAVE_AS_FUNC', have_as_func)
+
+    # fedora package build infrastructure uses a gcc specs file to enable
+    # '-fPIE' by default. The chosen way only adds '-fPIE' to the C compiler
+    # with integrated preprocessor. It is not added to the standalone
+    # preprocessor or the preprocessing stage of '.S' files. So we have to
+    # compile code to check if we have to define PIC for the arm asm to
+    # avoid absolute relocations when building for example checkasm.
+    check_pic_code = '''
+#if defined(PIC)
+#error "PIC already defined"
+#elif !(defined(__PIC__) || defined(__pic__))
+#error "no pic"
+#endif
+'''
+    if cc.compiles(check_pic_code)
+        cdata.set('PIC', '3')
+    endif
 endif
 
 if host_machine.cpu_family().startswith('x86')