Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LTO compiling openjdk:8
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
brankob
Apprentice
Apprentice


Joined: 29 Apr 2004
Posts: 188

PostPosted: Sun Jul 12, 2020 11:34 am    Post subject: LTO compiling openjdk:8 Reply with quote

I am using LTO compiled system for quite some time,

but have recently decided to rehash my package list and see if I can persuade some exceptions to comile with LTO.

openjdk:8 seems to come pretty close, but fails at bootstrap.

That is, it compiles first iteration, but it fails to run it to compile the second one with it.
It fails with unresolved cryptic symbol, no matter what I do.

I've tried different linkers and -flto=none etc, with the same result.

I'm not confident enough to go thrugh piles of java code etc, nor there is much log information to give me a clue.

So i wonder if anyone else might have solved that knot and would care to share...
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23411

PostPosted: Sun Jul 12, 2020 4:05 pm    Post subject: Reply with quote

Potential helpers might more readily know whether their advice is relevant if you share the specific failure message. What symbol is unresolved? Exactly what version of openjdk are you trying to build? You gave a slot specifier, which is only definitive for someone who has the same tree you used and same keywords. Currently, there is only one version in slot 8 and it is marked stable, but that could change. How exactly did you enable LTO for this package? What are your CFLAGS/LDFLAGS for it?
Back to top
View user's profile Send private message
brankob
Apprentice
Apprentice


Joined: 29 Apr 2004
Posts: 188

PostPosted: Sun Jul 12, 2020 11:23 pm    Post subject: Reply with quote

Hu wrote:
Potential helpers might more readily know whether their advice is relevant if you share the specific failure message. What symbol is unresolved? Exactly what version of openjdk are you trying to build? You gave a slot specifier, which is only definitive for someone who has the same tree you used and same keywords. Currently, there is only one version in slot 8 and it is marked stable, but that could change. How exactly did you enable LTO for this package? What are your CFLAGS/LDFLAGS for it?


openjdk version:
Code:
dev-java/openjdk-8.252_p09


gcc-10.1.0-r2 (works the same with 9.3.0-r1)


Code:
# COMMON_FLAGS="-march=native -pipe -O2"
COMMON_FLAGS="-march=native -pipe -O2 -flto -Wl,-z -Wl,noexecstack"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
LD="/usr/bin/ld.lld"
LDFLAGS="-Wl,-O2 -Wl,--sort-common -Wl,--no-as-needed  -O2  -flto -march=native -pipe -Wl,-z -Wl,noexecstack"
# LDFLAGS="-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z
# -Wl,noexecstack"


tail of build.log :

Code:
Stripping images/j2sdk-image/bin/rmiregistry
/bin/chmod u+w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/rmiregistry
/bin/echo Stripping  images/j2sdk-image/bin/java
Stripping images/j2sdk-image/bin/jcmd
/bin/chmod u+w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/jcmd
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/tnameserv
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/servertool
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/rmid
Stripping images/j2sdk-image/bin/java
/usr/bin/x86_64-pc-linux-gnu-strip -g /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/rmiregistry
/bin/chmod u+w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java
/usr/bin/x86_64-pc-linux-gnu-strip -g /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/jcmd
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/pack200
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/orbd.stripped
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/usr/bin/x86_64-pc-linux-gnu-strip -g /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java
/bin/echo Stripping  images/j2sdk-image/bin/unpack200
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/tnameserv.stripped
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/servertool.stripped
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/rmid.stripped
Stripping images/j2sdk-image/bin/unpack200
/bin/echo  Copying images/j2sdk-image/src.zip
/bin/chmod u+w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/unpack200
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/rmiregistry
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/jcmd
Copying images/j2sdk-image/src.zip
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/pack200.stripped
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image
/bin/echo  Generating images/j2re-image/lib/meta-index
/usr/bin/x86_64-pc-linux-gnu-strip -g /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/unpack200
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
Generating images/j2re-image/lib/meta-index
/bin/cp -fP '/var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/src.zip' '/var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/src.zip'
cd /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2re-image/lib && /opt/openjdk-bin-8.252_p09/bin/java -XX:+UseSerialGC -Xms32M -Xmx512M  -cp /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_>
/bin/echo  Generating images/j2re-image/lib/ext/meta-index
Generating images/j2re-image/lib/ext/meta-index
/bin/chmod go-w /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/unpack200
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/rmiregistry.stripped
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/jcmd.stripped
cd /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2re-image/lib/ext && /opt/openjdk-bin-8.252_p09/bin/java -XX:+UseSerialGC -Xms32M -Xmx512M  -cp /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux->
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/java.stripped
/usr/bin/touch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/_strip_jdk/bin/unpack200.stripped
gmake[2]: Leaving directory '/var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk-jdk8u252-ga/make'
gmake[1]: Leaving directory '/var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk-jdk8u252-ga/make'
## Finished images (build time 00:00:19)

Boot cycle build step 2: Building a new JDK image using previously built image
gmake[1]: Entering directory '/var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga'
Running make as '/usr/bin/gmake  VERBOSE= LOG_LEVEL=debug -R -I /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/make/common -rRw -I/var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/make/common -j1 SPEC=/var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-j>
Building OpenJDK for target 'images' in configuration 'linux-x86_64-normal-server-release'

## Starting langtools
gmake[2]: Entering directory '/var/tmp/portage/dev-java/openjdk-8.252_p09/work/langtools-jdk8u252-ga/make'
SetupJavaCompiler(BOOT_JAVAC)
 [2] JAVAC := /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/javac
 [3] SERVER_DIR :=
 [4] SERVER_JVM := /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/java -verbosegc -d64 -Xms10G -Xmx10G
 [5] FLAGS := -XDignore.symbol.file=true -g -Xlint:all,-deprecation -Werror
SetupJavaCompilation(BUILD_TOOLS)
 [2] SETUP := BOOT_JAVAC
 [3] DISABLE_SJAVAC := true
 [4] ADD_JAVAC_FLAGS := -Xprefer:source
 [5] SRC := /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/langtools/make/tools /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/langtools/src/share/classes
 [6] INCLUDES := compileproperties genstubs
 [7] BIN := /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/bootcycle-build/langtools/btclasses
/bin/mkdir -p /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/bootcycle-build/langtools/btclasses
/bin/rm -f /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/bootcycle-build/langtools/btclasses/_the.BUILD_TOOLS_batch /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/bootcycl>
/bin/echo  Writing 2 paths to ' >> /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/bootcycle-build/langtools/btclasses/_the.BUILD_TOOLS_batch.tmp'
Writing 2 paths to  >> /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/bootcycle-build/langtools/btclasses/_the.BUILD_TOOLS_batch.tmp
/bin/echo Compiling `/usr/bin/wc /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/bootcycle-build/langtools/btclasses/_the.BUILD_TOOLS_batch.tmp | /usr/bin/tr -s ' ' | /usr/bin/cut -f 2 -d ' '` files for BUILD_TOOLS
Compiling 2 files for BUILD_TOOLS
( /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/bin/javac -XDignore.symbol.file=true -g -Xlint:all,-deprecation -Werror  -Xprefer:source -implicit:none -sourcepath "/var/tmp/portage/dev-java/openjdk-8.252_p09/work>
Error: dl failure on line 893gmake[2]: Leaving directory '/var/tmp/portage/dev-java/openjdk-8.252_p09/work/langtools-jdk8u252-ga/make'

Error: failed /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/images/j2sdk-image/jre/lib/amd64/server/libjvm.so, because /var/tmp/portage/dev-java/openjdk-8.252_p09/work/jdk8u-jdk8u252-ga/build/linux-x86_64-normal-server-release/image>
gmake[2]: *** No rule to make target 'all', needed by 'default'.  Stop.


[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Mon Jul 13, 2020 12:47 am    Post subject: Reply with quote

Building any other language's bootstrapped compiler with gcc's lto is probably a waste of time. You might save a few microseconds in javac at best.
Back to top
View user's profile Send private message
brankob
Apprentice
Apprentice


Joined: 29 Apr 2004
Posts: 188

PostPosted: Mon Jul 13, 2020 7:12 am    Post subject: Reply with quote

Ant P. wrote:
Building any other language's bootstrapped compiler with gcc's lto is probably a waste of time. You might save a few microseconds in javac at best.


Also, one might randomize few of numerous security exploits that keep popping up with those things.
Still, it would be nice to know why it isn't working. What is it that screws the link ?
IS it something within make framework or some issue with compiler/linker ?

For example, many packages hit "multiple definitions" snag with LTO.

Lazy way is usually just adding -Wl,-z -Wl,muldefs to LDLAGS, but that makes me nervous.
It feels like plastering over open wounds that LTO had uncovered.

TSCH is one of those. So I fixed obviously shitty source.
There are many others.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum