当前位置: 首页>>代码示例>>Python>>正文


Python OPTIONS.is_bare_metal_build方法代码示例

本文整理汇总了Python中build_options.OPTIONS.is_bare_metal_build方法的典型用法代码示例。如果您正苦于以下问题:Python OPTIONS.is_bare_metal_build方法的具体用法?Python OPTIONS.is_bare_metal_build怎么用?Python OPTIONS.is_bare_metal_build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在build_options.OPTIONS的用法示例。


在下文中一共展示了OPTIONS.is_bare_metal_build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
 def __init__(self, test_binary_name, inputs, output, build_commands):
   self._test_binary_name = test_binary_name
   self._build_commands = build_commands
   out = os.path.join(BionicFundamentalTest._get_out_dir(), test_binary_name)
   asmflags = ninja_generator.CNinjaGenerator.get_archasmflags()
   if OPTIONS.is_bare_metal_build():
     asmflags += ' -DBARE_METAL_BIONIC '
   cflags = ninja_generator.CNinjaGenerator.get_archcflags()
   cxxflags = ninja_generator.CNinjaGenerator.get_cxxflags()
   cflags = asmflags + cflags + ' $commonflags -g -fPIC -Wall -W -Werror '
   cxxflags = cflags + cxxflags
   ldflags = ('-Wl,-rpath-link=' + build_common.get_load_library_path() +
              ' -Wl,--hash-style=sysv')
   # Use -Bsymbolic to have similar configuration as other NaCl
   # executables in ARC.
   soflags = '-shared -Wl,-Bsymbolic'
   if OPTIONS.is_arm():
     # For ARM, we need to link libgcc.a into shared objects. See the comment
     # in SharedObjectNinjaGenerator.
     # TODO(crbug.com/283798): Build libgcc by ourselves and remove this.
     soflags += ' ' + ' '.join(
         ninja_generator.get_libgcc_for_bionic())
   text_segment_address = (ninja_generator.ExecNinjaGenerator.
                           get_nacl_text_segment_address())
   if OPTIONS.is_bare_metal_build():
     execflags = '-pie'
     # Goobuntu's linker emits RWX pages for small PIEs. Use gold
     # instead. We cannot specify -fuse-ld=gold. As we are building
     # executables directly from .c files, the -fuse-ld flag will be
     # passed to cc1 and it does not recognize this flag.
     ldflags += ' -Bthird_party/gold'
   else:
     # This is mainly for ARM. See src/build/ninja_generator.py for detail.
     execflags = '-Wl,-Ttext-segment=' + text_segment_address
   self._variables = {
       'name': self._test_binary_name,
       'cc': toolchain.get_tool(OPTIONS.target(), 'cc'),
       'cxx': toolchain.get_tool(OPTIONS.target(), 'cxx'),
       'lib_dir': build_common.get_load_library_path(),
       'in_dir': BionicFundamentalTest._get_src_dir(),
       'out_dir': BionicFundamentalTest._get_out_dir(),
       'out': out,
       'crtbegin_exe': build_common.get_bionic_crtbegin_o(),
       'crtbegin_so': build_common.get_bionic_crtbegin_so_o(),
       'crtend_exe': build_common.get_bionic_crtend_o(),
       'crtend_so': build_common.get_bionic_crtend_so_o(),
       'cflags': cflags,
       'cxxflags': cxxflags,
       'ldflags': ldflags,
       'soflags': soflags,
       'execflags': execflags
   }
   self._inputs = map(self._expand_vars, inputs)
   self._output = self._expand_vars(output)
开发者ID:NaiveTorch,项目名称:ARC,代码行数:56,代码来源:config.py

