Skip to content

Commit

Permalink
8262501: jdk17 libjvm link failure with --as-needed and clock_gettime…
Browse files Browse the repository at this point in the history
… in librt

Co-authored-by: Matthias Klose <doko@openjdk.org>
Reviewed-by: erikj
  • Loading branch information
David Holmes and Matthias Klose committed Apr 15, 2021
1 parent b23dbdb commit 81877f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 0 additions & 7 deletions make/autoconf/flags-ldflags.m4
Expand Up @@ -108,13 +108,6 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
OS_LDFLAGS="-mmacosx-version-min=$MACOSX_VERSION_MIN"
fi
if test "x$OPENJDK_TARGET_OS" = xlinux; then
# Hotspot needs to link librt to get the clock_* functions.
# But once our supported minimum build and runtime platform
# has glibc 2.17, this can be removed as the functions are
# in libc.
OS_LDFLAGS_JVM_ONLY="-lrt"
fi
fi
# Setup debug level-dependent LDFLAGS
Expand Down
11 changes: 10 additions & 1 deletion make/autoconf/libraries.m4
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -124,6 +124,15 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread"
fi
# librt for legacy clock_gettime
if test "x$OPENJDK_TARGET_OS" = xlinux; then
# Hotspot needs to link librt to get the clock_* functions.
# But once our supported minimum build and runtime platform
# has glibc 2.17, this can be removed as the functions are
# in libc.
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lrt"
fi
# Atomic library
# 32-bit platforms needs fallback library for 8-byte atomic ops on Zero
if HOTSPOT_CHECK_JVM_VARIANT(zero); then
Expand Down

1 comment on commit 81877f7

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.