-
Notifications
You must be signed in to change notification settings - Fork 69
Early support of the Saigo toolchain #981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9ca2664
nacl/syscall_bindings_trampoline: make it build on Saigo
illwieckz ff6a91d
system: workarounds for Saigo
illwieckz 3a59c05
cmake: building nexe against zlib is only required by cgame because o…
illwieckz 80e8006
cmake: add Saigo build support, set NACL_VMS_PROJECTS and GAME_PIE
illwieckz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| set(PLATFORM_PREFIX "${DEPS_DIR}/saigo_newlib/bin") | ||
| set(PLATFORM_TRIPLET "${SAIGO_ARCH}-nacl") | ||
| set(PLATFORM_EXE_SUFFIX ".nexe") | ||
|
|
||
| set(CMAKE_SYSTEM_NAME "Generic") | ||
|
|
||
| set(CMAKE_C_COMPILER "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-clang") | ||
| set(CMAKE_CXX_COMPILER "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-clang++") | ||
| set(CMAKE_AR "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-ar" CACHE FILEPATH "Archiver" FORCE) | ||
| set(CMAKE_RANLIB "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-ranlib") | ||
| set(SAIGO_STRIP "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-strip") | ||
| set(CMAKE_FIND_ROOT_PATH "${PLATFORM_PREFIX}/../${PLATFORM_TRIPLET}") | ||
|
|
||
| # Copy-pasted from the PNaCl toolchain, it's not sure we need it. | ||
| set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1) | ||
| set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1) | ||
| set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) | ||
| set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) | ||
| set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1) | ||
| set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1) | ||
| set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@") | ||
| set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@") | ||
|
|
||
| # Copy-pasted from the PNaCl toolchain, it's not sure we need it. | ||
| # These commands can fail on windows if there is a space at the beginning | ||
| set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> rc <TARGET> <LINK_FLAGS> <OBJECTS>") | ||
| set(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> rc <TARGET> <LINK_FLAGS> <OBJECTS>") | ||
|
|
||
| set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") | ||
| set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") | ||
|
|
||
| set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") | ||
| set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") | ||
|
|
||
| # Copy-pasted from the PNaCl toolchain, it's not sure we need it. | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) | ||
|
|
||
| set(NACL ON) | ||
|
|
||
| set(CMAKE_C_FLAGS "") | ||
| set(CMAKE_CXX_FLAGS "") | ||
|
|
||
| function(saigo_finalize dir module arch) | ||
| set(SUBPROJECT_NEXE ${dir}/nacl-vms-${arch}/${module}.nexe) | ||
| set(NEXE ${dir}/${module}-${arch}.nexe) | ||
| set(STRIPPED_NEXE ${dir}/${module}-${arch}-stripped.nexe) | ||
|
|
||
| add_custom_command( | ||
| OUTPUT ${NEXE} | ||
| COMMENT "Copying ${module} (${arch})" | ||
| DEPENDS ${SUBPROJECT_NEXE} | ||
| COMMAND | ||
| ${CMAKE_COMMAND} | ||
| -E copy | ||
| ${SUBPROJECT_NEXE} | ||
| ${NEXE} | ||
| ) | ||
|
|
||
| add_custom_command( | ||
| OUTPUT ${STRIPPED_NEXE} | ||
| COMMENT "Stripping ${module} (${arch})" | ||
| DEPENDS ${NEXE} | ||
| COMMAND | ||
| "${SAIGO_STRIP}" | ||
| -s | ||
| ${NEXE} | ||
| -o ${STRIPPED_NEXE} | ||
| ) | ||
|
|
||
| add_custom_target(${module}-${arch} ALL DEPENDS ${STRIPPED_NEXE}) | ||
| add_dependencies(${module}-${arch} ${module}-nacl) | ||
| endfunction() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,8 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| #include <sys/random.h> | ||
| #endif | ||
| #ifdef __native_client__ | ||
| #if !defined(__saigo__) | ||
| #include <nacl/nacl_exception.h> | ||
| #include <nacl/nacl_minidump.h> | ||
| #endif | ||
| #include <nacl/nacl_random.h> | ||
| #else | ||
| #include <dlfcn.h> | ||
|
|
@@ -335,8 +337,10 @@ static void CrashHandler(const void* data, size_t n) | |
|
|
||
| void SetupCrashHandler() | ||
| { | ||
| #if !defined(__saigo__) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this removed? It's the only debugging mechanism we have for NaCl.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably because I didn't make it work. |
||
| nacl_minidump_register_crash_handler(); | ||
| nacl_minidump_set_callback(CrashHandler); | ||
| #endif | ||
| } | ||
| #else | ||
| NORETURN static void CrashHandler(int sig) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.