diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-03-07 19:51:13 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-03-07 19:51:13 +0200 |
commit | 040083cdb613096ed50463df2af3be005e97c152 (patch) | |
tree | da5bfafda66b6911155457452fdca1377f089337 | |
parent | 1a2b69d5c3bc511aa2cac732c19c5290ff8f90ce (diff) | |
download | meson-040083cdb613096ed50463df2af3be005e97c152.zip meson-040083cdb613096ed50463df2af3be005e97c152.tar.gz meson-040083cdb613096ed50463df2af3be005e97c152.tar.bz2 |
Can define custom linker flags.
-rw-r--r-- | backends.py | 1 | ||||
-rw-r--r-- | build.py | 6 | ||||
-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/meson.build | 7 | ||||
-rw-r--r-- | test cases/linuxlike/3 linker script/prog.c | 5 |
7 files changed, 40 insertions, 0 deletions
diff --git a/backends.py b/backends.py index c92f48e..3ab63d7 100644 --- a/backends.py +++ b/backends.py @@ -1008,6 +1008,7 @@ class NinjaBackend(Backend): commands += dep.get_link_flags() dependencies = target.get_dependencies() commands += self.build_target_link_arguments(linker, dependencies) + commands += target.link_flags commands += linker.build_rpath_args(self.environment.get_build_dir(), target.get_rpaths()) if self.environment.coredata.coverage: commands += linker.get_coverage_link_flags() @@ -227,6 +227,12 @@ class BuildTarget(): if not isinstance(cpplist, list): cpplist = [cpplist] self.add_compiler_args('cpp', cpplist) + self.link_flags = kwargs.get('link_flags', []) + if not isinstance(self.link_flags, list): + self.link_flags = [self.link_flags] + for i in self.link_flags: + if not isinstance(i, str): + raise InvalidArguments('Link_flags arguments must be strings.') if 'version' in kwargs: self.set_version(kwargs['version']) if 'soversion' in kwargs: 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..7b3ed47 --- /dev/null +++ b/test cases/linuxlike/3 linker script/bob.c @@ -0,0 +1,9 @@ +#include"bob.h" + +int hiddenFunction() { + return 42; +} + +int bobMcBob() { + 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..b29331e --- /dev/null +++ b/test cases/linuxlike/3 linker script/bob.h @@ -0,0 +1,6 @@ +#ifndef BOB_H_ +#define BOB_H_ + +int bobMcBob(); + +#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/meson.build b/test cases/linuxlike/3 linker script/meson.build new file mode 100644 index 0000000..8589eb3 --- /dev/null +++ b/test cases/linuxlike/3 linker script/meson.build @@ -0,0 +1,7 @@ +project('linker script', 'c') + +vflag = '-Wl,--version-script,@0@/bob.map'.format('/home/jpakkane/workspace/meson/test cases/linuxlike/3 linker script') + +l = shared_library('bob', 'bob.c', link_flags : vflag) +e = executable('prog', '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..da9c675 --- /dev/null +++ b/test cases/linuxlike/3 linker script/prog.c @@ -0,0 +1,5 @@ +#include"bob.h" + +int main(int argc, char **argv) { + return bobMcBob() != 42; +} |