Can define custom linker flags.

pull/15/head
Jussi Pakkanen 11 years ago
parent 1a2b69d5c3
commit 040083cdb6
  1. 1
      backends.py
  2. 6
      build.py
  3. 9
      test cases/linuxlike/3 linker script/bob.c
  4. 6
      test cases/linuxlike/3 linker script/bob.h
  5. 6
      test cases/linuxlike/3 linker script/bob.map
  6. 7
      test cases/linuxlike/3 linker script/meson.build
  7. 5
      test cases/linuxlike/3 linker script/prog.c

@ -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:

@ -0,0 +1,9 @@
#include"bob.h"
int hiddenFunction() {
return 42;
}
int bobMcBob() {
return hiddenFunction();
}

@ -0,0 +1,6 @@
#ifndef BOB_H_
#define BOB_H_
int bobMcBob();
#endif

@ -0,0 +1,6 @@
V1_0_0 {
global:
"bobMcBob";
local:
*;
};

@ -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)

@ -0,0 +1,5 @@
#include"bob.h"
int main(int argc, char **argv) {
return bobMcBob() != 42;
}
Loading…
Cancel
Save