示例2: _generate_runnable_ld_ninja

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _generate_runnable_ld_ninja():
  linker_script = _generate_linker_script_for_runnable_ld()

  # Not surprisingly, bionic's loader is built with a special hack to
  # Android's build system so we cannot use MakefileNinjaTranslator.
  n = ninja_generator.ExecNinjaGenerator('runnable-ld.so',
                                         base_path='android/bionic/linker',
                                         install_path='/lib',
                                         is_system_library=True)
  _add_runnable_ld_cflags(n)

  n.add_library_deps('libc_bionic_linker.a')  # logging functions
  n.add_library_deps('libc_common_linker.a')
  n.add_library_deps('libc_freebsd_linker.a')  # __swsetup etc.
  sources = n.find_all_sources()
  sources.extend(['android/bionic/libc/arch-nacl/syscalls/irt_syscalls.c',
                  'android/bionic/libc/bionic/__errno.c',
                  'android/bionic/libc/bionic/pthread.c',
                  'android/bionic/libc/bionic/pthread_create.cpp',
                  'android/bionic/libc/bionic/pthread_internals.cpp',
                  'android/bionic/libc/bionic/pthread_key.cpp'])
  if OPTIONS.is_bare_metal_build():
    # Remove SFI NaCl specific dynamic code allocation.
    sources.remove('android/bionic/linker/arch/nacl/nacl_dyncode_alloc.c')
    sources.remove('android/bionic/linker/arch/nacl/nacl_dyncode_map.c')
  _remove_assembly_source(sources)
  # NaCl has no signals so debugger support cannot be implemented.
  sources.remove('android/bionic/linker/debugger.cpp')

  # n.find_all_sources() picks up this upstream file regardless of the
  # current target. For ARM, the file is obviously irrelevant. For i686
  # and x86_64, we use our own begin.c.
  sources.remove('android/bionic/linker/arch/x86/begin.c')

  ldflags = n.get_ldflags()
  if OPTIONS.is_nacl_build():
    ldflags += (' -T ' + linker_script +
                ' -Wl,-Ttext,' + _LOADER_TEXT_SECTION_START_ADDRESS)
  else:
    # We need to use recent linkers for __ehdr_start.
    ldflags += ' -pie'
  # See the comment in linker/arch/nacl/begin.c.
  ldflags += ' -Wl,--defsym=__linker_base=0'
  # --gc-sections triggers an assertion failure in GNU ld for ARM for
  # --opt build. The error message is very similar to the message in
  # https://sourceware.org/bugzilla/show_bug.cgi?id=13990
  # Once NaCl team updates the version of their binutils, we might be
  # able to remove this.
  if not OPTIONS.is_arm():
    ldflags += ' -Wl,--gc-sections'
  if not OPTIONS.is_debug_info_enabled():
    ldflags += ' -Wl,--strip-all'
  n.add_library_deps(*ninja_generator.get_libgcc_for_bionic())
  n.add_library_deps('libbionic_ssp.a')
  n.build_default(sources, base_path=None)
  n.link(variables={'ldflags': ldflags}, implicit=linker_script)
开发者ID:NaiveTorch,项目名称:ARC,代码行数:58,代码来源:config.py

示例3: create_or_remove_bare_metal_gdb_lock_file

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def create_or_remove_bare_metal_gdb_lock_file(gdb_target_list):
  bare_metal_gdb_lock = '/tmp/bare_metal_gdb.lock'
  if 'plugin' in gdb_target_list and OPTIONS.is_bare_metal_build():
    # Just touch the lock file.
    # TODO(crbug.com/354290): Remove this.
    with open(bare_metal_gdb_lock, 'wb'):
      pass
  else:
    # We always remove the lock file so the execution will not be
    # accidentally blocked.
    try:
      os.unlink(bare_metal_gdb_lock)
    except:
      pass
开发者ID:NaiveTorch,项目名称:ARC,代码行数:16,代码来源:gdb_util.py

