RFR(8u): 8211933: [8u] hotspot adlc needs to link statically with libstdc++ for gcc7.3

Erik Joelsson erik.joelsson at oracle.com
Wed Oct 24 23:26:40 UTC 2018


Looks good to me.

/Erik


On 2018-10-24 16:16, Kevin Walls wrote:
> Hi,
>
> I'd like to get a review of an 8u change:
>
> 8211933: [8u] hotspot adlc needs to link statically with libstdc++ for 
> gcc7.3
> https://bugs.openjdk.java.net/browse/JDK-8211933
>
> webrev:
> http://cr.openjdk.java.net/~kevinw/8211933/webrev.00/
>
> Essentially adds -static-libstdc++ for linking adlc during an 8u 
> build. This is needed e.g. when we build with gcc7.x using our devkit 
> bundle and we won't necessarily find a correct version of that library 
> on the system.
>
> (Things are still very different in 9+ compared to 8u, despite all our 
> changes this year...)
> I find that changing the definition of
>
> STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
>
> ...in gcc.make is a problem, the linked VM fails to load with 
> "undefined symbol: __cxa_pure_virtual"
>
> If using STATIC_STDCXX as it's already defined, to build adlc, then 
> adlc doesn't statically link again libcstd and it gives the symbol 
> version not found error.  So defining a separate STATIC... var for 
> adlc keeps everyone happy.
>
> Many thanks
> Kevin
>
>
> bash-4.2$ cd jdk8u-dev/hotspot
> bash-4.2$ hg diff
> diff -r 992120803410 make/linux/makefiles/adlc.make
> --- a/make/linux/makefiles/adlc.make    Mon Oct 22 05:26:38 2018 -0400
> +++ b/make/linux/makefiles/adlc.make    Wed Oct 24 16:15:07 2018 -0700
> @@ -105,9 +105,15 @@
>
>  all: $(EXEC)
>
> +ADLC_LD_FLAGS=
> +ifeq ($(STATIC_CXX), true)
> +  ADLC_LD_FLAGS = $(STATIC_LIBGCC) $(ADLC_STATIC_STDCXX)
> +endif
> +
> +
>  $(EXEC) : $(OBJECTS)
>         @echo Making adlc
> -       $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) 
> -o $(EXEC) $(OBJECTS)
> +       $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) 
> $(ADLC_LD_FLAGS) -o $(EXEC) $(OBJECTS)
>
>  # Random dependencies:
>  $(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp 
> adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp 
> formsopt.hpp formssel.hpp
> diff -r 992120803410 make/linux/makefiles/gcc.make
> --- a/make/linux/makefiles/gcc.make     Mon Oct 22 05:26:38 2018 -0400
> +++ b/make/linux/makefiles/gcc.make     Wed Oct 24 16:15:07 2018 -0700
> @@ -277,6 +277,8 @@
>
>  # statically link libstdc++.so, work with gcc but ignored by g++
>  STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
> +# While the VM needs the above line, adlc needs a separate setting:
> +ADLC_STATIC_STDCXX = -static-libstdc++
>
>  ifeq ($(USE_CLANG),)
>    # statically link libgcc and/or libgcc_s, libgcc does not exist 
> before gcc-3.x.
> bash-4.2$
>




More information about the build-dev mailing list