diff options
author | sbc <sbc@chromium.org> | 2015-10-23 18:20:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-24 01:22:01 +0000 |
commit | 95ffabc8eb818b26009f0eff87db5be3ec1487a0 (patch) | |
tree | 2c5c7ff7def6ea9d3acf728d260364e8b5bc71cd /native_client_sdk/src/tools/mac_ld_wrapper.py | |
parent | 939f64cf8b666cb2c1dbb777193b4ee4f1e52236 (diff) | |
download | chromium_src-95ffabc8eb818b26009f0eff87db5be3ec1487a0.zip chromium_src-95ffabc8eb818b26009f0eff87db5be3ec1487a0.tar.gz chromium_src-95ffabc8eb818b26009f0eff87db5be3ec1487a0.tar.bz2 |
[NaCl SDK] Allow ppapi_simple apps to use main entry point.
This change makes ppapi_simple into a linker script
since we need to force the __nacl_main symbol to be
included in the link line (its weak referenced by
_start as a replacement for main).
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:linux_nacl_sdk;tryserver.chromium.mac:mac_nacl_sdk;tryserver.chromium.win:win_nacl_sdk
BUG=246246
Review URL: https://codereview.chromium.org/18435011
Cr-Commit-Position: refs/heads/master@{#355947}
Diffstat (limited to 'native_client_sdk/src/tools/mac_ld_wrapper.py')
-rwxr-xr-x | native_client_sdk/src/tools/mac_ld_wrapper.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/native_client_sdk/src/tools/mac_ld_wrapper.py b/native_client_sdk/src/tools/mac_ld_wrapper.py new file mode 100755 index 0000000..22c24f7 --- /dev/null +++ b/native_client_sdk/src/tools/mac_ld_wrapper.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Wrapper script OSX native linker to handle lack of linker script support. +""" + +import sys +import os + +SYMS = ('PSUserMainGet', '__nacl_main', 'PPP_InitializeModule') + +debug = False + +def main(args): + assert(args) + if '-lppapi_simple' in args: + args[args.index('-lppapi_simple')] = '-lppapi_simple_real' + for s in SYMS: + args += ['-Wl,-u', '-Wl,_' + s] + + if '-lppapi_simple_cpp' in args: + args[args.index('-lppapi_simple_cpp')] = '-lppapi_simple_cpp_real' + for s in SYMS: + args += ['-Wl,-u', '-Wl,_' + s] + + if debug: + print ' '.join(args) + os.execvp(args[0], args) + # should never get here + return 1 + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) |