Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some symbols not found in riscv64 #136

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

eirv
Copy link

@eirv eirv commented Feb 17, 2025

The symbols art_quick_generic_jni_trampoline and art_quick_to_interpreter_bridge no longer exist in baklava riscv64, so I found another way to lookup the addresses of these two symbols.
405334995-883710c9-bbca-4feb-a532-01d181ee4bbf

@aviraxp aviraxp requested a review from yujincheng08 February 17, 2025 09:06
@yujincheng08
Copy link
Member

Can you send the libart.so?

@eirv
Copy link
Author

eirv commented Feb 17, 2025

Can you send the libart.so?

Okay, it's here.
This libart.so is from ci.android.com.

@yujincheng08
Copy link
Member

readelf -sW out | grep -i -e artQuickToInterpreterBridge -e artQuickGenericJniTrampoline
  8640: 00000000008ead6a  1202 FUNC    GLOBAL DEFAULT    1 artQuickToInterpreterBridge
  8654: 00000000008f1064  1584 FUNC    GLOBAL DEFAULT    1 artQuickGenericJniTrampoline

I can still find these symbol in your libart.so.

@eirv
Copy link
Author

eirv commented Feb 17, 2025

Is it okay to use these two symbols?

$ readelf -sW gnu_debugdata.so | grep -i -e artQuickToInterpreterBridge -e artQuickGenericJniTrampoline
  8640: 00000000008ead6a  1202 FUNC    GLOBAL DEFAULT    1 artQuickToInterpreterBridge
  8654: 00000000008f1064  1584 FUNC    GLOBAL DEFAULT    1 artQuickGenericJniTrampoline

$ readelf -sW libart_symbols.so | grep -i -e art_quick_to_interpreter_bridge -e art_quick_generic_jni_trampoline
   395: 0000000000323a10   258 NOTYPE  LOCAL  HIDDEN    15 art_quick_generic_jni_trampoline
   396: 0000000000323b20   248 NOTYPE  LOCAL  HIDDEN    15 art_quick_to_interpreter_bridge
ENTRY art_quick_to_interpreter_bridge
    SETUP_SAVE_REFS_AND_ARGS_FRAME

    // uint64_t artQuickToInterpreterBridge(ArtMethod* method, Thread* self, ArtMethod** sp)
    // a0 will contain ArtMethod*
    mv   a1, xSELF
    mv   a2, sp
    call artQuickToInterpreterBridge

    // TODO: no need to restore arguments in this case.
    RESTORE_SAVE_REFS_AND_ARGS_FRAME

    fmv.d.x  fa0, a0  // copy the result to FP result register

    RETURN_OR_DELIVER_PENDING_EXCEPTION_REG t0
END art_quick_to_interpreter_bridge

@yujincheng08
Copy link
Member

@eirv
Copy link
Author

eirv commented Feb 17, 2025

Aren't we using these two symbols?

https://github.com/LSPosed/LSPlant/pull/136/files#diff-7f18ce8019f5218416418f67ab7e954dc3842fa48af78501ad252dd637b75a2dL33-R46

artQuickTo_InterpreterBridge and art_quick_to_interpreter_bridge don't seem to be the same symbol, right?
Excuse me, I'm just asking a simple question, no offence.

extern "C" void art_quick_to_interpreter_bridge(ArtMethod*);
static inline const void* GetQuickToInterpreterBridge() {
  return reinterpret_cast<const void*>(art_quick_to_interpreter_bridge);
}

bool ClassLinker::IsQuickToInterpreterBridge(const void* entry_point) const {
  return (entry_point == GetQuickToInterpreterBridge()) ||
      (quick_to_interpreter_bridge_trampoline_/*nullptr*/ == entry_point);
}

@yujincheng08
Copy link
Member

Oh, I know what you mean. of course, you cannot cast it. If you think it difficult to use artQuickToInterpreterBridge to obtain art_quick_to_interpreter_bridge, maybe we instead use _ZN3art15instrumentationL19GetOptimizedCodeForEPNS_9ArtMethodE and pass a dummy artmethod into it.

@eirv
Copy link
Author

eirv commented Feb 17, 2025

Oh, I know what you mean. of course, you cannot cast it. If you think it difficult to use artQuickToInterpreterBridge to obtain art_quick_to_interpreter_bridge, maybe we instead use _ZN3art15instrumentationL19GetOptimizedCodeForEPNS_9ArtMethodE and pass a dummy artmethod into it.

Sounds like a good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants