Skip to content

Commit

Permalink
Merge pull request #2652 from martin-frbg/flang-fixes
Browse files Browse the repository at this point in the history
Fixes for compilation with flang binary release 20190329
  • Loading branch information
martin-frbg authored Jun 9, 2020
2 parents 430e8b4 + 3ce469a commit f7659be
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
13 changes: 7 additions & 6 deletions Makefile.system
Original file line number Diff line number Diff line change
Expand Up @@ -797,11 +797,11 @@ endif
ifeq ($(USE_OPENMP), 1)
FCOMMON_OPT += -fopenmp
endif
ifeq ($(OSNAME), Linux)
ifeq ($(ARCH), x86_64)
FLANG_VENDOR := $(shell expr `$(FC) --version|cut -f 1 -d "."|head -1`)
endif
endif
#ifeq ($(OSNAME), Linux)
#ifeq ($(ARCH), x86_64)
#FLANG_VENDOR := $(shell expr `$(FC) --version|cut -f 1 -d "."|head -1`)
#endif
#endif
endif

ifeq ($(F_COMPILER), G77)
Expand Down Expand Up @@ -1276,7 +1276,8 @@ endif

override CFLAGS += $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR)
override PFLAGS += $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) -DPROFILE $(COMMON_PROF)
ifeq ($(FLANG_VENDOR),AOCC)
#ifeq ($(FLANG_VENDOR),AOCC)
ifeq ($(F_COMPILER),FLANG)
override FFLAGS += $(filter-out -O2 -O3,$(COMMON_OPT)) -O1 $(FCOMMON_OPT)
else
override FFLAGS += $(COMMON_OPT) $(FCOMMON_OPT)
Expand Down
1 change: 1 addition & 0 deletions cmake/fc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if (${F_COMPILER} STREQUAL "FLANG")
if (USE_OPENMP)
set(FCOMMON_OPT "${FCOMMON_OPT} -fopenmp")
endif ()
set(FCOMMON_OPT "${FCOMMON_OPT} -frecursive")
endif ()

if (${F_COMPILER} STREQUAL "G77")
Expand Down
9 changes: 9 additions & 0 deletions cmake/system.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,15 @@ if (${CMAKE_C_COMPILER} STREQUAL "LSB" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Windows
set(LAPACK_CFLAGS "${LAPACK_CFLAGS} -DLAPACK_COMPLEX_STRUCTURE")
endif ()

if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
if ("${F_COMPILER}" STREQUAL "FLANG")
set(FILTER_FLAGS "-O2;-O3")
foreach (FILTER_FLAG ${FILTER_FLAGS})
string(REPLACE ${FILTER_FLAG} "-O1" CMAKE_Fortran_FLAGS_RELEASE ${CMAKE_Fortran_FLAGS_RELEASE})
endforeach ()
endif ()
endif ()

if (NOT DEFINED SUFFIX)
set(SUFFIX o)
endif ()
Expand Down
6 changes: 5 additions & 1 deletion exports/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ ifeq ($(F_COMPILER), INTEL)
-Wl,--whole-archive $< -Wl,--no-whole-archive \
-Wl,-soname,$(INTERNALNAME) $(EXTRALIB)
$(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK.
else ifeq ($(F_COMPILER), FLANG)
$(FC) $(FFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \
-Wl,--whole-archive $< -Wl,--no-whole-archive \
-Wl,-soname,$(INTERNALNAME) $(EXTRALIB)
$(CC) $(CFLAGS) $(LDFLAGS) -w -o linktest linktest.c ../$(LIBSONAME) $(FEXTRALIB) && echo OK.
else

ifneq ($(C_COMPILER), LSB)
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \
-Wl,--whole-archive $< -Wl,--no-whole-archive \
Expand Down

0 comments on commit f7659be

Please sign in to comment.