diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/failing/32 exe static shared | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/failing/32 exe static shared')
5 files changed, 47 insertions, 0 deletions
diff --git a/meson/test cases/failing/32 exe static shared/meson.build b/meson/test cases/failing/32 exe static shared/meson.build new file mode 100644 index 000000000..2ae512583 --- /dev/null +++ b/meson/test cases/failing/32 exe static shared/meson.build @@ -0,0 +1,11 @@ +project('statchain', 'c') + +host_system = host_machine.system() +if host_system == 'windows' or host_system == 'darwin' + error('MESON_SKIP_TEST test only fails on Linux and BSD') +endif + +statlib = static_library('stat', 'stat.c', pic : false) +shlib2 = shared_library('shr2', 'shlib2.c', link_with : statlib) +exe = executable('prog', 'prog.c', link_with : shlib2) +test('runtest', exe) diff --git a/meson/test cases/failing/32 exe static shared/prog.c b/meson/test cases/failing/32 exe static shared/prog.c new file mode 100644 index 000000000..26603b694 --- /dev/null +++ b/meson/test cases/failing/32 exe static shared/prog.c @@ -0,0 +1,10 @@ +int shlibfunc2(); +int statlibfunc(); + +int main(int argc, char **argv) { + if (statlibfunc() != 42) + return 1; + if (shlibfunc2() != 24) + return 1; + return 0; +} diff --git a/meson/test cases/failing/32 exe static shared/shlib2.c b/meson/test cases/failing/32 exe static shared/shlib2.c new file mode 100644 index 000000000..5b68843dc --- /dev/null +++ b/meson/test cases/failing/32 exe static shared/shlib2.c @@ -0,0 +1,16 @@ +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int statlibfunc(void); + +int DLL_PUBLIC shlibfunc2(void) { + return 24; +} diff --git a/meson/test cases/failing/32 exe static shared/stat.c b/meson/test cases/failing/32 exe static shared/stat.c new file mode 100644 index 000000000..56ec66c67 --- /dev/null +++ b/meson/test cases/failing/32 exe static shared/stat.c @@ -0,0 +1,3 @@ +int statlibfunc() { + return 42; +} diff --git a/meson/test cases/failing/32 exe static shared/test.json b/meson/test cases/failing/32 exe static shared/test.json new file mode 100644 index 000000000..51d38046b --- /dev/null +++ b/meson/test cases/failing/32 exe static shared/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/failing/32 exe static shared/meson.build:9:0: ERROR: Can't link non-PIC static library 'stat' into shared library 'shr2'. Use the 'pic' option to static_library to build with PIC." + } + ] +} |