Merge pull request #885 from centricular/fix-staticlib-pic-error
Warn if -fPIC is passed instead of pic to static libraries (instead of erroring out)pull/868/head
commit
3a3db9fc5e
5 changed files with 24 additions and 11 deletions
@ -1,7 +1,11 @@ |
|||||||
project('statchain', 'c') |
project('statchain', 'c') |
||||||
|
|
||||||
subdir('subdir') |
subdir('subdir') |
||||||
statlib = static_library('stat', 'stat.c', link_with : shlib, pic : true) |
# Test that -fPIC in c_args is also accepted |
||||||
|
statlib2 = static_library('stat2', 'stat2.c', c_args : '-fPIC', 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) |
||||||
shlib2 = shared_library('shr2', 'shlib2.c', link_with : statlib) |
shlib2 = shared_library('shr2', 'shlib2.c', link_with : statlib) |
||||||
exe = executable('prog', 'prog.c', link_with : shlib2) |
exe = executable('prog', 'prog.c', link_with : shlib2) |
||||||
test('runtest', exe) |
test('runtest', exe) |
||||||
|
@ -1,7 +1,8 @@ |
|||||||
#include "subdir/exports.h" |
#include "subdir/exports.h" |
||||||
|
|
||||||
int statlibfunc(void); |
int statlibfunc(void); |
||||||
|
int statlibfunc2(void); |
||||||
|
|
||||||
int DLL_PUBLIC shlibfunc2(void) { |
int DLL_PUBLIC shlibfunc2(void) { |
||||||
return statlibfunc() - 18; |
return statlibfunc() - statlibfunc2(); |
||||||
} |
} |
||||||
|
@ -0,0 +1,3 @@ |
|||||||
|
int statlibfunc2() { |
||||||
|
return 18; |
||||||
|
} |
Loading…
Reference in new issue