示例4: get_crash_report

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
  def get_crash_report(self):
    assert self._crash_addr is not None
    for binary_name, start_addr, end_addr in self._text_segments:
      if start_addr > self._crash_addr or self._crash_addr >= end_addr:
        continue

      addr = self._crash_addr
      # For PIC or PIE, we need to subtract the load bias.
      if binary_name.endswith('.so') or OPTIONS.is_bare_metal_build():
        addr -= start_addr

      if os.path.exists(binary_name):
        binary_filename = binary_name
      else:
        self.init_binary_map()
        if binary_name not in self._binary_map:
          return '%s %x (binary file not found)\n' % (binary_name, addr)
        binary_filename = self._binary_map[binary_name]

      pipe = subprocess.Popen([toolchain.get_tool(OPTIONS.target(),
                                                  'addr2line'),
                               '-e', binary_filename],
                              stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT)
      addr2line_result = pipe.communicate('%x\n' % addr)[0]

      # We can always get clean result using 32 byte aligned start
      # address as NaCl binary does never overlap 32 byte boundary.
      objdump_start_addr = (addr & ~31) - 32
      objdump_end_addr = addr + 64
      pipe = subprocess.Popen([toolchain.get_tool(OPTIONS.target(),
                                                  'objdump'),
                               '-SC', binary_filename,
                               '--start-address', '0x%x' % objdump_start_addr,
                               '--stop-address', '0x%x' % objdump_end_addr],
                              stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
      objdump_result = pipe.communicate('%x\n' % addr)[0]

      if self._is_annotating:
        report = ('[[ %s 0x%x %s ]]' %
                  (binary_filename, addr, addr2line_result.strip()))
        # The result of objdump is too verbose for annotation.
      else:
        report = '%s 0x%x\n' % (binary_filename, addr)
        report += addr2line_result
        report += objdump_result

      return report
    return 'Failed to retrieve a crash report\n'
开发者ID:NaiveTorch,项目名称:ARC,代码行数:52,代码来源:crash_analyzer.py

示例5: _generate_linker_script_for_runnable_ld

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _generate_linker_script_for_runnable_ld():
  # For Bare Metal mode, we do not modify linker script.
  if OPTIONS.is_bare_metal_build():
    return []

  rule_name = 'gen_runnable_ld_lds'
  n = ninja_generator.NinjaGenerator(rule_name)
  cc = toolchain.get_tool(OPTIONS.target(), 'cc')
  n.rule(rule_name,
         command='$in %s > $out || (rm $out; exit 1)' % cc,
         description=rule_name)
  linker_script = os.path.join(build_common.get_build_dir(), 'runnable-ld.lds')
  n.build(linker_script, rule_name, staging.as_staging(
      'android/bionic/linker/arch/nacl/gen_runnable_ld_lds.py'))
  return linker_script
开发者ID:NaiveTorch,项目名称:ARC,代码行数:17,代码来源:config.py

示例6: _compute_chrome_plugin_params

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _compute_chrome_plugin_params(parsed_args):
  params = []
  extensions = [
      remote_executor.resolve_path(build_common.get_runtime_out_dir()),
      remote_executor.resolve_path(build_common.get_handler_dir())]
  params.append('--load-extension=' + ','.join(extensions))

  params.append(
      '--user-data-dir=' + remote_executor.resolve_path(_USER_DATA_DIR))

  # Not all targets can use nonsfi mode (even with the whitelist).
  if OPTIONS.is_bare_metal_build():
    params.append('--enable-nacl-nonsfi-mode')

  return params
开发者ID:NaiveTorch,项目名称:ARC,代码行数:17,代码来源:launch_chrome.py

示例7: is_no_sandbox_needed

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def is_no_sandbox_needed(gdb_target_list):
  """Returns whether --no-sandbox is needed to run Chrome with GDB properly.
  """
  # Chrome uses getpid() to print the PID of the renderer/gpu process to be
  # debugged, which is parsed by launch_chrome.  If the sandbox is enabled,
  # fake PIDs are returned from getpid().
  if 'renderer' in gdb_target_list or 'gpu' in gdb_target_list:
    return True

  # To suspend at the very beginning of the loader, we use a lock file.
  # no-sandox option is necessary to access the file.
  # TODO(crbug.com/354290): Remove this when GDB is properly supported.
  if OPTIONS.is_bare_metal_build() and 'plugin' in gdb_target_list:
    return True

  return False
开发者ID:NaiveTorch,项目名称:ARC,代码行数:18,代码来源:gdb_util.py

示例8: _filter_libc_common_for_arm

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _filter_libc_common_for_arm(vars, sources):
  for f in _ARM_ASM_FILES:
    sources.append(_get_asm_source(f))
  if OPTIONS.is_bare_metal_build():
    # For direct syscalls used internally.
    sources.append('android/bionic/libc/arch-arm/bionic/syscall.S')
  else:
    # Order-only dependency should be sufficient for this case
    # because all dependencies should be handled properly once .d
    # files are generated. However, we have a strict check for
    # order-only dependencies (see NinjaGenerator._check_deps)
    # so we use implicit dependencies here for now. As we do not
    # update assembly code often, this will not harm our iteration
    # cycle much.
    # TODO(crbug.com/318433): Use order-only dependencies.
    vars.get_implicit_deps().append(_get_gen_source_stamp())
  # TODO(crbug.com/352917): Replace them with memset.S for Cortex A15.
  sources.extend(['android/bionic/libc/string/bzero.c',
                  'android/bionic/libc/string/strcpy.c',
                  'nacl-newlib/newlib/libc/string/memset.c'])
开发者ID:NaiveTorch,项目名称:ARC,代码行数:22,代码来源:config.py

示例9: main

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def main():
  OPTIONS.parse_configure_file()
  test_args = sys.argv[1:]
  if not test_args:
    print 'Usage: %s test_binary [test_args...]' % sys.argv[0]
    sys.exit(1)

  # This script must not die by Ctrl-C while GDB is running. We simply
  # ignore SIGINT. Note that GDB will still handle Ctrl-C properly
  # because GDB sets its signal handler by itself.
  signal.signal(signal.SIGINT, signal.SIG_IGN)

  runner_args = toolchain.get_tool(OPTIONS.target(), 'runner').split()
  if OPTIONS.is_nacl_build():
    _run_gdb_for_nacl(runner_args, test_args)
  elif OPTIONS.is_bare_metal_build():
    if OPTIONS.is_arm():
      _run_gdb_for_bare_metal_arm(runner_args, test_args)
    else:
      _run_gdb_for_bare_metal(runner_args, test_args)
开发者ID:NaiveTorch,项目名称:ARC,代码行数:22,代码来源:run_under_gdb.py

示例10: _filter_libc_common_for_i686

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _filter_libc_common_for_i686(vars, sources):
  for f in _I686_ASM_FILES:
    sources.append(_get_asm_source(f))
  if OPTIONS.is_bare_metal_i686() and OPTIONS.enable_valgrind():
    # SSE2 strchr may access address before the passed string when the
    # string is not 16-byte aligned and valgrind complains.
    sources.remove('android/bionic/libc/arch-x86/string/sse2-strchr-atom.S')
    sources.append('android/bionic/libc/bionic/strchr.cpp')
  if OPTIONS.is_bare_metal_build():
    # For direct syscalls used internally.
    sources.append('android/bionic/libc/arch-x86/bionic/syscall.S')
  else:
    # See the comment in _filter_libc_common_for_arm.
    # TODO(crbug.com/318433): Use order-only dependencies.
    vars.get_implicit_deps().append(_get_gen_source_stamp())
  # It seems newlib's memset is slightly faster than the
  # assembly implementation (0.16[sec/GB] vs 0.19[sec/GB]).
  sources.append('nacl-newlib/newlib/libc/string/memset.c')
  # This file contains inline assembly.
  sources.remove('android/bionic/libc/arch-x86/bionic/__set_tls.c')
  # TODO(crbug.com/268485): Confirm ARC can ignore non-SSSE3 x86 devices
  vars.get_cflags().append('-DUSE_SSSE3=1')
开发者ID:NaiveTorch,项目名称:ARC,代码行数:24,代码来源:config.py

示例11: _compute_chrome_sandbox_params

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _compute_chrome_sandbox_params(parsed_args):
  params = []
  if _is_no_sandbox_needed(parsed_args):
    params.append('--no-sandbox')
    if OPTIONS.is_bare_metal_build():
      # Non-SFI NaCl helper, which heavily depends on seccomp-bpf,
      # does not start without seccomp sandbox initialized unless we
      # specify this flag explicitly.
      params.append('--nacl-dangerous-no-sandbox-nonsfi')

  # Environment variables to pass through to nacl_helper.
  passthrough_env_vars = []

  if OPTIONS.is_nacl_build() and parsed_args.disable_nacl_sandbox:
    os.environ['NACL_DANGEROUS_ENABLE_FILE_ACCESS'] = '1'
    passthrough_env_vars.append('NACL_DANGEROUS_ENABLE_FILE_ACCESS')
  if OPTIONS.is_nacl_build() and parsed_args.enable_nacl_list_mappings:
    os.environ['NACL_DANGEROUS_ENABLE_LIST_MAPPINGS'] = '1'
    passthrough_env_vars.append('NACL_DANGEROUS_ENABLE_LIST_MAPPINGS')
  if passthrough_env_vars:
    os.environ['NACL_ENV_PASSTHROUGH'] = ','.join(passthrough_env_vars)
  return params
开发者ID:NaiveTorch,项目名称:ARC,代码行数:24,代码来源:launch_chrome.py

示例12: _generate_libgcc_ninja

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _generate_libgcc_ninja():
  # Currently, we need to generate libgcc.a only for Bare Metal mode.
  if not OPTIONS.is_bare_metal_build():
    return

  # TODO(crbug.com/283798): Build libgcc by ourselves.
  rule_name = 'generate_libgcc'
  n = ninja_generator.NinjaGenerator(rule_name)
  if OPTIONS.is_i686():
    # We use libgcc.a in Android NDK for Bare Metal mode as it is
    # compatible with Bionic.
    orig_libgcc = ('third_party/ndk/toolchains/x86-4.6/prebuilt/'
                   'linux-x86/lib/gcc/i686-linux-android/4.6/libgcc.a')
    # This libgcc has unnecessary symbols such as __CTORS__ in
    # _ctors.o. We define this symbol in crtbegin.o, so we need to
    # remove this object from the archive.
    # Functions in generic-morestack{,-thread}.o and morestack.o are not
    # needed if one is not using split stacks and it interferes with our
    # process emulation code.
    remove_object = ('_ctors.o generic-morestack.o generic-morestack-thread.o '
                     'morestack.o')
  elif OPTIONS.is_arm():
    # NDK's libgcc.a is not compatible with Bare Metal mode because
    # Android NDK does not use -mfloat-abi=hard. We just use libgcc
    # from Goobuntu.
    # TODO(crbug.com/340598): Check if we can use NDK's libgcc.a if we
    # decide to use softfp.
    orig_libgcc = os.path.join(
        ninja_generator.get_libgcc_installed_dir_for_bare_metal(), 'libgcc.a')
    # This object depends on some glibc specific symbols around
    # stdio. As no objects in libgcc.a use _eprintf, we can simply
    # remove this object.
    remove_object = '_eprintf.o'
  n.rule(rule_name,
         command=('cp $in $out.tmp && ar d $out.tmp %s && mv $out.tmp $out' %
                  remove_object),
         description=rule_name + ' $out')
  n.build(ninja_generator.get_libgcc_for_bare_metal(), rule_name, orig_libgcc)
开发者ID:NaiveTorch,项目名称:ARC,代码行数:40,代码来源:config.py

示例13: _add_bare_metal_flags_to_ninja_generator

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def _add_bare_metal_flags_to_ninja_generator(n):
  if OPTIONS.is_bare_metal_build():
    n.add_defines('BARE_METAL_BIONIC')
开发者ID:NaiveTorch,项目名称:ARC,代码行数:5,代码来源:config.py

示例14: generate_test_ninjas

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]
def generate_test_ninjas():
  if not OPTIONS.is_bare_metal_build():
    return
  ninja_generator_runner.request_run_in_parallel(
      _generate_bare_metal_test_ninjas,
      _generate_test_framework_for_bare_metal_ninjas)
