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

set no-PIC no-PIE compile options explicitly #1075

Open
wants to merge 2 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
4 changes: 2 additions & 2 deletions dep/bzip2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(bzip2 C)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g0 -O1 -fno-stack-protector")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-pic -g0 -O1 -fno-stack-protector -fno-strict-aliasing -fno-strict-overflow")

set(BZIP2_SRCS
"src/blocksort.c"
Expand All @@ -21,5 +21,5 @@ include_directories(

add_library(bzip2 STATIC ${BZIP2_SRCS})
set_target_properties(bzip2 PROPERTIES
COMPILE_FLAGS "-m32"
COMPILE_FLAGS "-m32 -fno-pic"
)
7 changes: 3 additions & 4 deletions rehlds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")
set(COMPILE_FLAGS "-m32 -fno-pic -fno-pie -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32 -no-pie -Wl,--no-export-dynamic")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-rtti -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-rtti -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

# Remove noxref code and data
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ffunction-sections -fdata-sections")
Expand Down Expand Up @@ -219,7 +219,6 @@ if (CMAKE_BUILD_TYPE MATCHES Unittests)
add_subdirectory(../dep/cppunitlite cppunitlite)
endif()

set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")
add_executable(engine ${appversion.sh} ${ENGINE_SRCS})
target_link_libraries(engine PRIVATE cppunitlite)
else()
Expand Down
8 changes: 3 additions & 5 deletions rehlds/HLTV/Console/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -rdynamic -fPIC options
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")
set(COMPILE_FLAGS "-m32 -fno-pic -fno-pie -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32 -no-pie -Wl,--no-export-dynamic")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else()
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif()

set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")

# Check Intel C++ compiler
if ("$ENV{CXX}" MATCHES "icpc")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
Expand Down
4 changes: 2 additions & 2 deletions rehlds/HLTV/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(COMPILE_FLAGS "-m32 -fno-pic -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
Expand Down
4 changes: 2 additions & 2 deletions rehlds/HLTV/DemoPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(COMPILE_FLAGS "-m32 -fno-pic -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
Expand Down
4 changes: 2 additions & 2 deletions rehlds/HLTV/Director/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(COMPILE_FLAGS "-m32 -fno-pic -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
Expand Down
4 changes: 2 additions & 2 deletions rehlds/HLTV/Proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(COMPILE_FLAGS "-m32 -fno-pic -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
Expand Down
8 changes: 3 additions & 5 deletions rehlds/dedicated/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -rdynamic -fPIC options
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")
set(COMPILE_FLAGS "-m32 -fno-pic -fno-pie -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32 -no-pie -Wl,--no-export-dynamic")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else()
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif()

set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")

# Check Intel C++ compiler
if ("$ENV{CXX}" MATCHES "icpc")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
Expand Down
4 changes: 2 additions & 2 deletions rehlds/filesystem/FileSystem_Stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")

set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(COMPILE_FLAGS "-m32 -fno-pic -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32")

set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-strict-aliasing -fno-strict-overflow")

if (DEBUG)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
Expand Down
Loading