Skip to content
Snippets Groups Projects
Commit b53a99b9 authored by Janne Grunau's avatar Janne Grunau
Browse files

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
No related branches found
No related tags found
1 merge request!502arm: define PIC if the compiler uses PIC by default
Pipeline #3573 passed with stages
in 4 minutes and 40 seconds
......@@ -230,6 +230,23 @@ if (is_asm_enabled and
'''
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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment