On 2021-01-26 17:08, Matthias Klose wrote:
Several Linux distros now build with link time optimizations (-flto=auto) by
default.  It looks like 15 and newer versions can be built with -flto. I haven't
yet checked test results for LTO/non-LTO builds. I also only tried building with
GCC 10.

11 still fails with
/usr/bin/ld: /tmp/libjvm.so.xGmnnW.ltrans45.ltrans.o: in function
`G1CMOopClosure::do_oop(oopDesc**)':
/<<BUILDDIR>>/openjdk-lts-11.0.9.1+1/make/hotspot/./src/hotspot/share/gc/g1/g1OopClosures.hpp:176:
undefined reference to `void G1CMOopClosure::do_oop_work<oopDesc*>(oopDesc**)'
[...]

However this might be just the first build failure.

Is this when building with --enable-jvm-feature-link-time-opt on linux-x64?

When I try that (with gcc-10 on Ubuntu) on the mainline, I get:

In function 'strncpy',
    inlined from 'description' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp:86:10,     inlined from 'description' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp:107:34,     inlined from '__write_sample_info__' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:212:16,     inlined from 'operator()' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/writers/jfrTypeWriterHost.hpp:87:14,     inlined from 'operator()' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/writers/jfrTypeWriterHost.hpp:69:18,     inlined from 'iterate' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:118:16,     inlined from 'write_sample_infos' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:223:26: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |                                  ^
/localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp: In function 'write_sample_infos': /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp:83:28: note: length computed here
   83 |   const size_t len = strlen(_buffer);
      |                            ^
In function 'strncpy',
    inlined from 'description' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp:86:10,     inlined from 'description' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:340:33,     inlined from '__write_root_description_info__' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:348:16,     inlined from 'operator()' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/writers/jfrTypeWriterHost.hpp:87:14,     inlined from 'operator()' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/writers/jfrTypeWriterHost.hpp:69:18,     inlined from 'iterate' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:118:16,     inlined from 'write_root_descriptors' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:514:24,     inlined from '__dt_base ' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp:627:25,     inlined from '_ZN22ObjectSampleCheckpoint5writeEPK13ObjectSamplerP9EdgeStorebP6Thread.part.0' at /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp:381:46: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |                                  ^
/localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp: In function '_ZN22ObjectSampleCheckpoint5writeEPK13ObjectSamplerP9EdgeStorebP6Thread.part.0': /localhome/git/jdk-BAR/open/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleDescription.cpp:83:28: note: length computed here
   83 |   const size_t len = strlen(_buffer);
      |                            ^

I don't think anyone used LTO seriously since the old Oracle arm-32 port. The major blocker is the added linking time spent for hotspot, I think. Patches to fix this is more than welcome, though!

/Magnus


Matthias

Reply via email to