summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-10-10 19:22:41 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-10-10 23:28:19 +0530
commit2d0eb2cec5abc46f7152a4dfb115e816c9199b2d (patch)
tree933ec57a324f565a96859eebcf48363f7edaa01e /test cases
parente2b3752f875754abcc3981754505ae0db9e18155 (diff)
downloadmeson-2d0eb2cec5abc46f7152a4dfb115e816c9199b2d.tar.gz
Warn if -fPIC is passed instead of pic to static libraries
Also print the name of the static library that has PIC-related issues, print more details in exceptions, and test for all this.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/62 exe static shared/meson.build6
-rw-r--r--test cases/common/62 exe static shared/shlib2.c3
-rw-r--r--test cases/common/62 exe static shared/stat2.c3
3 files changed, 10 insertions, 2 deletions
diff --git a/test cases/common/62 exe static shared/meson.build b/test cases/common/62 exe static shared/meson.build
index 8631e68f1..288888284 100644
--- a/test cases/common/62 exe static shared/meson.build
+++ b/test cases/common/62 exe static shared/meson.build
@@ -1,7 +1,11 @@
project('statchain', 'c')
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)
exe = executable('prog', 'prog.c', link_with : shlib2)
test('runtest', exe)
diff --git a/test cases/common/62 exe static shared/shlib2.c b/test cases/common/62 exe static shared/shlib2.c
index e26d11c73..12bc913d7 100644
--- a/test cases/common/62 exe static shared/shlib2.c
+++ b/test cases/common/62 exe static shared/shlib2.c
@@ -1,7 +1,8 @@
#include "subdir/exports.h"
int statlibfunc(void);
+int statlibfunc2(void);
int DLL_PUBLIC shlibfunc2(void) {
- return statlibfunc() - 18;
+ return statlibfunc() - statlibfunc2();
}
diff --git a/test cases/common/62 exe static shared/stat2.c b/test cases/common/62 exe static shared/stat2.c
new file mode 100644
index 000000000..4ae3775f7
--- /dev/null
+++ b/test cases/common/62 exe static shared/stat2.c
@@ -0,0 +1,3 @@
+int statlibfunc2() {
+ return 18;
+}