Summary: | dev-java/openjdk-11.0.12_p7: failed to compile with clang-13 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | 12101111 <w12101111> |
Component: | Current packages | Assignee: | Java team <java> |
Status: | RESOLVED OBSOLETE | ||
Severity: | normal | CC: | java, tanekliang, telans |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
build.log.xz
hs_err_pid3061021.log Respect user-supplied optlevel for Clang |
Description
12101111
2021-10-13 14:47:09 UTC
Created attachment 744768 [details]
build.log.xz
Created attachment 744771 [details]
hs_err_pid3061021.log
reports or check upstream for possible patches, I'll add those as needed if they don't break everything else. Created attachment 745089 [details, diff]
Respect user-supplied optlevel for Clang
One thing that can be an obstacle to tackling this is that OpenJDK's build system does not respect user-supplied optlevel. Regardless of what is specified in C(XX)?FLAGS, most objects are compiled with the -O3 optimization level.
A patch is attached against this situation for Clang. Note that this patch assumes that the user-supplied optlevel is -O2 or lower. Otherwise C_O_FLAG_NORM="-O2" has to be specified.
JDK Bug System has an apparently related issue: https://bugs.openjdk.java.net/browse/JDK-8229258, the author of which points out undefined behaviors with regard to markOop{,Desc}. I suspect that the UBs are actually hit by Clang/LLVM 13. The fix is reported to have been merged in JDK 14, and in fact dev-java/openjdk-17_p35 in Gentoo repo seems to be free from this issue. xtkoba@gmail.com thanks for looking and chiming in openjdk bugs lately, competent help is really appreciated. I don't have much time lately, but I'll try building it with clang with/without patch and maybe improve overall *flag situation too. openjdk sets flags for a reason, usually, it's quite sensitive code, so I'm a bit hesitant to force user's preferences blindly. (In reply to Tee KOBAYASHI from comment #5) > JDK Bug System has an apparently related issue: > https://bugs.openjdk.java.net/browse/JDK-8229258, the author of which points > out undefined behaviors with regard to markOop{,Desc}. I suspect that the > UBs are actually hit by Clang/LLVM 13. > > The fix is reported to have been merged in JDK 14, and in fact > dev-java/openjdk-17_p35 in Gentoo repo seems to be free from this issue. It is indeed from Clang 13, see: https://reviews.llvm.org/D99790#2678384 I created a patch for JDK 11 that fixes this issue. I just created this account, so I can't link the patch here, but it's !23 on the jdk11u GitHub repository. thanks! adding patch link here https://github.com/openjdk/jdk11u/pull/23 it's quite a large patch, let's see what maintainers say. if they approve it I'll add it to gentoo quickly. meanwhile users could use /etc/portage/patches I guess. FreeBSD have a simple fix for this issue: https://github.com/battleblow/jdk11u/commit/305a68a90c722aa7a7b75589e24d5b5d554c96c1 |