Debian Codegraph @

test cases/linuxlike/3 linker script/meson.build

raw
1 project('linker script', 'c', default_options : {'prefix': '/tmp'})
2
3 # Solaris 11.4 ld supports --version-script only when you also specify
4 # -z gnu-version-script-compat
5 if meson.get_compiler('c').get_linker_id() == 'ld.solaris'
6 add_project_link_arguments('-Wl,-z,gnu-version-script-compat', language: 'C')
7 endif
8
9 # Static map file
10 mapfile = 'bob.map'
11 vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
12
13 l = shared_library('bob', 'bob.c', link_args : vflag, link_depends : mapfile)
14 e = executable('prog', 'prog.c', link_with : l)
15 test('core', e)
16
17 # configure_file
18 conf = configuration_data()
19 conf.set('in', 'bobMcBob')
20 m = configure_file(
21 input : 'bob.map.in',
22 output : 'bob-conf.map',
23 configuration : conf,
24 )
25 vflag = '-Wl,--version-script,@0@'.format(meson.current_build_dir() / 'bob-conf.map')
26
27 l = shared_library('bob-conf', 'bob.c', link_args : vflag, link_depends : m)
28 e = executable('prog-conf', 'prog.c', link_with : l)
29 test('core', e)
30
31 # custom_target
32 python = find_program('python3')
33 m = custom_target(
34 'bob-ct.map',
35 command : [python, '@INPUT0@', '@INPUT1@', 'bob-ct.map'],
36 input : ['copy.py', 'bob.map'],
37 output : 'bob-ct.map',
38 depend_files : 'bob.map',
39 )
40 vflag = '-Wl,--version-script,@0@'.format(m.full_path())
41
42 l = shared_library('bob-ct', ['bob.c', m], link_args : vflag, link_depends : m)
43 e = executable('prog-ct', 'prog.c', link_with : l)
44 test('core', e)
45
46 subdir('sub')
47
48 # With map file in subdir
49 mapfile = 'sub/foo.map'
50 vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
51
52 l = shared_library('bar', 'bob.c', link_args : vflag, link_depends : mapfile)
53 e = executable('prog-bar', 'prog.c', link_with : l)
54 test('core', e)