diff options
Diffstat (limited to '')
19 files changed, 181 insertions, 0 deletions
diff --git a/test cases/unit/66 static link/lib/func1.c b/test cases/unit/66 static link/lib/func1.c new file mode 100644 index 0000000..cc934ad --- /dev/null +++ b/test cases/unit/66 static link/lib/func1.c @@ -0,0 +1,9 @@ +int func1() +{ + return 1; +} + +int func1b() +{ + return 1; +} diff --git a/test cases/unit/66 static link/lib/func10.c b/test cases/unit/66 static link/lib/func10.c new file mode 100644 index 0000000..75a911f --- /dev/null +++ b/test cases/unit/66 static link/lib/func10.c @@ -0,0 +1,4 @@ +int func10() +{ + return 1; +} diff --git a/test cases/unit/66 static link/lib/func11.c b/test cases/unit/66 static link/lib/func11.c new file mode 100644 index 0000000..1d5119b --- /dev/null +++ b/test cases/unit/66 static link/lib/func11.c @@ -0,0 +1,6 @@ +int func10(); + +int func11() +{ + return func10() + 1; +} diff --git a/test cases/unit/66 static link/lib/func12.c b/test cases/unit/66 static link/lib/func12.c new file mode 100644 index 0000000..73db5c0 --- /dev/null +++ b/test cases/unit/66 static link/lib/func12.c @@ -0,0 +1,7 @@ +int func10(); +int func11(); + +int func12() +{ + return func10() + func11(); +} diff --git a/test cases/unit/66 static link/lib/func14.c b/test cases/unit/66 static link/lib/func14.c new file mode 100644 index 0000000..0277319 --- /dev/null +++ b/test cases/unit/66 static link/lib/func14.c @@ -0,0 +1,4 @@ +int func14() +{ + return 1; +} diff --git a/test cases/unit/66 static link/lib/func15.c b/test cases/unit/66 static link/lib/func15.c new file mode 100644 index 0000000..78303cc --- /dev/null +++ b/test cases/unit/66 static link/lib/func15.c @@ -0,0 +1,6 @@ +int func14(); + +int func15() +{ + return func14() + 1; +} diff --git a/test cases/unit/66 static link/lib/func16.c b/test cases/unit/66 static link/lib/func16.c new file mode 100644 index 0000000..379b682 --- /dev/null +++ b/test cases/unit/66 static link/lib/func16.c @@ -0,0 +1,6 @@ +int func15(); + +int func16() +{ + return func15() + 1; +} diff --git a/test cases/unit/66 static link/lib/func17.c b/test cases/unit/66 static link/lib/func17.c new file mode 100644 index 0000000..d1d8ec4 --- /dev/null +++ b/test cases/unit/66 static link/lib/func17.c @@ -0,0 +1,4 @@ +int func17() +{ + return 1; +} diff --git a/test cases/unit/66 static link/lib/func18.c b/test cases/unit/66 static link/lib/func18.c new file mode 100644 index 0000000..c149085 --- /dev/null +++ b/test cases/unit/66 static link/lib/func18.c @@ -0,0 +1,6 @@ +int func17(); + +int func18() +{ + return func17() + 1; +} diff --git a/test cases/unit/66 static link/lib/func19.c b/test cases/unit/66 static link/lib/func19.c new file mode 100644 index 0000000..69120e4 --- /dev/null +++ b/test cases/unit/66 static link/lib/func19.c @@ -0,0 +1,7 @@ +int func17(); +int func18(); + +int func19() +{ + return func17() + func18(); +} diff --git a/test cases/unit/66 static link/lib/func2.c b/test cases/unit/66 static link/lib/func2.c new file mode 100644 index 0000000..6b8f539 --- /dev/null +++ b/test cases/unit/66 static link/lib/func2.c @@ -0,0 +1,6 @@ +int func1(); + +int func2() +{ + return func1() + 1; +} diff --git a/test cases/unit/66 static link/lib/func3.c b/test cases/unit/66 static link/lib/func3.c new file mode 100644 index 0000000..04f9f89 --- /dev/null +++ b/test cases/unit/66 static link/lib/func3.c @@ -0,0 +1,4 @@ +int func3() +{ + return 1; +} diff --git a/test cases/unit/66 static link/lib/func4.c b/test cases/unit/66 static link/lib/func4.c new file mode 100644 index 0000000..c44c990 --- /dev/null +++ b/test cases/unit/66 static link/lib/func4.c @@ -0,0 +1,6 @@ +int func3(); + +int func4() +{ + return func3() + 1; +} diff --git a/test cases/unit/66 static link/lib/func5.c b/test cases/unit/66 static link/lib/func5.c new file mode 100644 index 0000000..8e07864 --- /dev/null +++ b/test cases/unit/66 static link/lib/func5.c @@ -0,0 +1,4 @@ +int func5() +{ + return 1; +} diff --git a/test cases/unit/66 static link/lib/func6.c b/test cases/unit/66 static link/lib/func6.c new file mode 100644 index 0000000..276fe7d --- /dev/null +++ b/test cases/unit/66 static link/lib/func6.c @@ -0,0 +1,6 @@ +int func5(); + +int func6() +{ + return func5() + 1; +} diff --git a/test cases/unit/66 static link/lib/func7.c b/test cases/unit/66 static link/lib/func7.c new file mode 100644 index 0000000..8c1a536 --- /dev/null +++ b/test cases/unit/66 static link/lib/func7.c @@ -0,0 +1,4 @@ +int func7() +{ + return 1; +} diff --git a/test cases/unit/66 static link/lib/func8.c b/test cases/unit/66 static link/lib/func8.c new file mode 100644 index 0000000..b7b6cd5 --- /dev/null +++ b/test cases/unit/66 static link/lib/func8.c @@ -0,0 +1,6 @@ +int func7(); + +int func8() +{ + return func7() + 1; +} diff --git a/test cases/unit/66 static link/lib/func9.c b/test cases/unit/66 static link/lib/func9.c new file mode 100644 index 0000000..852252d --- /dev/null +++ b/test cases/unit/66 static link/lib/func9.c @@ -0,0 +1,6 @@ +int func8(); + +int func9() +{ + return func8() + 1; +} diff --git a/test cases/unit/66 static link/lib/meson.build b/test cases/unit/66 static link/lib/meson.build new file mode 100644 index 0000000..8f95fc4 --- /dev/null +++ b/test cases/unit/66 static link/lib/meson.build @@ -0,0 +1,80 @@ +project('test static link libs', 'c') + +pkg = import('pkgconfig') + +# libfunc2 should contain both func1() and func2() symbols +libfunc1 = static_library('func1', 'func1.c', + install : false) +libfunc2 = static_library('func2', 'func2.c', + link_whole : libfunc1, + install : true) + +# Same as above, but with link_with instead of link_whole, +# libfunc4 should contain both func3() and func4() symbols +libfunc3 = static_library('func3', 'func3.c', + install : false) +libfunc4 = static_library('func4', 'func4.c', + link_with : libfunc3, + install : true) + +# Same as above, but also generate an pkg-config file. Use both_libraries() to +# make sure a complete .pc file gets generated. libfunc5 should not be mentioned +# into the .pc file because it's not installed. +libfunc5 = static_library('func5', 'func5.c', + install : false) +libfunc6 = both_libraries('func6', 'func6.c', + link_with : libfunc5, + install : true) +pkg.generate(libfunc6) + +# libfunc9 should contain both func8() and func9() but not func7() because that +# one gets installed. Also test that link_with and link_whole works the same way +# because libfunc8 is uninstalled. +libfunc7 = static_library('func7', 'func7.c', + install : true) +libfunc8 = static_library('func8', 'func8.c', + link_with : libfunc7, + install : false) +libfunc9_linkwith = static_library('func9_linkwith', 'func9.c', + link_with : libfunc8, + install : true) +libfunc9_linkwhole = static_library('func9_linkwhole', 'func9.c', + link_whole : libfunc8, + install : true) + +# Pattern found in mesa: +# - libfunc11 uses func10() +# - libfunc12 uses both func10() and func11() +# When a shared library link_whole on libfunc12, we ensure we don't include +# func10.c.o twice which would fail to link. +libfunc10 = static_library('func10', 'func10.c', + install : false) +libfunc11 = static_library('func11', 'func11.c', + link_with : libfunc10, + install : false) +libfunc12 = static_library('func12', 'func12.c', + link_with : [libfunc10, libfunc11], + install : false) +libfunc13 = shared_library('func13', link_whole : libfunc12) + +# libfunc16 should contain func14(), func15() and func16() +libfunc14 = static_library('func14', 'func14.c', + install : false) +libfunc15 = static_library('func15', 'func15.c', + link_with : libfunc14, + install : false) +libfunc16 = static_library('func16', 'func16.c', + link_with : libfunc15, + install : true) + +# Verify func17.c.o gets included only once into libfunc19, otherwise +# func19-shared would failed with duplicated symbol. +libfunc17 = static_library('func17', 'func17.c', + install : false) +libfunc18 = static_library('func18', 'func18.c', + link_with : libfunc17, + install : false) +libfunc19 = static_library('func19', 'func19.c', + link_whole : [libfunc17, libfunc18], + install : false) +shared_library('func19-shared', link_whole : [libfunc19]) |