diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-04 17:02:59 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-13 09:17:06 +0530 |
commit | 09f65b7a3cb2bd3bb5b5fa42ffac45f8fb632132 (patch) | |
tree | 9407d6773f0f2378737a5899dfc270d6318bbe0c /mesonbuild/interpreter.py | |
parent | e128d26b350e4b8ba02e4de8858aa3deafa07ce1 (diff) | |
download | meson-09f65b7a3cb2bd3bb5b5fa42ffac45f8fb632132.zip meson-09f65b7a3cb2bd3bb5b5fa42ffac45f8fb632132.tar.gz meson-09f65b7a3cb2bd3bb5b5fa42ffac45f8fb632132.tar.bz2 |
New compiler function 'symbols_have_underscore_prefix'
Check if the compiler prefixes an underscore to global symbols. This is
useful when linking to compiled assembly code, or other code that does
not have its C symbol mangling handled transparently by the compiler.
C symbol mangling is platform and architecture dependent, and a helper
function is needed to detect it. Eg: Windows 32-bit prefixes underscore,
but 64-bit does not. Linux does not prefix an underscore but OS X does.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 9454302..cff98b1 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -623,6 +623,7 @@ class CompilerHolder(InterpreterObject): 'has_argument' : self.has_argument_method, 'first_supported_argument' : self.first_supported_argument_method, 'unittest_args' : self.unittest_args_method, + 'symbols_have_underscore_prefix': self.symbols_have_underscore_prefix_method, }) def version_method(self, args, kwargs): @@ -698,6 +699,13 @@ class CompilerHolder(InterpreterObject): def get_id_method(self, args, kwargs): return self.compiler.get_id() + def symbols_have_underscore_prefix_method(self, args, kwargs): + ''' + Check if the compiler prefixes _ (underscore) to global C symbols + See: https://en.wikipedia.org/wiki/Name_mangling#C + ''' + return self.compiler.symbols_have_underscore_prefix(self.environment) + def unittest_args_method(self, args, kwargs): # At time, only D compilers have this feature. if not hasattr(self.compiler, 'get_unittest_args'): |