diff --git a/test cases/common/145 whole archive/allofme/meson.build b/test cases/common/145 whole archive/allofme/meson.build deleted file mode 100644 index f5c2027b5..000000000 --- a/test cases/common/145 whole archive/allofme/meson.build +++ /dev/null @@ -1 +0,0 @@ -stlib = static_library('allofme', '../libfile.c') diff --git a/test cases/common/145 whole archive/exe/meson.build b/test cases/common/145 whole archive/exe/meson.build index f47a24627..91d298dce 100644 --- a/test cases/common/145 whole archive/exe/meson.build +++ b/test cases/common/145 whole archive/exe/meson.build @@ -1,2 +1 @@ -exe = executable('prog', '../prog.c', - link_with : dylib) +exe = executable('prog', '../prog.c', link_with : sh_func2_linked_func1) diff --git a/test cases/common/145 whole archive/exe2/meson.build b/test cases/common/145 whole archive/exe2/meson.build index 5365f03b6..918486402 100644 --- a/test cases/common/145 whole archive/exe2/meson.build +++ b/test cases/common/145 whole archive/exe2/meson.build @@ -1 +1 @@ -exe2 = executable('prog2', '../prog.c', link_with : dylib2) +exe2 = executable('prog2', '../prog.c', link_with : sh_only_link_whole) diff --git a/test cases/common/145 whole archive/libfile.c b/test cases/common/145 whole archive/func1.c similarity index 100% rename from test cases/common/145 whole archive/libfile.c rename to test cases/common/145 whole archive/func1.c diff --git a/test cases/common/145 whole archive/dylib.c b/test cases/common/145 whole archive/func2.c similarity index 100% rename from test cases/common/145 whole archive/dylib.c rename to test cases/common/145 whole archive/func2.c diff --git a/test cases/common/145 whole archive/meson.build b/test cases/common/145 whole archive/meson.build index 617ae0340..56da157bb 100644 --- a/test cases/common/145 whole archive/meson.build +++ b/test cases/common/145 whole archive/meson.build @@ -10,15 +10,23 @@ if cc.get_id() == 'msvc' endif endif -subdir('allofme') -subdir('shlib') +# Test 1: link_whole keeps all symbols +# Make static func1 +subdir('st_func1') +# Make shared func2 linking whole func1 archive +subdir('sh_func2_linked_func1') +# Link exe with shared library only subdir('exe') - +# Test that both func1 and func2 are accessible from shared library test('prog', exe) -# link_whole only -subdir('stlib') -subdir('wholeshlib') +# Test 2: link_whole can be used instead of source list, see #2180 +# Make static func2 +subdir('st_func2') +# Link both func1 and func2 into same shared library +# which does not have any sources other than 2 static libraries +subdir('sh_only_link_whole') +# Link exe2 with shared library only subdir('exe2') - +# Test that both func1 and func2 are accessible from shared library test('prog2', exe2) diff --git a/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build b/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build new file mode 100644 index 000000000..2858f65ec --- /dev/null +++ b/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build @@ -0,0 +1,3 @@ +# Nothing in func2.c uses func1, so the linker would throw it +# away and thus linking the exe would fail. +sh_func2_linked_func1 = shared_library('sh_func2_linked_func1', '../func2.c', link_whole : st_func1) diff --git a/test cases/common/145 whole archive/sh_only_link_whole/meson.build b/test cases/common/145 whole archive/sh_only_link_whole/meson.build new file mode 100644 index 000000000..64baabd5d --- /dev/null +++ b/test cases/common/145 whole archive/sh_only_link_whole/meson.build @@ -0,0 +1 @@ +sh_only_link_whole = shared_library('sh_only_link_whole', link_whole : [st_func1, st_func2]) diff --git a/test cases/common/145 whole archive/shlib/meson.build b/test cases/common/145 whole archive/shlib/meson.build deleted file mode 100644 index 34a1b78a9..000000000 --- a/test cases/common/145 whole archive/shlib/meson.build +++ /dev/null @@ -1,4 +0,0 @@ -# Nothing in dylib.c uses func1, so the linker would throw it -# away and thus linking the exe would fail. -dylib = shared_library('shlib', '../dylib.c', - link_whole : stlib) diff --git a/test cases/common/145 whole archive/st_func1/meson.build b/test cases/common/145 whole archive/st_func1/meson.build new file mode 100644 index 000000000..c84d78109 --- /dev/null +++ b/test cases/common/145 whole archive/st_func1/meson.build @@ -0,0 +1 @@ +st_func1 = static_library('st_func1', '../func1.c') diff --git a/test cases/common/145 whole archive/st_func2/meson.build b/test cases/common/145 whole archive/st_func2/meson.build new file mode 100644 index 000000000..2732f96ec --- /dev/null +++ b/test cases/common/145 whole archive/st_func2/meson.build @@ -0,0 +1 @@ +st_func2 = static_library('st_func2', '../func2.c') diff --git a/test cases/common/145 whole archive/stlib/meson.build b/test cases/common/145 whole archive/stlib/meson.build deleted file mode 100644 index 07a434e06..000000000 --- a/test cases/common/145 whole archive/stlib/meson.build +++ /dev/null @@ -1 +0,0 @@ -static = static_library('static', '../dylib.c') diff --git a/test cases/common/145 whole archive/wholeshlib/meson.build b/test cases/common/145 whole archive/wholeshlib/meson.build deleted file mode 100644 index 69a1995ce..000000000 --- a/test cases/common/145 whole archive/wholeshlib/meson.build +++ /dev/null @@ -1 +0,0 @@ -dylib2 = shared_library('link_whole', link_whole : [stlib, static])