On Mon, 13 Apr 2026 10:43:50 GMT, Matthias Baesken <[email protected]> wrote:

> On some gcc - based Linux devkits like older Fedora with gcc 14, the build on 
> Linux x86_64 fails with --enable-linktime-gc set (ltgc enabled).
> 
> Error output :
> support_native_java.desktop_libfontmanager_BUILD_LIBFONTMANAGER_run_ld :
> 
> 
> /devkits/x86_64-linux-gnu-to-x86_64-linux-gnu-fedora27-gcc14.2.0/bin/../lib/gcc/x86_64-linux-gnu/14.2.0/../../../../x86_64-linux-gnu/lib/../lib64/libstdc++.a(eh_throw.o)(.note.stapsdt+0x14):
> error: relocation refers to local symbol ".text.__cxa_throw" [5], which is 
> defined in a discarded section
> 
> 
> Seems we can disable exceptions and rtti too on this lib when using the gcc 
> and clang toolchains. This makes the error disappear.
> And it also helps to get the lib a little smaller, even without ltgc  .
> 
> ---------
> - [X] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

make/modules/java.desktop/lib/ClientLibraries.gmk line 398:

> 396:         AccelGlyphCache.c, \
> 397:     CFLAGS := $(LIBFONTMANAGER_CFLAGS), \
> 398:     CXXFLAGS := $(LIBFONTMANAGER_CFLAGS) $(LIBFONTMANAGER_CXXFLAGS), \

I think we would prefer setting `CXXFLAGS_gcc := -fno-rtti -fno-exceptions` and 
`CXXFLAGS_clang := -fno-rtti -fno-exceptions` respectively as parameters here. 
It's repeating the options, which is unfortunate, but I think it's easier to 
read.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30701#discussion_r3080975682

Reply via email to