Skip to content

Commit

Permalink
Issue #369: Introduced COMMON flag to support GCC-10 and header-only.…
Browse files Browse the repository at this point in the history
… LIBXSMM now compiles in any case, however header-only applications will duplicated symbols per each object-file if -fcommon is not the default. GCC-10 changed from -fcommon to -fno-common, i.e., duplicated symbols cause linker errors instead of being quietly dropped.
  • Loading branch information
hfp committed Feb 11, 2020
1 parent 5002813 commit 5951efc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ endif
# avoid to link with C++ standard library
FORCE_CXX = 0

# GCC-10 style linkage (error for duplicate symbols)
COMMON = 0

# include common Makefile artifacts
include $(ROOTDIR)/Makefile.inc

Expand Down
23 changes: 20 additions & 3 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,17 @@ else # fallback
endif
endif

COMMON ?= 1
ifneq (0,$(COMMON))
ifneq (,$(call ctest,$(LD),-fcommon))
CFLAGS += -fcommon
endif
else
ifneq (,$(call ctest,$(LD),-fno-common))
CFLAGS += -fno-common
endif
endif

FREEFORM ?= 1
ifeq (,$(strip $(GFC)))
ifneq (0,$(INTEL))
Expand Down Expand Up @@ -1039,7 +1050,9 @@ ifneq (0,$(INTEL))
CPEDANTIC += -diag-disable 177,1419,1572,2547,10382
CWARNEXTRA = -Wremarks
ifeq (1,$(PEDANTIC))
CSTD = -std=c99
ifeq (0,$(FORCE_CXX))
CSTD = -std=c99
endif
CFLAGS += $(CSTD)
ifeq (,$(strip $(GFC)))
FSTD = -std03
Expand Down Expand Up @@ -1281,7 +1294,9 @@ else # GCC assumed
endif
FPEDANTIC += $(FWARNEXTRA)
ifeq (1,$(PEDANTIC))
CSTD = -std=c99
ifeq (0,$(FORCE_CXX))
CSTD = -std=c99
endif
CXXFLAGS += $(CPEDANTIC) -Wno-long-long
#CXXFLAGS += -Wno-missing-field-initializers
CFLAGS += $(CSTD) $(CPEDANTIC)
Expand All @@ -1301,7 +1316,9 @@ else # GCC assumed
CPEDANTIC += -Wno-long-long
CXXFLAGS += $(CPEDANTIC)
else # Clang may run into ICEs under macOS
CSTD = -std=c99
ifeq (0,$(FORCE_CXX))
CSTD = -std=c99
endif
CXXFLAGS += $(CPEDANTIC) -Wno-long-long
endif
#CXXFLAGS += -Wno-missing-field-initializers #-Wzero-as-null-pointer-constant
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
master-1.14-1180
master-1.14-1181

0 comments on commit 5951efc

Please sign in to comment.