Преглед на файлове

[build] Add -fno-dwarf2-cfi-asm to CFLAGS if supported by the gcc in use

gcc 4.4 defaults to using .cfi assembler directives for debugging
information, which causes unneeded .eh_frame sections to be generated.
These sections are already stripped out by our linker script, so don't
affect the final build, but do distort the output of "size" when run
on individual .o files; the .eh_frame size is included within the size
reported for .text.  This makes it difficult to accurately judge the
effects of source code changes upon object code size.

Fix by adding -fno-dwarf2-cfi-asm to CFLAGS if we detect that this
option is supported by the gcc that we are compiling with.

Tested-by: Daniel Verkamp <daniel@drv.nu>
tags/v0.9.8
Michael Brown преди 15 години
родител
ревизия
8afafb6532
променени са 1 файла, в които са добавени 10 реда и са изтрити 0 реда
  1. 10
    0
      src/Makefile.housekeeping

+ 10
- 0
src/Makefile.housekeeping Целия файл

@@ -134,6 +134,16 @@ SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
134 134
 CFLAGS	+= $(SP_FLAGS)
135 135
 endif
136 136
 
137
+# gcc 4.4 generates .eh_frame sections by default, which distort the
138
+# output of "size".  Inhibit this.
139
+#
140
+ifeq ($(CCTYPE),gcc)
141
+CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \
142
+		 -o /dev/null >/dev/null 2>&1
143
+CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm')
144
+CFLAGS	+= $(CFI_FLAGS)
145
+endif
146
+
137 147
 # Some versions of gas choke on division operators, treating them as
138 148
 # comment markers.  Specifying --divide will work around this problem,
139 149
 # but isn't available on older gas versions.

Loading…
Отказ
Запис