@@ -405,29 +405,28 @@ endif()
405405
406406#TODO: env.EnsureRequiredBuildWarnings()
407407
408- #FIXME: This modifies (and breaks) the sel_ldr build.
409- if (OFF )
410408# Bootstrap loader used on Linux.
411409#TODO: BUILD_ELSEWHERE = env.Bit('built_elsewhere')
412410if (LINUX AND NOT BUILD_ELSEWHERE)
413411#TODO: bootstrap_env = env.Clone()
414412#TODO: bootstrap_env.Replace(CLANG_OPTS='')
415413#TODO: bootstrap_env.FilterOut(CCFLAGS=['-fstack-protector', '-fPIC', '-fPIE', '-pedantic', '$COVERAGE_CCFLAGS'],
416- set_c_cxx_flag("-fno-pic" )
417- set_c_cxx_flag("-fno-PIC" )
418- set_c_cxx_flag("-fno-pie" )
419- # Assumed to be what was expected, as -fno-pie was passed twice.
420- set_c_cxx_flag("-fno-PIE" )
421- set_c_cxx_flag("-fno-stack-protector" )
422- set_c_flag("-Wdeclaration-after-statement" )
414+ list (APPEND BOOTSTRAP_FLAGS "-fno-pic" )
415+ list (APPEND BOOTSTRAP_FLAGS "-fno-PIC" )
416+ list (APPEND BOOTSTRAP_FLAGS "-fno-pie" )
417+ # Assumed to be what was expected, as -fno-pie was passed twice in src/trusted/service_runtime/build.scons.
418+ list (APPEND BOOTSTRAP_FLAGS "-fno-PIE" )
419+ list (APPEND BOOTSTRAP_FLAGS "-fno-stack-protector" )
420+ # Was only a C flag in src/trusted/service_runtime/build.scons.
421+ list (APPEND BOOTSTRAP_FLAGS "-Wdeclaration-after-statement" )
423422
424423 # TODO(bbudge) Remove -Qunused-arguments when Clang supports -fno-pic.
425424 if (DAEMON_CXX_COMPILER_Clang_COMPATIBILITY)
426- set_c_cxx_flag( "-ffreestanding" )
427- add_definitions ( -U__STDC_HOSTED__)
428- add_definitions ( -D__STDC_HOSTED__=1)
429- add_definitions ( -Qunused-arguments)
430- add_definitions ( -Wno-builtin-macro-redefined)
425+ list ( APPEND BOOTSTRAP_FLAGS "-ffreestanding" )
426+ list ( APPEND BOOTSTRAP_DEFINITIONS " -U__STDC_HOSTED__" )
427+ list ( APPEND BOOTSTRAP_DEFINITIONS " -D__STDC_HOSTED__=1" )
428+ list ( APPEND BOOTSTRAP_DEFINITIONS " -Qunused-arguments" )
429+ list ( APPEND BOOTSTRAP_DEFINITIONS " -Wno-builtin-macro-redefined" )
431430 endif ()
432431
433432 set (COMPILER_OVERRIDE "" )
@@ -460,7 +459,7 @@ if (LINUX AND NOT BUILD_ELSEWHERE)
460459 # truncated, which produces an error. With mcmodel set to large,
461460 # there is no restriction on the code and data, so we can
462461 # safely set reserve_top to 0x100000000.
463- set_c_cxx_flag( "-mcmodel=large" )
462+ list ( APPEND BOOTSTRAP_FLAGS "-mcmodel=large" )
464463 else ()
465464 set (reserve_top "0x0" )
466465 endif ()
@@ -476,7 +475,13 @@ if (LINUX AND NOT BUILD_ELSEWHERE)
476475 set (RESERVE_TOP "0x40008000" )
477476 endif ()
478477
479- #TODO: bootstrap_obj = bootstrap_env.ComponentObject('linux/nacl_bootstrap.c')
478+ string (REPLACE ";" " " BOOTSTRAP_FLAGS_STRING "${BOOTSTRAP_FLAGS} " )
479+ string (REPLACE ";" " " BOOTSTRAP_DEFINITIONS_STRING "${BOOTSTRAP_DEFINITIONS} " )
480+
481+ add_library (nacl_bootstrap OBJECT "linux/nacl_bootstrap.c" )
482+ set_target_properties (nacl_bootstrap PROPERTIES COMPILE_FLAGS "${BOOTSTRAP_FLAGS_STRING} " )
483+ set_target_properties (nacl_bootstrap PROPERTIES COMPILE_DEFINITIONS "${BOOTSTRAP_DEFINITIONS_STRING} " )
484+
480485#TODO: bootstrap_raw = bootstrap_env.Command(
481486#TODO: 'nacl_bootstrap_raw',
482487#TODO: [bootstrap_obj],
@@ -499,4 +504,3 @@ if (LINUX AND NOT BUILD_ELSEWHERE)
499504#TODO: bootstrap_env.Requires(SEL_LDR_NODE, bootstrap_out)
500505#TODO: env.SDKInstallBin('nacl_helper_bootstrap', bootstrap_prog)
501506endif ()
502- endif ()
0 commit comments