static linking of libgcc on linux ?

David Holmes David.Holmes at
Mon Sep 20 06:02:34 UTC 2010

In the j2se/jdk repo make/common/Defs-linux.gmk contains this old code:

# -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always
# statically link libgcc but will print a warning with the flag. We don't
# want the warning, so check gcc version first.
CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) 
-d'.' -f1)
ifeq ("$(CC_VER_MAJOR)", "3")
OTHER_LDFLAGS  += -static-libgcc

Now we build with gcc 4 we actually don't set -static-libgcc. Can 
someone comment on the correctness of this - should we instead be 
checking for "ifneq ("$(CC_VER_MAJOR)", "2") ?

David Holmes

More information about the build-dev mailing list