Skip to content

Commit ca4b733

Browse files
committed
makefile: Force gcc/clang -fcommon to address future gcc -fno-common default
as reported and discussed in simh#794
1 parent 30c182a commit ca4b733

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

makefile

+7
Original file line numberDiff line numberDiff line change
@@ -1136,11 +1136,15 @@ else
11361136
ifneq (3,$(GCC_MAJOR_VERSION))
11371137
ifeq (,$(GCC_OPTIMIZERS_CMD))
11381138
GCC_OPTIMIZERS_CMD = ${GCC} --help=optimizers
1139+
GCC_COMMON_CMD = ${GCC} --help=common
11391140
endif
11401141
endif
11411142
ifneq (,$(GCC_OPTIMIZERS_CMD))
11421143
GCC_OPTIMIZERS = $(shell $(GCC_OPTIMIZERS_CMD))
11431144
endif
1145+
ifneq (,$(GCC_COMMON_CMD))
1146+
GCC_OPTIMIZERS += $(shell $(GCC_COMMON_CMD))
1147+
endif
11441148
ifneq (,$(findstring $(GCC_VERSION),$(LTO_EXCLUDE_VERSIONS)))
11451149
NO_LTO = 1
11461150
endif
@@ -1162,6 +1166,9 @@ else
11621166
ifneq (,$(findstring -fstrict-overflow,$(GCC_OPTIMIZERS)))
11631167
CFLAGS_O += -fno-strict-overflow
11641168
endif
1169+
ifneq (,$(findstring -fcommon,$(GCC_OPTIMIZERS))$(findstring -fno-common,$(GCC_OPTIMIZERS)))
1170+
CFLAGS_O += -fcommon
1171+
endif
11651172
ifeq (,$(NO_LTO))
11661173
ifneq (,$(findstring -flto,$(GCC_OPTIMIZERS)))
11671174
CFLAGS_O += -flto -fwhole-program

0 commit comments

Comments
 (0)