aboutsummaryrefslogtreecommitdiffhomepage
path: root/waftools
diff options
context:
space:
mode:
authorGravatar Stefano Pigozzi <stefano.pigozzi@gmail.com>2014-02-19 08:22:34 +0100
committerGravatar Stefano Pigozzi <stefano.pigozzi@gmail.com>2014-02-19 21:56:39 +0100
commit08170c6a67be2320ac86f03e76b318c784fb69f2 (patch)
treeef21cccffd8907953b7bb5bd5cdbe5fae0f82e98 /waftools
parentf6ed2468264931869d46f6905beaeb92ce9cf7e8 (diff)
build: syms: add support for Mach-O binaries
Current code stolen from waf's extras, only supported 'pe' and 'elf'. OS X uses the 'Mach-O' binary format (which waf calls 'mac-o'... go figure). Add support for generating the global symbols file with nm and using it from clang.
Diffstat (limited to 'waftools')
-rw-r--r--waftools/syms.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/waftools/syms.py b/waftools/syms.py
index f1937cf692..9b55de0759 100644
--- a/waftools/syms.py
+++ b/waftools/syms.py
@@ -35,7 +35,7 @@ class gen_sym(Task):
kw['env'] = env
else:
- if self.env.DEST_BINFMT == 'pe': #gcc uses nm, and has a preceding _ on windows
+ if self.env.DEST_BINFMT in ('pe', 'mac-o'): #gcc uses nm, and has a preceding _ on windows and osx
re_nm = re.compile(r'T\s+_(' + self.generator.export_symbols_regex + r')\b')
else:
re_nm = re.compile(r'T\s+(' + self.generator.export_symbols_regex + r')\b')
@@ -56,6 +56,8 @@ class compile_sym(Task):
self.outputs[0].write('EXPORTS\n' + '\n'.join(lsyms))
elif self.env.DEST_BINFMT == 'elf':
self.outputs[0].write('{ global:\n' + ';\n'.join(lsyms) + ";\nlocal: *; };\n")
+ elif self.env.DEST_BINFMT == 'mac-o':
+ self.outputs[0].write('\n'.join("_"+sym for sym in lsyms))
else:
raise WafError('NotImplemented')
@@ -76,6 +78,8 @@ def do_the_symbol_stuff(self):
self.link_task.inputs.append(tsk.outputs[0])
elif self.env.DEST_BINFMT == 'elf':
self.link_task.env.append_value('LINKFLAGS', ['-Wl,-version-script', '-Wl,' + tsk.outputs[0].bldpath()])
+ elif self.env.DEST_BINFMT == 'mac-o':
+ self.link_task.env.append_value('LINKFLAGS', ['-exported_symbols_list', tsk.outputs[0].bldpath()])
else:
raise WafError('NotImplemented')