<commit_before>#!/usr/bin/python
# Copyright 2009 The Native Client Authors.  All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.

# this script is a replacement for llvm-gcc and llvm-g++ driver.
# It detects automatically which role it is supposed to assume.
# The point of the script is to redirect builds through our own tools,
# while making these tools appear like gnu tools.
#
# Compared to the gcc driver the usage patterns of this script
# are somewhat restricted:
# * you cannot compile and link at the same time
# * you cannot specify multiple source files in one invocation
# * ...
#
# IMPORTANT NOTE: If you make local mods to this file, you must run:
#   %  tools/llvm/untrusted-toolchain-creator.sh driver-symlink
# in order for them to take effect in the scons build.  This command
# updates the copy in the toolchain/ tree.

import os
import struct
import subprocess
import sys


######################################################################
# User-configurable Script Settings
#

LOG_FILE_ENABLE = 1
LOG_FILE_NAME = 'toolchain/hg-log/llvm-fake.log'
LOG_SIZE_LIMIT = 20*(2**20)     # 20 MB

PRETTY_PRINT_COMMANDS = 1


######################################################################
# This script resides in directory:
# native_client/toolchain/linux_arm-untrusted/arm-none-linux-gnueabi
# BASE is "native_client/toolchain/linux_arm-untrusted"
BASE = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))

# BASE_NACL is "native_client" directory.
BASE_NACL = os.path.dirname(os.path.dirname(BASE))

assert os.path.basename(BASE) == "linux_arm-untrusted"
assert os.path.basename(BASE_NACL) == "native_client"

# It's not safe to output debug information to stderr, because "configure"
# runs this script and parses the output.
LOG_OUT = []
ERROR_OUT = [sys.stderr]

######################################################################
# Misc
######################################################################

BASE_ARM = BASE + '/arm-none-linux-gnueabi'
BASE_ARM_INCLUDE = BASE_ARM + '/arm-none-linux-gnueabi/include'

GOLD_PLUGIN = BASE_ARM + '/lib/libLLVMgold.so'

# arm libstdc++
LIBDIR_ARM_3 = BASE_ARM + '/lib'

# arm startup code + libs (+ bitcode when in bitcode mode)
LIBDIR_ARM_2 = BASE + '/arm-newlib/arm-none-linux-gnueabi/lib'

# arm libgcc
LIBDIR_ARM_1 = BASE_ARM + '/lib/gcc/arm-none-linux-gnueabi/4.2.1/'

PNACL_ARM_ROOT =  BASE + '/libs-arm'

PNACL_X8632_ROOT = BASE + '/libs-x8632'

PNACL_X8664_ROOT = BASE + '/libs-x8664'

global_pnacl_roots = {
  'arm' : PNACL_ARM_ROOT,
  'x86-32' : PNACL_X8632_ROOT,
  'x86-64' : PNACL_X8664_ROOT
}

global_pnacl_triples = {
  'arm' : 'armv7a-none-linux-gnueabi',
  'x86-32' : 'i686-none-linux-gnu',
  'x86-64' : 'x86_64-none-linux-gnu'
}

PNACL_BITCODE_ROOT = BASE + '/libs-bitcode'

######################################################################
# FLAGS (can be overwritten by
######################################################################
arm_flags = ['-mfpu=vfp3',
             '-march=armv7-a']
cpp_flags = ['-D__native_client__=1']

global_config_flags = {
  'CPP_FLAGS' : cpp_flags,
  'LLVM_GCC_COMPILE': [
    '-nostdinc',
    '-DNACL_TARGET_ARCH=arm',
    # TODO: get rid of the next two lines
    '-DNACL_TARGET_SUBARCH=32',
    '-DNACL_LINUX=1'
  ] + cpp_flags,

  'LLVM_GCC_COMPILE_HEADERS': [
    # NOTE: the two competing approaches here
    #       make the gcc driver "right" or
    #       put all the logic/knowloedge into this driver.
    #       Currently, we have a messy mixture.
    '-isystem',
    BASE_ARM + '/lib/gcc/arm-none-linux-gnueabi/4.2.1/include',
    '-isystem',
    BASE_ARM + '/lib/gcc/arm-none-linux-gnueabi/4.2.1/install-tools/include',
    '-isystem', BASE_ARM_INCLUDE + '/c++/4.2.1',
    '-isystem', BASE_ARM_INCLUDE + '/c++/4.2.1/arm-none-linux-gnueabi',
    '-isystem', BASE_ARM_INCLUDE,
    # NOTE: order important
    # '-isystem',
    # BASE + '/arm-newlib/arm-none-linux-gnueabi/usr/include/nacl/abi',
    '-isystem',
    BASE + '/arm-newlib/arm-none-linux-gnueabi/include',
  ],

  'OPT': [
    '-O3',
    '-std-compile-opts'
  ],
<commit_msg>Don't pass DNACL_TARGET_ARCH and DNACL_TARGET_SUBARCH. This is handled by scons and can result in gcc complaining about a macro being defined twice.<commit_after>#!/usr/bin/python
# Copyright 2009 The Native Client Authors.  All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.

# this script is a replacement for llvm-gcc and llvm-g++ driver.
# It detects automatically which role it is supposed to assume.
# The point of the script is to redirect builds through our own tools,
# while making these tools appear like gnu tools.
#
# Compared to the gcc driver the usage patterns of this script
# are somewhat restricted:
# * you cannot compile and link at the same time
# * you cannot specify multiple source files in one invocation
# * ...
#
# IMPORTANT NOTE: If you make local mods to this file, you must run:
#   %  tools/llvm/untrusted-toolchain-creator.sh driver-symlink
# in order for them to take effect in the scons build.  This command
# updates the copy in the toolchain/ tree.

import os
import struct
import subprocess
import sys


######################################################################
# User-configurable Script Settings
#

LOG_FILE_ENABLE = 1
LOG_FILE_NAME = 'toolchain/hg-log/llvm-fake.log'
LOG_SIZE_LIMIT = 20*(2**20)     # 20 MB

PRETTY_PRINT_COMMANDS = 1


######################################################################
# This script resides in directory:
# native_client/toolchain/linux_arm-untrusted/arm-none-linux-gnueabi
# BASE is "native_client/toolchain/linux_arm-untrusted"
BASE = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))

# BASE_NACL is "native_client" directory.
BASE_NACL = os.path.dirname(os.path.dirname(BASE))

assert os.path.basename(BASE) == "linux_arm-untrusted"
assert os.path.basename(BASE_NACL) == "native_client"

# It's not safe to output debug information to stderr, because "configure"
# runs this script and parses the output.
LOG_OUT = []
ERROR_OUT = [sys.stderr]

######################################################################
# Misc
######################################################################

BASE_ARM = BASE + '/arm-none-linux-gnueabi'
BASE_ARM_INCLUDE = BASE_ARM + '/arm-none-linux-gnueabi/include'

GOLD_PLUGIN = BASE_ARM + '/lib/libLLVMgold.so'

# arm libstdc++
LIBDIR_ARM_3 = BASE_ARM + '/lib'

# arm startup code + libs (+ bitcode when in bitcode mode)
LIBDIR_ARM_2 = BASE + '/arm-newlib/arm-none-linux-gnueabi/lib'

# arm libgcc
LIBDIR_ARM_1 = BASE_ARM + '/lib/gcc/arm-none-linux-gnueabi/4.2.1/'

PNACL_ARM_ROOT =  BASE + '/libs-arm'

PNACL_X8632_ROOT = BASE + '/libs-x8632'

PNACL_X8664_ROOT = BASE + '/libs-x8664'

global_pnacl_roots = {
  'arm' : PNACL_ARM_ROOT,
  'x86-32' : PNACL_X8632_ROOT,
  'x86-64' : PNACL_X8664_ROOT
}

global_pnacl_triples = {
  'arm' : 'armv7a-none-linux-gnueabi',
  'x86-32' : 'i686-none-linux-gnu',
  'x86-64' : 'x86_64-none-linux-gnu'
}

PNACL_BITCODE_ROOT = BASE + '/libs-bitcode'

######################################################################
# FLAGS (can be overwritten by
######################################################################
arm_flags = ['-mfpu=vfp3',
             '-march=armv7-a']
cpp_flags = ['-D__native_client__=1']

global_config_flags = {
  'CPP_FLAGS' : cpp_flags,
  'LLVM_GCC_COMPILE': [
    '-nostdinc',
    # TODO: get rid of the next line
    '-DNACL_LINUX=1'
  ] + cpp_flags,

  'LLVM_GCC_COMPILE_HEADERS': [
    # NOTE: the two competing approaches here
    #       make the gcc driver "right" or
    #       put all the logic/knowloedge into this driver.
    #       Currently, we have a messy mixture.
    '-isystem',
    BASE_ARM + '/lib/gcc/arm-none-linux-gnueabi/4.2.1/include',
    '-isystem',
    BASE_ARM + '/lib/gcc/arm-none-linux-gnueabi/4.2.1/install-tools/include',
    '-isystem', BASE_ARM_INCLUDE + '/c++/4.2.1',
    '-isystem', BASE_ARM_INCLUDE + '/c++/4.2.1/arm-none-linux-gnueabi',
    '-isystem', BASE_ARM_INCLUDE,
    # NOTE: order important
    # '-isystem',
    # BASE + '/arm-newlib/arm-none-linux-gnueabi/usr/include/nacl/abi',
    '-isystem',
    BASE + '/arm-newlib/arm-none-linux-gnueabi/include',
  ],

  'OPT': [
    '-O3',
    '-std-compile-opts'
  ],

{'fraction_non_alphanumeric': 0.21469261808687395, 'fraction_numerical': 0.02041300735817707, 'mean_word_length': 4.091842900302114, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '203733', 'n_tokens_mistral': 3061, 'n_tokens_neox': 2865, 'n_words': 700}