Skip to content
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

64-bit compatibility #67

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,19 @@ else(WIN32)
-fno-builtin
-w
-g3
-m32
)

# Link everything 32-bit (until we have a 64-bit option)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
# It's 2019 so we compile and link everything 64-bit, unless the host architecture is i368
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ")")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ") ")

EXECUTE_PROCESS( COMMAND uname -m '\n' OUTPUT_VARIABLE ARCHITECTURE )
message( STATUS "Architecture: ${ARCHITECTURE}" )
if( ${ARCHITECTURE} MATCHES "i368")
add_compile_options(-m32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
endif()

# Linker options
# Dynamic by default
Expand Down
16 changes: 11 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,20 @@ case $LINK in
STATIC) CMAKE_OPTS="$CMAKE_OPTS -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON";;
esac

#if [[ "$(uname -p)" == "x86_64" ]]; then
# CMAKE_OPTS="$CMAKE_OPTS -DARCH=64";
#fii

# Prefer ninja over make, if it is available
if which ninja 2>&1 >/dev/null; then
CMAKE_OPTS="-G Ninja $CMAKE_OPTS"
BUILD_FLAGS=
else
#if which ninja 2>&1 >/dev/null; then
# CMAKE_OPTS="-G Ninja $CMAKE_OPTS"
# BUILD_FLAGS=
#else
# BUILD_FLAGS="-- -j$(getconf _NPROCESSORS_ONLN)"
BUILD_FLAGS=
fi
#fi
Comment on lines +42 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to use Ninja, when it's available, but adding an option to force Makefiles seems like a good idea.

Could you add an option for overriding Ninja here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, ninja is fast, but not everyone uses them. Makefiles are just more widely adapted and a good tool to build challenges individually. I'll make it an option 👍




cmake $CMAKE_OPTS ..

Expand Down
2 changes: 1 addition & 1 deletion challenges/Azurad/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_compile_options( -fno-exceptions -fno-rtti -DCPLUSPLUS )
set( SERVICE_ID "00119" )
set( AUTHOR_ID "KPRCA" )
add_compile_options( -Oz -g )
add_compile_options( -Os -g )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, why does this need changed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparantly, -Oz is a MacOS version of -Os ¯_(ツ)_/¯

set( VULN_COUNT "1" )
buildCB()
2 changes: 1 addition & 1 deletion challenges/Blubber/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_compile_options( -fno-exceptions -fno-rtti -DCPLUSPLUS )
set( SERVICE_ID "00111" )
set( AUTHOR_ID "KPRCA" )
add_compile_options( -O1 -g )
add_compile_options( -O1 -g -fpermissive -fms-extensions)
set( VULN_COUNT "1" )
buildCB()
2 changes: 1 addition & 1 deletion challenges/CML/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_compile_options( -fno-exceptions -fno-rtti -DCPLUSPLUS )
set( SERVICE_ID "00097" )
set( AUTHOR_ID "KPRCA" )
add_compile_options( -O3 -g )
add_compile_options( -O3 -g -fpermissive -fms-extensions )
set( VULN_COUNT "1" )
buildCB()
2 changes: 1 addition & 1 deletion challenges/Charter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set( POLLS_TESTING_SEED "-710644949" )
set( POLLS_RELEASE_MAX_DEPTH "20" )
set( POLLS_RELEASE_SEED "40" )
add_compile_options( -O0 -g -mno-sse -fblocks )
add_compile_options( -O0 -g -mno-sse -fblocks -O3 -msse2)
set( SERVICE_ID "00006" )
set( AUTHOR_ID "CROMU" )
set( NO_STRIP "1" )
Expand Down
2 changes: 1 addition & 1 deletion challenges/FailAV/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set( VULN_COUNT "1" )
add_compile_options( -fno-exceptions -fno-rtti -DCPLUSPLUS )
set( override LDFLAGS "-nostdlib -static -Ttext=0x90000000" )
add_compile_options( -Oz -g )
add_compile_options( -Oz -g -fpermissive -fms-extensions)
set( SERVICE_ID "00091" )
set( AUTHOR_ID "KPRCA" )
buildCB()
2 changes: 1 addition & 1 deletion challenges/Messaging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_compile_options( -fno-exceptions -fno-rtti -DCPLUSPLUS )
set( SERVICE_ID "00075" )
set( AUTHOR_ID "KPRCA" )
add_compile_options( -O3 -g -DDISABLE_HEAP_GUARD )
add_compile_options( -O3 -g -DDISABLE_HEAP_GUARDi -fpermissive -fms-extensions )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's an extraneous i character at the end of -DDISABLE_HEAP_GUARDi

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad

set( VULN_COUNT "1" )
buildCB()
2 changes: 1 addition & 1 deletion challenges/PTaaS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set( SERVICE_ID "00054" )
set( AUTHOR_ID "NRFIN" )
add_compile_options( -O0 -g -mno-sse )
add_compile_options( -O0 -g -mno-sse -msse2 -O3 )
set( VULN_COUNT "1" )
buildCB()
buildSO()
2 changes: 1 addition & 1 deletion challenges/ValveChecks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set( POLLS_TESTING_SEED "1677617456" )
set( POLLS_RELEASE_SEED "1681795162" )
add_compile_options( -mno-sse -O0 -g -fcommon )
add_compile_options( -mno-sse -O0 -g -fcommon -msse2 -O3 )
set( SERVICE_ID "00016" )
set( AUTHOR_ID "NRFIN" )
set( POLLS_RELEASE_COUNT "1000" )
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.