diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-08-19 14:25:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-19 14:25:28 +0200 |
| commit | 62ad09fe02c4a67e727822134768e4ebe6c8cde4 (patch) | |
| tree | 9eceacdf5853933ddce244a93d35bf1e6bea3adb /src | |
| parent | e1dc2d5516562c2e6e9668325d897c0eccdc6d2a (diff) | |
| download | PROJ-62ad09fe02c4a67e727822134768e4ebe6c8cde4.tar.gz PROJ-62ad09fe02c4a67e727822134768e4ebe6c8cde4.zip | |
Revert compiler generated Fused Multiply Addition optimized routines (#2327)
Fixes #2326
Partially reverts commit b84c9d0cb61f3bd561da6092e15e294ae7e410e0 to
remove the use of the gcc 6 mechanism of generated multiple versions of
functions with different optimization flags, which was found to causes
crashes when dlopen'ing PROJ on CentOS 7.8 with gcc 8.3.1
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.am | 2 | ||||
| -rw-r--r-- | src/lib_proj.cmake | 13 | ||||
| -rw-r--r-- | src/projections/tmerc.cpp | 28 |
3 files changed, 3 insertions, 40 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 759fb896..86444df3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ check_PROGRAMS = geodtest AM_CPPFLAGS = -DPROJ_LIB=\"$(pkgdatadir)\" \ -DMUTEX_@MUTEX_SETTING@ -I$(top_srcdir)/include @SQLITE3_CFLAGS@ @TIFF_CFLAGS@ @TIFF_ENABLED_FLAGS@ @CURL_CFLAGS@ @CURL_ENABLED_FLAGS@ -AM_CXXFLAGS = @CXX_WFLAGS@ @FLTO_FLAG@ @TARGET_CLONES_FMA_FLAGS@ +AM_CXXFLAGS = @CXX_WFLAGS@ @FLTO_FLAG@ include_HEADERS = proj.h proj_experimental.h proj_constants.h proj_api.h geodesic.h \ proj_symbol_rename.h diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake index 59cb9572..3d41fe9a 100644 --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -303,19 +303,6 @@ source_group("CMake Files" FILES CMakeLists.txt) # Embed PROJ_LIB data files location add_definitions(-DPROJ_LIB="${CMAKE_INSTALL_PREFIX}/${DATADIR}") -# The gcc "target_clones" function attribute relies on an extension -# to the ELF standard. It must not be used on MinGW. -include(CheckCXXSourceCompiles) -set(CMAKE_REQUIRED_QUIET TRUE) -check_cxx_source_compiles([[ - __attribute__((target_clones("fma","default"))) - int clonable() { return 0; } - int main() { return clonable(); } -]] TARGET_CLONES_FMA_ALLOWED) -if(TARGET_CLONES_FMA_ALLOWED) - add_definitions(-DTARGET_CLONES_FMA_ALLOWED) -endif() - ################################################# ## targets: libproj and proj_config.h ################################################# diff --git a/src/projections/tmerc.cpp b/src/projections/tmerc.cpp index 3a58fc02..0c567e13 100644 --- a/src/projections/tmerc.cpp +++ b/src/projections/tmerc.cpp @@ -66,15 +66,6 @@ struct tmerc_data { /* Constant for "exact" transverse mercator */ #define PROJ_ETMERC_ORDER 6 -// Determine if we should try to provide optimized versions for the Fused Multiply Addition -// Intel instruction set. We use GCC 6 __attribute__((target_clones("fma","default"))) -// mechanism for that, where the compiler builds a default version, and one that -// uses FMA. And at runtimes it figures out automatically which version can be used -// by the current CPU. This allows to create general purpose binaries. -#if defined(TARGET_CLONES_FMA_ALLOWED) && defined(__GNUC__) && __GNUC__ >= 6 && defined(__x86_64__) && !defined(__FMA__) -#define BUILD_FMA_OPTIMIZED_VERSION -#endif - /*****************************************************************************/ // // Approximate Transverse Mercator functions @@ -82,10 +73,7 @@ struct tmerc_data { /*****************************************************************************/ -#ifdef BUILD_FMA_OPTIMIZED_VERSION -__attribute__((target_clones("fma","default"))) -#endif -inline static PJ_XY approx_e_fwd_internal (PJ_LP lp, PJ *P) +static PJ_XY approx_e_fwd (PJ_LP lp, PJ *P) { PJ_XY xy = {0.0, 0.0}; const auto *Q = &(static_cast<struct tmerc_data*>(P->opaque)->approx); @@ -127,11 +115,6 @@ inline static PJ_XY approx_e_fwd_internal (PJ_LP lp, PJ *P) return (xy); } -static PJ_XY approx_e_fwd (PJ_LP lp, PJ *P) -{ - return approx_e_fwd_internal(lp, P); -} - static PJ_XY approx_s_fwd (PJ_LP lp, PJ *P) { PJ_XY xy = {0.0,0.0}; double b, cosphi; @@ -177,10 +160,7 @@ static PJ_XY approx_s_fwd (PJ_LP lp, PJ *P) { return xy; } -#ifdef BUILD_FMA_OPTIMIZED_VERSION -__attribute__((target_clones("fma","default"))) -#endif -inline static PJ_LP approx_e_inv_internal (PJ_XY xy, PJ *P) { +static PJ_LP approx_e_inv (PJ_XY xy, PJ *P) { PJ_LP lp = {0.0,0.0}; const auto *Q = &(static_cast<struct tmerc_data*>(P->opaque)->approx); @@ -212,10 +192,6 @@ inline static PJ_LP approx_e_inv_internal (PJ_XY xy, PJ *P) { return lp; } -static PJ_LP approx_e_inv (PJ_XY xy, PJ *P) { - return approx_e_inv_internal(xy, P); -} - static PJ_LP approx_s_inv (PJ_XY xy, PJ *P) { PJ_LP lp = {0.0, 0.0}; double h, g; |
