|
@@ -450,14 +450,20 @@ endif
|
450
|
450
|
|
451
|
451
|
# Enable per-item sections and section garbage collection. Note that
|
452
|
452
|
# some older versions of gcc support -fdata-sections but treat it as
|
453
|
|
-# implying -fno-common, which would break our build.
|
|
453
|
+# implying -fno-common, which would break our build. Some other older
|
|
454
|
+# versions issue a spurious and uninhibitable warning if
|
|
455
|
+# -ffunction-sections is used with -g, which would also break our
|
|
456
|
+# build since we use -Werror.
|
454
|
457
|
#
|
455
|
458
|
ifeq ($(CCTYPE),gcc)
|
456
|
459
|
DS_TEST = $(ECHO) 'char x;' | \
|
457
|
460
|
$(CC) -fdata-sections -S -x c - -o - 2>/dev/null | \
|
458
|
461
|
grep -E '\.comm' > /dev/null
|
459
|
462
|
DS_FLAGS := $(shell $(DS_TEST) && $(ECHO) '-fdata-sections')
|
460
|
|
-CFLAGS += -ffunction-sections $(DS_FLAGS)
|
|
463
|
+FS_TEST = $(CC) -ffunction-sections -g -c -x c /dev/null \
|
|
464
|
+ -o /dev/null 2>/dev/null
|
|
465
|
+FS_FLAGS := $(shell $(FS_TEST) && $(ECHO) '-ffunction-sections')
|
|
466
|
+CFLAGS += $(FS_FLAGS) $(DS_FLAGS)
|
461
|
467
|
endif
|
462
|
468
|
LDFLAGS += --gc-sections
|
463
|
469
|
|