开发者ID:NaiveTorch,项目名称:ARC,代码行数:8,代码来源:config.py

示例15: _filter_libc_common

# 需要导入模块: from build_options import OPTIONS [as 别名]
# 或者: from build_options.OPTIONS import is_bare_metal_build [as 别名]

#.........这里部分代码省略.........
      'android/bionic/libc/arch-nacl/bionic/__set_tls.c',
      'android/bionic/libc/arch-nacl/bionic/clone.c',
      'android/bionic/libc/arch-nacl/bionic/popcount.c',
      'android/bionic/libc/arch-nacl/syscalls/__getcwd.c',
      'android/bionic/libc/arch-nacl/syscalls/__open.c',
      'android/bionic/libc/arch-nacl/syscalls/_exit.c',
      'android/bionic/libc/arch-nacl/syscalls/_exit_thread.c',
      'android/bionic/libc/arch-nacl/syscalls/clock_getres.c',
      'android/bionic/libc/arch-nacl/syscalls/clock_gettime.c',
      'android/bionic/libc/arch-nacl/syscalls/close.c',
      'android/bionic/libc/arch-nacl/syscalls/dup.c',
      'android/bionic/libc/arch-nacl/syscalls/dup2.c',
      'android/bionic/libc/arch-nacl/syscalls/enosys.c',
      'android/bionic/libc/arch-nacl/syscalls/fdatasync.c',
      'android/bionic/libc/arch-nacl/syscalls/fstat.c',
      'android/bionic/libc/arch-nacl/syscalls/fsync.c',
      'android/bionic/libc/arch-nacl/syscalls/futex.c',
      'android/bionic/libc/arch-nacl/syscalls/getdents.c',
      'android/bionic/libc/arch-nacl/syscalls/getpid.c',
      'android/bionic/libc/arch-nacl/syscalls/gettid.c',
      'android/bionic/libc/arch-nacl/syscalls/gettimeofday.c',
      'android/bionic/libc/arch-nacl/syscalls/getuid.c',
      'android/bionic/libc/arch-nacl/syscalls/lseek.c',
      'android/bionic/libc/arch-nacl/syscalls/lseek64.c',
      'android/bionic/libc/arch-nacl/syscalls/lstat.c',
      'android/bionic/libc/arch-nacl/syscalls/mmap.c',
      'android/bionic/libc/arch-nacl/syscalls/mprotect.c',
      'android/bionic/libc/arch-nacl/syscalls/munmap.c',
      'android/bionic/libc/arch-nacl/syscalls/nacl_stat.c',
      'android/bionic/libc/arch-nacl/syscalls/nacl_timespec.c',
      'android/bionic/libc/arch-nacl/syscalls/nacl_timeval.c',
      'android/bionic/libc/arch-nacl/syscalls/read.c',
      'android/bionic/libc/arch-nacl/syscalls/stat.c',
      'android/bionic/libc/arch-nacl/syscalls/unlink.c',
      'android/bionic/libc/arch-nacl/syscalls/write.c',
      'android/bionic/libc/arch-nacl/syscalls/writev.c',
      'android/bionic/libc/arch-nacl/tmp/raw_print.c',
      # TODO(crbug.com/352917): Use assembly version on Bare Metal ARM.
      'android/bionic/libc/bionic/memcmp.c',
      'android/bionic/libc/bionic/memcpy.c',
      'android/bionic/libc/bionic/property_service.c',
      'android/bionic/libc/string/ffs.c',
      'android/bionic/libc/string/strcat.c',
      'android/bionic/libc/string/strcmp.c',
      'android/bionic/libc/string/strlen.c'])
  if OPTIONS.is_nacl_build():
    # They define SFI NaCl specific functions for dynamic code.
    sources.extend([
        'android/bionic/libc/arch-nacl/syscalls/__allocate_nacl_dyncode.c',
        'android/bionic/libc/arch-nacl/syscalls/nacl_dyncode_create.c',
        'android/bionic/libc/arch-nacl/syscalls/nacl_dyncode_delete.c',
        'android/bionic/libc/arch-nacl/syscalls/nacl_list_mappings.c'])

  if OPTIONS.is_arm():
    # TODO(crbug.com/352917): Use assembly version on Bare Metal ARM.
    sources.extend([
        'android/bionic/libc/bionic/__memcpy_chk.cpp',
        'android/bionic/libc/bionic/__memset_chk.cpp',
        'android/bionic/libc/bionic/__strcat_chk.cpp',
        'android/bionic/libc/bionic/__strcpy_chk.cpp'])
  else:
    sources.extend([
        'android/bionic/libc/bionic/memchr.c',
        'android/bionic/libc/bionic/memrchr.c',
        'android/bionic/libc/bionic/memmove.c',
        'android/bionic/libc/bionic/strnlen.c',
        'android/bionic/libc/string/bcopy.c',
        'android/bionic/libc/string/index.c',
        'android/bionic/libc/string/strncmp.c',
        'android/bionic/libc/string/strrchr.c',
        'android/bionic/libc/upstream-freebsd/lib/libc/string/wcschr.c',
        'android/bionic/libc/upstream-freebsd/lib/libc/string/wcsrchr.c',
        'android/bionic/libc/upstream-freebsd/lib/libc/string/wcscmp.c',
        'android/bionic/libc/upstream-freebsd/lib/libc/string/wcslen.c'])

  if OPTIONS.is_arm():
    _filter_libc_common_for_arm(vars, sources)
  elif OPTIONS.is_i686():
    _filter_libc_common_for_i686(vars, sources)
  elif OPTIONS.is_x86_64():
    _filter_libc_common_for_x86_64(vars, sources)

  # NaCl does not have fork so we do not need the fork wrapper
  # which does preparation before we actually run fork system call.
  sources.remove('android/bionic/libc/bionic/fork.c')
  # lseek64 in this file splits off64_t into two integer values to
  # make assembly code easier. We can define lseek64 in C so we do
  # not need this wrapper.
  sources.remove('android/bionic/libc/bionic/lseek64.c')
  if OPTIONS.is_x86_64() or OPTIONS.is_bare_metal_i686():
    # We define __get_tls in nacl_read_tp.c.
    sources.remove('android/bionic/libc/arch-x86/bionic/__get_tls.c')
  if (OPTIONS.is_arm() or OPTIONS.is_x86_64() or
      OPTIONS.is_bare_metal_build()):
    sources.append('android/bionic/libc/arch-nacl/bionic/nacl_read_tp.c')
  vars.get_includes().append('android/bionic/libc/arch-nacl/syscalls')
  _remove_unnecessary_defines(vars)
  vars.get_cflags().append('-ffunction-sections')
  vars.get_cflags().append('-fdata-sections')
  return True
开发者ID:NaiveTorch,项目名称:ARC,代码行数:104,代码来源:config.py


注:本文中的build_options.OPTIONS.is_bare_metal_build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。