#142 Add -mincoming-stack-boundary=2 -mpreferred-stack-boundary=4 on x86_32 for stack alignment
Closed 2 years ago by jvanek. Opened 2 years ago by jvanek.
Unknown source buildII  into  rawhide

file modified
+85 -50
@@ -23,6 +23,8 @@

  %bcond_without staticlibs

  # Remove build artifacts by default

  %bcond_with artifacts

+ # Build a fresh libjvm.so for use in a copy of the bootstrap JDK

+ %bcond_without fresh_libjvm

  

  # Workaround for stripping of debug symbols from static libraries

  %if %{with staticlibs}
@@ -32,6 +34,13 @@

  %global include_staticlibs 0

  %endif

  

+ # Define whether to use the bootstrap JDK directly or with a fresh libjvm.so

+ %if %{with fresh_libjvm}

+ %global build_hotspot_first 1

+ %else

+ %global build_hotspot_first 0

+ %endif

+ 

  # The -g flag says to use strip -g instead of full strip on DSOs or EXEs.

  # This fixes detailed NMT and other tools which need minimal debug info.

  # See: https://bugzilla.redhat.com/show_bug.cgi?id=1520879
@@ -98,13 +107,13 @@

  # Set of architectures which support multiple ABIs

  %global multilib_arches %{power64} sparc64 x86_64

  # Set of architectures for which we build slowdebug builds

- %global debug_arches    %{ix86} x86_64 sparcv9 sparc64 %{aarch64} %{power64} s390x

+ %global debug_arches    x86_64 sparcv9 sparc64 %{aarch64} %{power64} s390x

  # Set of architectures for which we build fastdebug builds

  %global fastdebug_arches x86_64 ppc64le aarch64

  # Set of architectures with a Just-In-Time (JIT) compiler

  %global jit_arches      %{debug_arches} %{arm}

  # Set of architectures which use the Zero assembler port (!jit_arches)

- %global zero_arches ppc s390

+ %global zero_arches ppc s390 %{ix86}

  # Set of architectures which run a full bootstrap cycle

  %global bootstrap_arches %{jit_arches}

  # Set of architectures which support SystemTap tapsets
@@ -112,7 +121,7 @@

  # Set of architectures with a Ahead-Of-Time (AOT) compiler

  %global aot_arches      x86_64 %{aarch64}

  # Set of architectures which support the serviceability agent

- %global sa_arches       %{ix86} x86_64 sparcv9 sparc64 %{aarch64} %{power64} %{arm}

+ %global sa_arches       x86_64 sparcv9 sparc64 %{aarch64} %{power64} %{arm}

  # Set of architectures which support class data sharing

  # As of JDK-8005165 in OpenJDK 10, class sharing is not arch-specific

  # However, it does segfault on the Zero assembler port, so currently JIT only
@@ -217,6 +226,11 @@

  %global release_targets images docs-zip

  # No docs nor bootcycle for debug builds

  %global debug_targets images

+ # Target to use to just build HotSpot

+ %global hotspot_target hotspot

+ 

+ # JDK to use for bootstrapping

+ %global bootjdk /usr/lib/jvm/java-%{buildjdkver}-openjdk

  

  # Disable LTO as this causes build failures at the moment.

  # See RHBZ#1861401
@@ -228,7 +242,7 @@

  # We replace it with -Wformat (required by -Werror=format-security) and -Wno-cpp to avoid FORTIFY_SOURCE warnings

  # We filter out -fexceptions as the HotSpot build explicitly does -fno-exceptions and it's otherwise the default for C++

  %global ourflags %(echo %optflags | sed -e 's|-Wall|-Wformat -Wno-cpp|' | sed -r -e 's|-O[0-9]*||')

- %global ourcppflags %(echo %ourflags | sed -e 's|-fexceptions||')

+ %global ourcppflags %(echo %ourflags | sed -e 's|-fexceptions||' | sed -e 's|-mstackrealign||')

  %global ourldflags %{__global_ldflags}

  

  # With disabled nss is NSS deactivated, so NSS_LIBDIR can contain the wrong path
@@ -354,7 +368,7 @@

  %global top_level_dir_name   %{origin}

  %global top_level_dir_name_backup %{top_level_dir_name}-backup

  %global buildver        9

- %global rpmrelease      2

+ %global rpmrelease      3

  #%%global tagsuffix     %%{nil}

  # Priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit

  %if %is_system_jdk
@@ -1320,7 +1334,7 @@

  BuildRequires: javapackages-filesystem

  BuildRequires: java-%{buildjdkver}-openjdk-devel

  # Zero-assembler build requirement

- %ifnarch %{jit_arches}

+ %ifarch %{zero_arches}

  BuildRequires: libffi-devel

  %endif

  # 2021a required as of JDK-8260356 in April 2021 CPU
