Don't rely on -fPIC being ignored where it's meaningless
clang considers it an error to try to use -fPIC for a windows target v2: '' isn't consistently elided, use []
This commit is contained in:
parent
6700a8bfd7
commit
65160a969e
|
@ -2165,7 +2165,9 @@ int main(int argc, char **argv) {
|
|||
'/NOLOGO', '/DLL', '/DEBUG', '/IMPLIB:' + impfile,
|
||||
'/OUT:' + outfile, objectfile]
|
||||
else:
|
||||
extra_args += ['-fPIC']
|
||||
if not (compiler.compiler_type.is_windows_compiler or
|
||||
compiler.compiler_type.is_osx_compiler):
|
||||
extra_args += ['-fPIC']
|
||||
link_cmd = compiler.get_exelist() + ['-shared', '-o', outfile, objectfile]
|
||||
if not mesonbuild.mesonlib.is_osx():
|
||||
link_cmd += ['-Wl,-soname=' + os.path.basename(outfile)]
|
||||
|
@ -3495,7 +3497,7 @@ class LinuxlikeTests(BasePlatformTests):
|
|||
is true and not when it is false. This can't be an ordinary test case
|
||||
because we need to inspect the compiler database.
|
||||
'''
|
||||
if is_cygwin() or is_osx():
|
||||
if is_windows() or is_cygwin() or is_osx():
|
||||
raise unittest.SkipTest('PIC not relevant')
|
||||
|
||||
testdir = os.path.join(self.common_test_dir, '3 static')
|
||||
|
|
|
@ -36,7 +36,11 @@ if cxx.get_argument_syntax() == 'msvc'
|
|||
compile_cmd = ['/c', '@INPUT@', '/Fo@OUTPUT@']
|
||||
stlib_cmd = [static_linker, '/OUT:@OUTPUT@', '@INPUT@']
|
||||
else
|
||||
compile_cmd = ['-c', '-fPIC', '@INPUT@', '-o', '@OUTPUT@']
|
||||
picflag = []
|
||||
if not ['darwin', 'windows'].contains(host_machine.system())
|
||||
picflag = ['-fPIC']
|
||||
endif
|
||||
compile_cmd = ['-c', picflag, '@INPUT@', '-o', '@OUTPUT@']
|
||||
stlib_cmd = ['ar', 'csr', '@OUTPUT@', '@INPUT@']
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
project('statchain', 'c')
|
||||
|
||||
subdir('subdir')
|
||||
# Test that -fPIC in c_args is also accepted
|
||||
statlib2 = static_library('stat2', 'stat2.c', c_args : '-fPIC', pic : false)
|
||||
# Test that -fPIC in c_args is also accepted (on platforms where it's permitted)
|
||||
picflag = []
|
||||
if not ['darwin', 'windows'].contains(host_machine.system())
|
||||
picflag = ['-fPIC']
|
||||
endif
|
||||
statlib2 = static_library('stat2', 'stat2.c', c_args : picflag, pic : false)
|
||||
# Test that pic is needed for both direct and indirect static library
|
||||
# dependencies of shared libraries (on Linux and BSD)
|
||||
statlib = static_library('stat', 'stat.c', link_with : [shlib, statlib2], pic : true)
|
||||
|
|
Loading…
Reference in New Issue