Skip to content

Commit

Permalink
8311846: Resolve duplicate 'Thread' related symbols with JDK static l…
Browse files Browse the repository at this point in the history
…inking
  • Loading branch information
jianglizhou committed Jan 16, 2024
1 parent b363472 commit 4934a47
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/hotspot/os_cpu/linux_aarch64/threadLS_linux_aarch64.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
_ZN10JavaThread25aarch64_get_thread_helperEv:
hint #0x19 // paciasp
stp x29, x30, [sp, -16]!
adrp x0, :tlsdesc:_ZN6Thread12_thr_currentE
ldr x1, [x0, #:tlsdesc_lo12:_ZN6Thread12_thr_currentE]
add x0, x0, :tlsdesc_lo12:_ZN6Thread12_thr_currentE
.tlsdesccall _ZN6Thread12_thr_currentE
adrp x0, :tlsdesc:_ZN17HotspotBaseThread12_thr_currentE
ldr x1, [x0, #:tlsdesc_lo12:_ZN17HotspotBaseThread12_thr_currentE]
add x0, x0, :tlsdesc_lo12:_ZN17HotspotBaseThread12_thr_currentE
.tlsdesccall _ZN17HotspotBaseThread12_thr_currentE
blr x1
mrs x1, tpidr_el0
add x0, x1, x0
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/runtime/threadLocalStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define SHARE_RUNTIME_THREADLOCALSTORAGE_HPP

#include "memory/allStatic.hpp"
#include "utilities/globalDefinitions.hpp"

// forward-decl as we can't have an include cycle
class Thread;
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/share/utilities/globalDefinitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,10 @@ enum LockingMode {
LM_LIGHTWEIGHT = 2
};

// Redefine Thread as BaseThread to avoid duplicate symbol issues for
// JDK static builds. See runtime/thread.hpp for Thread class.
#define Thread HotspotBaseThread

//----------------------------------------------------------------------------------------------------
// Special constants for debugging

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void update(Observable o, Object data) {
}

private static synchronized void initialize(TypeDataBase db) {
Type typeThread = db.lookupType("Thread");
Type typeThread = db.lookupType("HotspotBaseThread");
Type typeJavaThread = db.lookupType("JavaThread");

suspendFlagsField = typeJavaThread.getCIntegerField("_suspend_flags");
Expand Down

0 comments on commit 4934a47

Please sign in to comment.