[RFR] JDK-8156980: Hotspot build doesn't have -std=gnu++98 gcc option

Leslie Zhai zhaixiang at loongson.cn
Wed Sep 5 09:52:35 UTC 2018


Hi Andrew,

Thanks for your response!

I just quote it from here:

http://mail.openjdk.java.net/pipermail/build-dev/2016-July/017464.html

I spotted that jsig is just a single C file and so doesn't
need the -std flag. In fact, it complains about it:

Compiling jsig.c (for libjsig.so)
( ( /usr/bin/gcc -fPIC -D_GNU_SOURCE -D_REENTRANT -O2 -pipe -march=core2 
-std=gnu++98 -m64 -g -DTHIS_FILE='"jsig.c"' -c -MMD -\
MF /home/andrew/builder/dev/hotspot/libjsig/objs/jsig.d -o 
/home/andrew/builder/dev/hotspot/libjsig/objs/jsig.o /home/andrew/p\
rojects/openjdk/upstream/dev/hotspot/src/os/linux/vm/jsig.c > 
 >(/usr/bin/tee /home/andrew/builder/dev/hotspot/libjsig/objs/jsi\
g.o.log) 2> >(/usr/bin/tee 
/home/andrew/builder/dev/hotspot/libjsig/objs/jsig.o.log >&2) || ( 
exitcode=$? && /bin/cp /home/and\
rew/builder/dev/hotspot/libjsig/objs/jsig.o.log 
/home/andrew/builder/dev/make-support/failure-logs/hotspot_libjsig_objs_jsig.o\
.log && exit $exitcode ) ) && wait )
cc1: warning: command line option '-std=gnu++98' is valid for C++/ObjC++ 
but not for C

It is still able to reproducible the warning for OpenJDK8 mips64el with 
GCC and LLVM toolchains.  And gcc treat it as warning,  so it is often 
be ignored,  but clang treat it as error.
----- 8< -------- 8< -------- 8< -------- 8< -------- 8< -------- 8< ---

Because CXXSTD_CXXFLAG="-std=gnu++98",  such flag might be effect 
others,  so workaround for LLVM toolchain:
diff -r 1a87e769fb7f hotspot/make/linux/makefiles/jsig.make
--- a/hotspot/make/linux/makefiles/jsig.make    Mon Sep 03 18:02:35 2018 
+0800
+++ b/hotspot/make/linux/makefiles/jsig.make    Wed Sep 05 15:53:22 2018 
+0800
@@ -54,7 +54,7 @@
  $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
      @echo Making signal interposition lib...
      $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
-                         $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) 
$(EXTRA_CFLAGS) -o $@ $< -ldl
+                         $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) 
-fintegrated-as -o $@ $< -ldl
  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
      $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
      $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
diff -r 1a87e769fb7f hotspot/make/linux/makefiles/saproc.make
--- a/hotspot/make/linux/makefiles/saproc.make    Mon Sep 03 18:02:35 
2018 +0800
+++ b/hotspot/make/linux/makefiles/saproc.make    Wed Sep 05 15:53:22 
2018 +0800
@@ -118,7 +118,7 @@
                 $(SASRCFILES) \
                 $(SA_LFLAGS) \
                 $(SA_DEBUG_CFLAGS) \
-               $(EXTRA_CFLAGS) \
+ -fintegrated-as                                      \
                 -o $@ \
                 -lthread_db
  endif

Please give me some suggestion,  thanks a lot!

-- 
Regards,
Leslie Zhai





More information about the build-dev mailing list