@@ -1770,17 +1784,20 @@

  # fix rpmlint warnings

  EXTRA_CFLAGS="$EXTRA_CFLAGS -fno-strict-aliasing"

  %endif

+ %ifarch %{ix86}

+ # Align stack boundary on x86_32

+ EXTRA_CFLAGS="$EXTRA_CFLAGS -mincoming-stack-boundary=2 -mpreferred-stack-boundary=4"

+ %endif

  # Fixes annocheck warnings in assembler files due to missing build notes

  EXTRA_ASFLAGS="${EXTRA_CFLAGS} -Wa,--generate-missing-build-notes=yes"

  export EXTRA_CFLAGS EXTRA_ASFLAGS

  

  function buildjdk() {

      local outputdir=${1}

-     local installdir=${2}

-     local buildjdk=${3}

-     local maketargets="${4}"

-     local debuglevel=${5}

-     local link_opt=${6}

+     local buildjdk=${2}

+     local maketargets="${3}"

+     local debuglevel=${4}

+     local link_opt=${5}

  

      local top_dir_abs_src_path=$(pwd)/%{top_level_dir_name}

      local top_dir_abs_build_path=$(pwd)/${outputdir}
@@ -1793,16 +1810,14 @@

      echo "Using link_opt: ${link_opt}"

      echo "Building %{newjavaver}-%{buildver}, pre=%{ea_designator}, opt=%{lts_designator}"

  

-     mkdir -p ${outputdir} ${installdir}

+     mkdir -p ${outputdir}

      pushd ${outputdir}

  

      bash ${top_dir_abs_src_path}/configure \

- %ifnarch %{jit_arches}

+ %ifarch %{zero_arches}

      --with-jvm-variants=zero \

  %endif

- %ifarch %{ppc64le}

      --with-jobs=1 \

- %endif

      --with-version-build=%{buildver} \

      --with-version-pre="%{ea_designator}" \

      --with-version-opt=%{lts_designator} \
@@ -1842,8 +1857,15 @@

        $maketargets || ( pwd; find ${top_dir_abs_src_path} ${top_dir_abs_build_path} -name "hs_err_pid*.log" | xargs cat && false )

  

      popd

+ }

+ 

+ function installjdk() {

+     local outputdir=${1}

+     local installdir=${2}

+     local imagepath=${installdir}/images/%{jdkimage}

  

      echo "Installing build from ${outputdir} to ${installdir}..."

+     mkdir -p ${installdir}

      echo "Installing images..."

      mv ${outputdir}/images ${installdir}

      if [ -d ${outputdir}/bundles ] ; then
@@ -1859,39 +1881,47 @@

      echo "Removing output directory...";

      rm -rf ${outputdir}

  %endif

- }

  

- function installjdk() {

-     local imagepath=${1}

- 

-     # the build (erroneously) removes read permissions from some jars

-     # this is a regression in OpenJDK 7 (our compiler):

-     # http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437

-     find ${imagepath} -iname '*.jar' -exec chmod ugo+r {} \;

+     if [ -d ${imagepath} ] ; then

+ 	# the build (erroneously) removes read permissions from some jars

+ 	# this is a regression in OpenJDK 7 (our compiler):

+ 	# http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437

+ 	find ${imagepath} -iname '*.jar' -exec chmod ugo+r {} \;

  

-     # Build screws up permissions on binaries

-     # https://bugs.openjdk.java.net/browse/JDK-8173610

-     find ${imagepath} -iname '*.so' -exec chmod +x {} \;

-     find ${imagepath}/bin/ -exec chmod +x {} \;

+ 	# Build screws up permissions on binaries

+ 	# https://bugs.openjdk.java.net/browse/JDK-8173610

+ 	find ${imagepath} -iname '*.so' -exec chmod +x {} \;

+ 	find ${imagepath}/bin/ -exec chmod +x {} \;

  

-     # Install nss.cfg right away as we will be using the JRE above

-     install -m 644 nss.cfg ${imagepath}/conf/security/

+ 	# Install nss.cfg right away as we will be using the JRE above

+ 	install -m 644 nss.cfg ${imagepath}/conf/security/

  

-     # Install nss.fips.cfg: NSS configuration for global FIPS mode (crypto-policies)

-     install -m 644 nss.fips.cfg ${imagepath}/conf/security/

+ 	# Install nss.fips.cfg: NSS configuration for global FIPS mode (crypto-policies)

+ 	install -m 644 nss.fips.cfg ${imagepath}/conf/security/

  

-     # Use system-wide tzdata

-     rm ${imagepath}/lib/tzdb.dat

-     ln -s %{_datadir}/javazi-1.8/tzdb.dat ${imagepath}/lib/tzdb.dat

+ 	# Use system-wide tzdata

+ 	rm ${imagepath}/lib/tzdb.dat

+ 	ln -s %{_datadir}/javazi-1.8/tzdb.dat ${imagepath}/lib/tzdb.dat

  

-     # Create fake alt-java as a placeholder for future alt-java

-     pushd ${imagepath}

-     # add alt-java man page

-     echo "Hardened java binary recommended for launching untrusted code from the Web e.g. javaws" > man/man1/%{alt_java_name}.1

-     cat man/man1/java.1 >> man/man1/%{alt_java_name}.1

-     popd

+ 	# Create fake alt-java as a placeholder for future alt-java

+ 	pushd ${imagepath}

+ 	# add alt-java man page

+ 	echo "Hardened java binary recommended for launching untrusted code from the Web e.g. javaws" > man/man1/%{alt_java_name}.1

+ 	cat man/man1/java.1 >> man/man1/%{alt_java_name}.1

+ 	popd

+     fi

  }

  

