diff options
Diffstat (limited to 'test cases/linuxlike/3 linker script')
-rw-r--r-- | test cases/linuxlike/3 linker script/bob.c | 9 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/bob.h | 6 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/bob.map | 6 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/bob.map.in | 6 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/copy.py | 5 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/meson.build | 62 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/prog.c | 5 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/sub/foo.map | 6 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/sub/meson.build | 6 |
9 files changed, 111 insertions, 0 deletions
diff --git a/test cases/linuxlike/3 linker script/bob.c b/test cases/linuxlike/3 linker script/bob.c new file mode 100644 index 0000000..50e29c7 --- /dev/null +++ b/test cases/linuxlike/3 linker script/bob.c @@ -0,0 +1,9 @@ +#include"bob.h" + +int hiddenFunction(void) { + return 42; +} + +int bobMcBob(void) { + return hiddenFunction(); +} diff --git a/test cases/linuxlike/3 linker script/bob.h b/test cases/linuxlike/3 linker script/bob.h new file mode 100644 index 0000000..351e2fc --- /dev/null +++ b/test cases/linuxlike/3 linker script/bob.h @@ -0,0 +1,6 @@ +#ifndef BOB_H_ +#define BOB_H_ + +int bobMcBob(void); + +#endif diff --git a/test cases/linuxlike/3 linker script/bob.map b/test cases/linuxlike/3 linker script/bob.map new file mode 100644 index 0000000..e07a780 --- /dev/null +++ b/test cases/linuxlike/3 linker script/bob.map @@ -0,0 +1,6 @@ +V1_0_0 { + global: + "bobMcBob"; + local: + *; +}; diff --git a/test cases/linuxlike/3 linker script/bob.map.in b/test cases/linuxlike/3 linker script/bob.map.in new file mode 100644 index 0000000..f695e4a --- /dev/null +++ b/test cases/linuxlike/3 linker script/bob.map.in @@ -0,0 +1,6 @@ +V1_0_0 { + global: + "@in@"; + local: + *; +}; diff --git a/test cases/linuxlike/3 linker script/copy.py b/test cases/linuxlike/3 linker script/copy.py new file mode 100644 index 0000000..49e7a85 --- /dev/null +++ b/test cases/linuxlike/3 linker script/copy.py @@ -0,0 +1,5 @@ +import shutil +import sys + +if __name__ == '__main__': + shutil.copy(sys.argv[1], sys.argv[2]) diff --git a/test cases/linuxlike/3 linker script/meson.build b/test cases/linuxlike/3 linker script/meson.build new file mode 100644 index 0000000..5901bf7 --- /dev/null +++ b/test cases/linuxlike/3 linker script/meson.build @@ -0,0 +1,62 @@ +project('linker script', 'c') + +# Solaris 11.4 ld supports --version-script only when you also specify +# -z gnu-version-script-compat +if meson.get_compiler('c').get_linker_id() == 'ld.solaris' + add_project_link_arguments('-Wl,-z,gnu-version-script-compat', language: 'C') +endif + +# Static map file +mapfile = 'bob.map' +vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) + +l = shared_library('bob', 'bob.c', link_args : vflag, link_depends : mapfile) +e = executable('prog', 'prog.c', link_with : l) +test('core', e) + +# configure_file +conf = configuration_data() +conf.set('in', 'bobMcBob') +m = configure_file( + input : 'bob.map.in', + output : 'bob-conf.map', + configuration : conf, +) +vflag = '-Wl,--version-script,@0@'.format(m) + +l = shared_library('bob-conf', 'bob.c', link_args : vflag, link_depends : m) +e = executable('prog-conf', 'prog.c', link_with : l) +test('core', e) + +# custom_target +python = find_program('python3') +m = custom_target( + 'bob-ct.map', + command : [python, '@INPUT0@', '@INPUT1@', 'bob-ct.map'], + input : ['copy.py', 'bob.map'], + output : 'bob-ct.map', + depend_files : 'bob.map', +) +vflag = '-Wl,--version-script,@0@'.format(m.full_path()) + +l = shared_library('bob-ct', ['bob.c', m], link_args : vflag, link_depends : m) +e = executable('prog-ct', 'prog.c', link_with : l) +test('core', e) + +# File +mapfile = files('bob.map') +vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile[0]) + +l = shared_library('bob-files', 'bob.c', link_args : vflag, link_depends : mapfile) +e = executable('prog-files', 'prog.c', link_with : l) +test('core', e) + +subdir('sub') + +# With map file in subdir +mapfile = 'sub/foo.map' +vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) + +l = shared_library('bar', 'bob.c', link_args : vflag, link_depends : mapfile) +e = executable('prog-bar', 'prog.c', link_with : l) +test('core', e) diff --git a/test cases/linuxlike/3 linker script/prog.c b/test cases/linuxlike/3 linker script/prog.c new file mode 100644 index 0000000..b010b15 --- /dev/null +++ b/test cases/linuxlike/3 linker script/prog.c @@ -0,0 +1,5 @@ +#include"bob.h" + +int main(void) { + return bobMcBob() != 42; +} diff --git a/test cases/linuxlike/3 linker script/sub/foo.map b/test cases/linuxlike/3 linker script/sub/foo.map new file mode 100644 index 0000000..e07a780 --- /dev/null +++ b/test cases/linuxlike/3 linker script/sub/foo.map @@ -0,0 +1,6 @@ +V1_0_0 { + global: + "bobMcBob"; + local: + *; +}; diff --git a/test cases/linuxlike/3 linker script/sub/meson.build b/test cases/linuxlike/3 linker script/sub/meson.build new file mode 100644 index 0000000..93199f3 --- /dev/null +++ b/test cases/linuxlike/3 linker script/sub/meson.build @@ -0,0 +1,6 @@ +mapfile = 'foo.map' +vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile) + +l = shared_library('foo', '../bob.c', link_args : vflag, link_depends : mapfile) +e = executable('prog-foo', '../prog.c', link_with : l) +test('core', e) |