Commit b53a99b9 authored by Janne Grunau's avatar Janne Grunau

arm: define PIC if the compiler uses pic by default

Necessary for the way fedora enables `-fPIE` by default for package
builds. Fixes #221.
parent 7677c120
...@@ -230,6 +230,23 @@ if (is_asm_enabled and ...@@ -230,6 +230,23 @@ if (is_asm_enabled and
''' '''
have_as_func = cc.compiles(as_func_code) have_as_func = cc.compiles(as_func_code)
cdata.set10('HAVE_AS_FUNC', have_as_func) 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 endif
if host_machine.cpu_family().startswith('x86') if host_machine.cpu_family().startswith('x86')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment