Skip to content

Commit 27ccec9

Browse files
committed
Make sel_ldr buildable without Chromium stuff
Only for amd64 host and target. nacl_helper_bootstrap also builds. - Check in linux_syscall_support.h (like we did for Breakpad) - Add a hacky symlink so we don't have to include the repository's parent directory or name it "native_client" - Use LLVM from /usr/bin instead of Chromium toolchains - Remove sysroot flags (depend on host system instead) - Disable setup of NaCl-target toolchains in scons scripts
1 parent 5cf07ef commit 27ccec9

File tree

5 files changed

+4537
-16
lines changed

5 files changed

+4537
-16
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
Fork of https://chromium.googlesource.com/native_client/src/native_client
2+
with edits to enable building NaCl without the Chromium
3+
dev tools. History had to be cut off due to 200 MB zip files in the history.
4+
Currently it only works for amd64 host+target. (run.py won't work
5+
since NaCl targets aren't supported yet.)
6+
Dependencies:
7+
- LLVM (must be installed in /usr/bin)
8+
- SCons
9+
10+
Build with:
11+
```
12+
scons platform=x86-64 MODE=opt-host naclsdk_validate=0 sysinfo=0 sel_ldr
13+
```
14+
---
15+
116
# Native Client
217

318
Native Client is a deprecated sandboxing technology. It is currently used by a

SConstruct

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import pynacl.platform
3434
import gc
3535
gc.disable()
3636

37+
nacltool = False # Daemon: not yet implemented
38+
3739
# REPORT
3840
CMD_COUNTER = {}
3941
ENV_COUNTER = {}
@@ -468,8 +470,8 @@ pre_base_env = Environment(
468470
# This allows in things like externally provided PATH, PYTHONPATH.
469471
ENV = os.environ.copy(),
470472
tools = ['component_setup'],
471-
# SOURCE_ROOT is one leave above the native_client directory.
472-
SOURCE_ROOT = Dir('#/..').abspath,
473+
# In upstream this is the "depot" dir (parent dir of repositories)
474+
SOURCE_ROOT = Dir('#/include-hax').abspath,
473475
# Publish dlls as final products (to staging).
474476
COMPONENT_LIBRARY_PUBLISH = True,
475477

@@ -2212,7 +2214,7 @@ Automagically generated help:
22122214

22132215

22142216
def SetUpClang(env):
2215-
env['CLANG_DIR'] = '${SOURCE_ROOT}/third_party/llvm-build/Release+Asserts/bin'
2217+
env['CLANG_DIR'] = '/usr/bin'
22162218
env['CLANG_OPTS'] = []
22172219
if env.Bit('asan'):
22182220
if not (env.Bit('host_linux') or env.Bit('host_mac')):
@@ -2709,8 +2711,8 @@ def MakeGenericLinuxEnv(platform=None):
27092711
sysroot=os.path.join(
27102712
'${SOURCE_ROOT}/build/linux/debian_bullseye_amd64-sysroot')
27112713
linux_env.Prepend(
2712-
CCFLAGS = ['-m64', '--sysroot='+sysroot],
2713-
LINKFLAGS = ['-m64', '--sysroot='+sysroot],
2714+
CCFLAGS = ['-m64'],#, '--sysroot='+sysroot],
2715+
LINKFLAGS = ['-m64']#, '--sysroot='+sysroot],
27142716
)
27152717
elif linux_env.Bit('build_arm'):
27162718
SetUpLinuxEnvArm(linux_env)
@@ -2796,7 +2798,7 @@ pre_base_env.Append(
27962798
nacl_env = MakeArchSpecificEnv()
27972799
# See comment below about libc++ and libpthread in NONIRT_LIBS.
27982800
using_nacl_libcxx = nacl_env.Bit('bitcode') or nacl_env.Bit('nacl_clang')
2799-
nacl_env = nacl_env.Clone(
2801+
if nacltool: nacl_env = nacl_env.Clone(
28002802
tools = ['naclsdk'],
28012803
NACL_BUILD_FAMILY = 'UNTRUSTED',
28022804
BUILD_TYPE = 'nacl',
@@ -3136,7 +3138,7 @@ if nacl_env.Bit('running_on_valgrind'):
31363138
nacl_env.Append(LINKFLAGS = ['-Wl,-u,have_nacl_valgrind_interceptors'],
31373139
LIBS = ['valgrind'])
31383140

3139-
environment_list.append(nacl_env)
3141+
if nacltool: environment_list.append(nacl_env)
31403142

31413143
if not nacl_env.Bit('nacl_glibc'):
31423144
# These are all specific to nacl-newlib so we do not include them
@@ -3390,11 +3392,11 @@ nacl_irt_env.ClearBits('bitcode')
33903392
# used to build user/test code. nacl-clang is used everywhere for the IRT.
33913393
nacl_irt_env.SetBits('nacl_clang')
33923394

3393-
nacl_irt_env.Tool('naclsdk')
3395+
if nacltool: nacl_irt_env.Tool('naclsdk')
33943396
# These are unfortunately clobbered by running Tool, which
33953397
# we needed to do to get the destination directory reset.
33963398
# We want all the same values from nacl_env.
3397-
nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'],
3399+
if nacltool: nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'],
33983400
EXTRA_CXXFLAGS=nacl_env['EXTRA_CXXFLAGS'],
33993401
CCFLAGS=nacl_env['CCFLAGS'],
34003402
CFLAGS=nacl_env['CFLAGS'],
@@ -3415,7 +3417,7 @@ if nacl_irt_env.Bit('build_x86_32'):
34153417
# The IRT is C only, don't link with the C++ linker so that it doesn't
34163418
# start depending on the C++ standard library and (in the case of
34173419
# libc++) pthread.
3418-
nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK'].
3420+
if nacltool: nacl_irt_env.Replace(LINK=(nacl_irt_env['LINK'].
34193421
replace('nacl-clang++', 'nacl-clang')))
34203422

34213423
# TODO(mcgrathr): Clean up uses of these methods.
@@ -3531,8 +3533,8 @@ def AddImplicitLibs(env):
35313533
# The -B<dir>/ flag is necessary to tell gcc to look for crt[1in].o there.
35323534
env.Prepend(LINKFLAGS=['-B${LIB_DIR}/'])
35333535

3534-
AddImplicitLibs(nacl_env)
3535-
AddImplicitLibs(nacl_irt_env)
3536+
if nacltool: AddImplicitLibs(nacl_env)
3537+
if nacltool: AddImplicitLibs(nacl_irt_env)
35363538

35373539
nacl_irt_env.Append(
35383540
BUILD_SCONSCRIPTS = [
@@ -3547,7 +3549,7 @@ nacl_irt_env.Append(
35473549
])
35483550
nacl_irt_env.AddChromeFilesFromGroup('untrusted_irt_scons_files')
35493551

3550-
environment_list.append(nacl_irt_env)
3552+
if nacltool: environment_list.append(nacl_irt_env)
35513553

35523554
# Since browser_tests already use the IRT normally, those are fully covered
35533555
# in nacl_env. But the non_browser_tests don't use the IRT in nacl_env.
@@ -3612,7 +3614,7 @@ def IrtTestAddNodeToTestSuite(env, node, suite_name, node_name=None,
36123614
is_broken, is_flaky)
36133615
nacl_irt_test_env.AddMethod(IrtTestAddNodeToTestSuite, 'AddNodeToTestSuite')
36143616

3615-
environment_list.append(nacl_irt_test_env)
3617+
if nacltool: environment_list.append(nacl_irt_test_env)
36163618

36173619

36183620
windows_coverage_env = windows_debug_env.Clone(

include-hax/native_client

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
..

0 commit comments

Comments
 (0)