Skip to content

Commit

Permalink
Require standards-compliant c++11 ABI (#882)
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Oct 6, 2020
1 parent 14b6941 commit 6008fbf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(RT_BINARY_DIR ${PROJECT_BINARY_DIR}/dyninstAPI_RT)

set (CMAKE_MODULE_PATH "${DYNINST_ROOT}/cmake" "${DYNINST_ROOT}/cmake/Modules" ${CMAKE_MODULE_PATH})

# Set the C and C++ language API and ABI standards
# Set the C and C++ language standards
include(LanguageStandards)

# Find the necessary third-party libraries
Expand Down
1 change: 0 additions & 1 deletion cmake/DyninstConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ set (DYNINST_LIBRARIES "dyninstAPI")
# Other variables Dyninst mutators may depend on
set (DYNINST_PLATFORM "@PLATFORM@")
set (DYNINST_INTERNAL_DEFINES @UNIFIED_DEFINES@)
set (USE_CXX11_ABI "@USE_CXX11_ABI@")

if(DYNINST_FIND_COMPONENTS)
foreach(COMP DYNINST_FIND_COMPONENTS)
Expand Down
18 changes: 6 additions & 12 deletions cmake/LanguageStandards.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
#
# Configure C++ and C Language API and ABI standards for Dyninst
#
# ----------------------------------------
#
# Accepts the following CMake variables
#
# USE_CXX11_ABI - Enable using the GNU C++11 ABI (aka, the post gcc-5 ABI)
#
#=========================================================================

#
Expand All @@ -22,15 +16,15 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(USE_CXX11_ABI "" CACHE STRING "Override the default GNU C++11 ABI setting")
if(NOT ("${USE_CXX11_ABI}" STREQUAL ""))
if(${USE_CXX11_ABI})
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
else()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
# Require the standards-compliant C++11 ABI for gcc
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1")
message(FATAL_ERROR "Dyninst requires gcc >= 5.1")
endif()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
endif()


#
# -------- C language features ----------------
#
Expand Down
10 changes: 0 additions & 10 deletions common/h/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,6 @@
#include <string>
#include "dyntypes.h"

/* GCC 4.7.0 and 4.7.1 broke ABI compatibility between C++11 and C++98
* code in a MAJOR way. Disallow that combination; other versions of
* the compiler are fine.
*/
#if !((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__))
#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20120322) && (__GLIBCXX__ < 20120920)
#error "Using GCC 4.7.0 or 4.7.1 with Dyninst requires the -std:c++0x or -std:c++11 flag. Other versions do not."
#endif
#endif

#if defined(_MSC_VER)
#pragma warning(disable: 4251 4275 4396 4996)
#endif
Expand Down

0 comments on commit 6008fbf

Please sign in to comment.