Skip to content

Commit d37b299

Browse files
committed
Merge branch 'ak/gcc46-profile-feedback'
* ak/gcc46-profile-feedback: Add explanation of the profile feedback build to the README Add profile feedback build to git Add option to disable NORETURN
2 parents 5527257 + 3900100 commit d37b299

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

INSTALL

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ set up install paths (via config.mak.autogen), so you can write instead
2525
$ make all doc ;# as yourself
2626
# make install install-doc install-html;# as root
2727

28+
If you're willing to trade off (much) longer build time for a later
29+
faster git you can also do a profile feedback build with
30+
31+
$ make profile-all
32+
# make prefix=... install
33+
34+
This will run the complete test suite as training workload and then
35+
rebuild git with the generated profile feedback. This results in a git
36+
which is a few percent faster on CPU intensive workloads. This
37+
may be a good tradeoff for distribution packagers.
38+
39+
Note that the profile feedback build stage currently generates
40+
a lot of additional compiler warnings.
2841

2942
Issues of note:
3043

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ all::
153153
# that tells runtime paths to dynamic libraries;
154154
# "-Wl,-rpath=/path/lib" is used instead.
155155
#
156+
# Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
157+
# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
158+
#
156159
# Define USE_NSEC below if you want git to care about sub-second file mtimes
157160
# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
158161
# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
@@ -1378,6 +1381,9 @@ endif
13781381
ifdef USE_ST_TIMESPEC
13791382
BASIC_CFLAGS += -DUSE_ST_TIMESPEC
13801383
endif
1384+
ifdef NO_NORETURN
1385+
BASIC_CFLAGS += -DNO_NORETURN
1386+
endif
13811387
ifdef NO_NSEC
13821388
BASIC_CFLAGS += -DNO_NSEC
13831389
endif
@@ -2499,3 +2505,19 @@ cover_db: coverage-report
24992505

25002506
cover_db_html: cover_db
25012507
cover -report html -outputdir cover_db_html cover_db
2508+
2509+
### profile feedback build
2510+
#
2511+
.PHONY: profile-all profile-clean
2512+
2513+
PROFILE_GEN_CFLAGS := $(CFLAGS) -fprofile-generate -DNO_NORETURN=1
2514+
PROFILE_USE_CFLAGS := $(CFLAGS) -fprofile-use -fprofile-correction -DNO_NORETURN=1
2515+
2516+
profile-clean:
2517+
$(RM) $(addsuffix *.gcda,$(object_dirs))
2518+
$(RM) $(addsuffix *.gcno,$(object_dirs))
2519+
2520+
profile-all: profile-clean
2521+
$(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" all
2522+
$(MAKE) CFLAGS="$(PROFILE_GEN_CFLAGS)" -j1 test
2523+
$(MAKE) CFLAGS="$(PROFILE_USE_CFLAGS)" all

git-compat-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ extern char *gitbasename(char *);
222222
#if __HP_cc >= 61000
223223
#define NORETURN __attribute__((noreturn))
224224
#define NORETURN_PTR
225-
#elif defined(__GNUC__)
225+
#elif defined(__GNUC__) && !defined(NO_NORETURN)
226226
#define NORETURN __attribute__((__noreturn__))
227227
#define NORETURN_PTR __attribute__((__noreturn__))
228228
#elif defined(_MSC_VER)

0 commit comments

Comments
 (0)