+ %if %{build_hotspot_first}

+   # Build a fresh libjvm.so first and use it to bootstrap

+   cp -LR --preserve=mode,timestamps %{bootjdk} newboot

+   systemjdk=$(pwd)/newboot

+   buildjdk build/newboot ${systemjdk} %{hotspot_target} "release" "bundled"

+   mv build/newboot/jdk/lib/server/libjvm.so newboot/lib/server

+ %else

+   systemjdk=%{bootjdk}

+ %endif

+ 

  for suffix in %{build_loop} ; do

  

    if [ "x$suffix" = "x" ] ; then
@@ -1901,7 +1931,6 @@

        debugbuild=`echo $suffix  | sed "s/-//g"`

    fi

  

-   systemjdk=/usr/lib/jvm/java-%{buildjdkver}-openjdk

  

    for loop in %{main_suffix} %{staticlibs_loop} ; do

  
@@ -1928,11 +1957,14 @@

          run_bootstrap=%{bootstrap_build}

        fi

        if ${run_bootstrap} ; then

-          buildjdk ${bootbuilddir} ${bootinstalldir} ${systemjdk} "%{bootstrap_targets}" ${debugbuild} ${link_opt}

-          buildjdk ${builddir} ${installdir} $(pwd)/${bootinstalldir}/images/%{jdkimage} "${maketargets}" ${debugbuild} ${link_opt}

-          %{!?with_artifacts:rm -rf ${bootinstalldir}}

+           buildjdk ${bootbuilddir} ${systemjdk} "%{bootstrap_targets}" ${debugbuild} ${link_opt}

+           installjdk ${bootbuilddir} ${bootinstalldir}

+           buildjdk ${builddir} $(pwd)/${bootinstalldir}/images/%{jdkimage} "${maketargets}" ${debugbuild} ${link_opt}

+           installjdk ${builddir} ${installdir}

+           %{!?with_artifacts:rm -rf ${bootinstalldir}}

        else

-         buildjdk ${builddir} ${installdir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}

+           buildjdk ${builddir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}

+           installjdk ${builddir} ${installdir}

        fi

        # Restore original source tree we modified by removing full in-tree sources

        rm -rf %{top_level_dir_name}
@@ -1943,15 +1975,12 @@

        # Static library cycle only builds the static libraries

        maketargets="%{static_libs_target}"

        # Always just do the one build for the static libraries

-       buildjdk ${builddir} ${installdir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}

+       buildjdk ${builddir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}

+       installjdk ${builddir} ${installdir}

      fi

  

    done # end of main / staticlibs loop

  

-   # Final setup on the main image

-   top_dir_abs_main_build_path=$(pwd)/%{installoutputdir -- ${suffix}%{main_suffix}}

-   installjdk ${top_dir_abs_main_build_path}/images/%{jdkimage}

- 

  # build cycles

  done # end of release / debug cycle loop

  
@@ -2479,6 +2508,12 @@

  %endif

  

  %changelog

+ * Wed Feb 02 2022 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.14.0.9-3

+ - Add -mincoming-stack-boundary=2 -mpreferred-stack-boundary=4 on x86_32 for stack alignment

+ - Refactor build functions so we can build just HotSpot without any attempt at installation.

+ - on i686, build zero instead of hotspot

+ - removed x32 from sa_arches, build no longer have libsaproc.so

+ 

  * Mon Jan 24 2022 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.14.0.9-2

  - Separate crypto policy initialisation from FIPS initialisation, now they are no longer interdependent

  

Refactor build functions so we can build just HotSpot without any attempt at installation.

1 new commit added

  • removed x32 from sa_arches, build no longer have libsaproc.so
2 years ago

2 new commits added

  • removed x32 from sa_arches, build no longer have libsaproc.so
  • Add -mincoming-stack-boundary=2 -mpreferred-stack-boundary=4 on x86_32 for stack alignment
2 years ago

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Pull-Request has been closed by jvanek

2 years ago
Metadata