From cd245eccbdf3b5b999055fd72ff942f1327ec54d Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Sun, 18 Feb 2018 07:58:21 +0000 Subject: [PATCH] Add declare_dependency() test for link_whole --- test cases/common/145 whole archive/exe3/meson.build | 1 + test cases/common/145 whole archive/meson.build | 9 +++++++++ .../145 whole archive/sh_func2_dep_func1/meson.build | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 test cases/common/145 whole archive/exe3/meson.build create mode 100644 test cases/common/145 whole archive/sh_func2_dep_func1/meson.build diff --git a/test cases/common/145 whole archive/exe3/meson.build b/test cases/common/145 whole archive/exe3/meson.build new file mode 100644 index 000000000..82cf57e05 --- /dev/null +++ b/test cases/common/145 whole archive/exe3/meson.build @@ -0,0 +1 @@ +exe3 = executable('prog3', '../prog.c', link_with : sh_func2_dep_func1) diff --git a/test cases/common/145 whole archive/meson.build b/test cases/common/145 whole archive/meson.build index 56da157bb..d5d5ed23f 100644 --- a/test cases/common/145 whole archive/meson.build +++ b/test cases/common/145 whole archive/meson.build @@ -30,3 +30,12 @@ subdir('sh_only_link_whole') subdir('exe2') # Test that both func1 and func2 are accessible from shared library test('prog2', exe2) + +# Test 3: link_whole can be used in declare_dependency() +func1_dep = declare_dependency(link_whole : [st_func1]) +# Use dependency to link func1 into shared library +subdir('sh_func2_dep_func1') +# Link exe3 with shared library +subdir('exe3') +# Test that both func1 and func2 are accessible from shared library +test('prog3', exe3) diff --git a/test cases/common/145 whole archive/sh_func2_dep_func1/meson.build b/test cases/common/145 whole archive/sh_func2_dep_func1/meson.build new file mode 100644 index 000000000..92baca6fb --- /dev/null +++ b/test cases/common/145 whole archive/sh_func2_dep_func1/meson.build @@ -0,0 +1,4 @@ +# Same as sh_func2_linked_func1, # func2.c does not depend on func1(), +# so without link_whole compiler would throw func1() away. +# This is the same version of the test with a dependency object instead. +sh_func2_dep_func1 = shared_library('sh_func2_dep_func1', '../func2.c', dependencies : func1_dep)