summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src/tools/mac_ld_wrapper.py
blob: 22c24f721d15f3426a4536598f6e56a4e38fc6fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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:]))