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

Indirect flags failing #1

Open
ghost opened this issue Oct 19, 2022 · 26 comments
Open

Indirect flags failing #1

ghost opened this issue Oct 19, 2022 · 26 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Oct 19, 2022

There seems to be error when using indircall or indirbr flags

Samples
KittyMemory.zip

C:\Users\Administrator\Desktop\AMain-Android-Hooking-Project>E:\AndroidSDK\ndk\25.1.8937393\ndk-build
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-19.
[armeabi-v7a] Compile++ arm  : ab <= KittyUtils.cpp
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [E:/AndroidSDK/ndk/25.1.8937393/build/../build/core/build-binary.mk:424: obj/local/armeabi-v7a/objs/ab/KittyMemory/KittyUtils.o] Error 1
make: *** Waiting for unfinished jobs....
[armeabi-v7a] Compile++ arm  : ab <= MemoryPatch.cpp
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [E:/AndroidSDK/ndk/25.1.8937393/build/../build/core/build-binary.mk:424: obj/local/armeabi-v7a/objs/ab/KittyMemory/MemoryPatch.o] Error 1
[armeabi-v7a] Compile++ arm  : ab <= KittyMemory.cpp
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
@KpwnZ
Copy link
Owner

KpwnZ commented Oct 20, 2022

It seems that it conflicts with PIE. The target is arm right? I will look into it later, thanks for your report!

@KpwnZ
Copy link
Owner

KpwnZ commented Oct 20, 2022

btw does it work for arm64-v8a?

@ghost
Copy link
Author

ghost commented Oct 20, 2022

Yes this is arm, and no doesn't work on arm64. My main target is both arm and arm64

@ghost
Copy link
Author

ghost commented Oct 20, 2022

On Arm64, I got different errors related to ld

logs.txt

@KpwnZ
Copy link
Owner

KpwnZ commented Oct 20, 2022

On Arm64, I got different errors related to ld

logs.txt

For ld: error: undefined symbol: curl_* maybe adding something like -lcurl could solve it?
And this may solve the llvm* related error.

@ghost
Copy link
Author

ghost commented Oct 20, 2022

Works now on arm64, and fixed curl. I messed it up by accident

@ghost
Copy link
Author

ghost commented Oct 20, 2022

doesn't work with indirbr flag in arm64. ld: error: relocation refers to a discarded section:
logs.txt

@KpwnZ
Copy link
Owner

KpwnZ commented Oct 31, 2022

@KpwnZ KpwnZ added the bug Something isn't working label Oct 31, 2022
@ghost
Copy link
Author

ghost commented Nov 1, 2022

With -indircall flag only and -indirbr only, still getting same errors, I tried x86 platform (For Android emulation support) and I got same error but without bad relocation fixup type

[x86] Compile++      : MyLibName <= Main.cpp
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression
error: expected relocatable expression

It works fine on arm64 and x86_64

With -indirbr only, I got ld error on both arm64 and x86_64

ld: error: relocation refers to a discarded section: .text._ZNSt6__ndk115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE7seekoffExNS_8ios_base7seekdirEj
>>> defined in ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o
>>> section group signature: _ZNSt6__ndk115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE7seekoffExNS_8ios_base7seekdirEj
>>> prevailing definition is in ./obj/local/x86_64/objs/MyLibName/Main.o
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x298)
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x2A0)
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x2A8)
>>> referenced 16 more times

ld: error: relocation refers to a discarded section: .text._ZNSt6__ndk115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE9underflowEv
>>> defined in ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o
>>> section group signature: _ZNSt6__ndk115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE9underflowEv
>>> prevailing definition is in ./obj/local/x86_64/objs/MyLibName/Main.o
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x330)
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x338)
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x340)
>>> referenced 4 more times

ld: error: relocation refers to a discarded section: .text._ZNSt6__ndk115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE9pbackfailEi
>>> defined in ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o
>>> section group signature: _ZNSt6__ndk115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE9pbackfailEi
>>> prevailing definition is in ./obj/local/x86_64/objs/MyLibName/Main.o
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x368)
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x370)
>>> referenced by KittyUtils.cpp
>>>               ./obj/local/x86_64/objs/MyLibName/KittyMemory/KittyUtils.o:(.data..L__unnamed_2+0x378)
>>> referenced 5 more times

Tested on public project https://github.com/LGLTeam/Android-Mod-Menu but I added a bat file to compile libs without Android studio
main.zip

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 2, 2022

It's weird, I can compile for 32bit arch with -indircall now. And I am still working on -indirbr support.

[arm64-v8a] Compile++      : KittyMemory <= KittyMemory.cpp
[arm64-v8a] Compile++      : KittyMemory <= MemoryPatch.cpp
[arm64-v8a] Compile++      : KittyMemory <= MemoryBackup.cpp
[arm64-v8a] Compile++      : KittyMemory <= KittyUtils.cpp
[arm64-v8a] Compile++      : KittyMemory <= KittyScanner.cpp
[arm64-v8a] Compile++      : KittyMemory <= KittyArm64.cpp
[arm64-v8a] Compile++      : KittyMemory <= example.cpp
[arm64-v8a] SharedLibrary  : libKittyMemory.so
[arm64-v8a] Install        : libKittyMemory.so => libs/arm64-v8a/libKittyMemory.so
[armeabi-v7a] Compile++ thumb: KittyMemory <= KittyMemory.cpp
[armeabi-v7a] Compile++ thumb: KittyMemory <= MemoryPatch.cpp
[armeabi-v7a] Compile++ thumb: KittyMemory <= MemoryBackup.cpp
[armeabi-v7a] Compile++ thumb: KittyMemory <= KittyUtils.cpp
[armeabi-v7a] Compile++ thumb: KittyMemory <= KittyScanner.cpp
[armeabi-v7a] Compile++ thumb: KittyMemory <= KittyArm64.cpp
[armeabi-v7a] Compile++ thumb: KittyMemory <= example.cpp
[armeabi-v7a] SharedLibrary  : libKittyMemory.so
[armeabi-v7a] Install        : libKittyMemory.so => libs/armeabi-v7a/libKittyMemory.so
[x86] Compile++      : KittyMemory <= KittyMemory.cpp
[x86] Compile++      : KittyMemory <= MemoryPatch.cpp
[x86] Compile++      : KittyMemory <= MemoryBackup.cpp
[x86] Compile++      : KittyMemory <= KittyUtils.cpp
[x86] Compile++      : KittyMemory <= KittyScanner.cpp
[x86] Compile++      : KittyMemory <= KittyArm64.cpp
[x86] Compile++      : KittyMemory <= example.cpp
[x86] SharedLibrary  : libKittyMemory.so
[x86] Install        : libKittyMemory.so => libs/x86/libKittyMemory.so

@ghost
Copy link
Author

ghost commented Nov 2, 2022

Are you using NDK 25 right? I got an error on different cpp files on Android-Mod-Menu project

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 3, 2022

I am using NDK r24 for now. -indirbr seems working as expected now. (Edit: not working for x86) I will push the update later. Flatten and BCF pass should be updated to support 32bit arch too.

LOCAL_CPPFLAGS += -mllvm -indircall -mllvm -indirbr -mllvm -bcf -mllvm -flatten -mllvm -instrobf
[armeabi-v7a] Compile++ arm  : MyLibName <= Main.cpp
run instruction substitution
[armeabi-v7a] Compile arm    : MyLibName <= hde64.c
[armeabi-v7a] Compile++ arm  : MyLibName <= SubstrateDebug.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= SubstrateHook.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= SubstratePosixMemory.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= SymbolFinder.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= KittyMemory.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= MemoryPatch.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= MemoryBackup.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= KittyUtils.cpp
run instruction substitution
[armeabi-v7a] Compile++ arm  : MyLibName <= And64InlineHook.cpp
run instruction substitution
[armeabi-v7a] SharedLibrary  : libMyLibName.so
[armeabi-v7a] Install        : libMyLibName.so => libs/armeabi-v7a/libMyLibName.so
[arm64-v8a] Compile++      : MyLibName <= Main.cpp
run instruction substitution
[arm64-v8a] Compile        : MyLibName <= hde64.c
[arm64-v8a] Compile++      : MyLibName <= SubstrateDebug.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= SubstrateHook.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= SubstratePosixMemory.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= SymbolFinder.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= KittyMemory.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= MemoryPatch.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= MemoryBackup.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= KittyUtils.cpp
run instruction substitution
[arm64-v8a] Compile++      : MyLibName <= And64InlineHook.cpp
run instruction substitution
[arm64-v8a] SharedLibrary  : libMyLibName.so
[arm64-v8a] Install        : libMyLibName.so => libs/arm64-v8a/libMyLibName.so
[x86] Compile++      : MyLibName <= Main.cpp
run instruction substitution
[x86] Compile        : MyLibName <= hde64.c
[x86] Compile++      : MyLibName <= SubstrateDebug.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= SubstrateHook.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= SubstratePosixMemory.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= SymbolFinder.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= KittyMemory.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= MemoryPatch.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= MemoryBackup.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= KittyUtils.cpp
run instruction substitution
[x86] Compile++      : MyLibName <= And64InlineHook.cpp
run instruction substitution
[x86] SharedLibrary  : libMyLibName.so
[x86] Install        : libMyLibName.so => libs/x86/libMyLibName.so
[x86_64] Compile++      : MyLibName <= Main.cpp
run instruction substitution
[x86_64] Compile        : MyLibName <= hde64.c
[x86_64] Compile++      : MyLibName <= SubstrateDebug.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= SubstrateHook.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= SubstratePosixMemory.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= SymbolFinder.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= KittyMemory.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= MemoryPatch.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= MemoryBackup.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= KittyUtils.cpp
run instruction substitution
[x86_64] Compile++      : MyLibName <= And64InlineHook.cpp
run instruction substitution
[x86_64] SharedLibrary  : libMyLibName.so
[x86_64] Install        : libMyLibName.so => libs/x86_64/libMyLibName.so

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 3, 2022

c5f30f7 should properly fix the linking error.

@ghost
Copy link
Author

ghost commented Nov 3, 2022

I am using NDK r24 for now. -indirbr seems working as expected now. (Edit: not working for x86) I will push the update later. Flatten and BCF pass should be updated to support 32bit arch too.

I tried NDK r24 but still getting same error on 32-bit. Mind telling me your way to setup ollvm on NDK?

I followed this chinese tutorial to setup ollvm https://blog.csdn.net/qq_41923691/article/details/123258565

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 4, 2022

I am using NDK r24 for now. -indirbr seems working as expected now. (Edit: not working for x86) I will push the update later. Flatten and BCF pass should be updated to support 32bit arch too.

I tried NDK r24 but still getting same error on 32-bit. Mind telling me your way to setup ollvm on NDK?

I followed this chinese tutorial to setup ollvm https://blog.csdn.net/qq_41923691/article/details/123258565

Almost the same as this tutorial but I am using Linux. a2aebce changed the linkage type for index value too and adjusted the offset. Could you please try this one?

[armeabi-v7a] Compile++ arm  : MyLibName <= Main.cpp
[armeabi-v7a] Compile arm    : MyLibName <= hde64.c
[armeabi-v7a] Compile++ arm  : MyLibName <= SubstrateDebug.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= SubstrateHook.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= SubstratePosixMemory.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= SymbolFinder.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= KittyMemory.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= MemoryPatch.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= MemoryBackup.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= KittyUtils.cpp
[armeabi-v7a] Compile++ arm  : MyLibName <= And64InlineHook.cpp
[armeabi-v7a] SharedLibrary  : libMyLibName.so
[armeabi-v7a] Install        : libMyLibName.so => libs/armeabi-v7a/libMyLibName.so
[arm64-v8a] Compile++      : MyLibName <= Main.cpp
[arm64-v8a] Compile        : MyLibName <= hde64.c
[arm64-v8a] Compile++      : MyLibName <= SubstrateDebug.cpp
[arm64-v8a] Compile++      : MyLibName <= SubstrateHook.cpp
[arm64-v8a] Compile++      : MyLibName <= SubstratePosixMemory.cpp
[arm64-v8a] Compile++      : MyLibName <= SymbolFinder.cpp
[arm64-v8a] Compile++      : MyLibName <= KittyMemory.cpp
[arm64-v8a] Compile++      : MyLibName <= MemoryPatch.cpp
[arm64-v8a] Compile++      : MyLibName <= MemoryBackup.cpp
[arm64-v8a] Compile++      : MyLibName <= KittyUtils.cpp
[arm64-v8a] Compile++      : MyLibName <= And64InlineHook.cpp
[arm64-v8a] SharedLibrary  : libMyLibName.so
[arm64-v8a] Install        : libMyLibName.so => libs/arm64-v8a/libMyLibName.so
[x86] Compile++      : MyLibName <= Main.cpp
[x86] Compile        : MyLibName <= hde64.c
[x86] Compile++      : MyLibName <= SubstrateDebug.cpp
[x86] Compile++      : MyLibName <= SubstrateHook.cpp
[x86] Compile++      : MyLibName <= SubstratePosixMemory.cpp
[x86] Compile++      : MyLibName <= SymbolFinder.cpp
[x86] Compile++      : MyLibName <= KittyMemory.cpp
[x86] Compile++      : MyLibName <= MemoryPatch.cpp
[x86] Compile++      : MyLibName <= MemoryBackup.cpp
[x86] Compile++      : MyLibName <= KittyUtils.cpp
[x86] Compile++      : MyLibName <= And64InlineHook.cpp
[x86] SharedLibrary  : libMyLibName.so
[x86] Install        : libMyLibName.so => libs/x86/libMyLibName.so
[x86_64] Compile++      : MyLibName <= Main.cpp
[x86_64] Compile        : MyLibName <= hde64.c
[x86_64] Compile++      : MyLibName <= SubstrateDebug.cpp
[x86_64] Compile++      : MyLibName <= SubstrateHook.cpp
[x86_64] Compile++      : MyLibName <= SubstratePosixMemory.cpp
[x86_64] Compile++      : MyLibName <= SymbolFinder.cpp
[x86_64] Compile++      : MyLibName <= KittyMemory.cpp
[x86_64] Compile++      : MyLibName <= MemoryPatch.cpp
[x86_64] Compile++      : MyLibName <= MemoryBackup.cpp
[x86_64] Compile++      : MyLibName <= KittyUtils.cpp
[x86_64] Compile++      : MyLibName <= And64InlineHook.cpp
[x86_64] SharedLibrary  : libMyLibName.so
[x86_64] Install        : libMyLibName.so => libs/x86_64/libMyLibName.so

@ghost
Copy link
Author

ghost commented Nov 4, 2022

It's now working on NDK 24 and 25 and the app ran perfectly as well.

One more thing, the flag -mllvm -strobf is not valid

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 5, 2022

It's now working on NDK 24 and 25 and the app ran perfectly as well.

One more thing, the flag -mllvm -strobf is not valid

It should be -mllvm -stringobf instead. Sorry for the confusion.

@ghost
Copy link
Author

ghost commented Nov 5, 2022

It's now working on NDK 24 and 25 and the app ran perfectly as well.
One more thing, the flag -mllvm -strobf is not valid

It should be -mllvm -stringobf instead. Sorry for the confusion.

Ok it works now.

Now I noticed something is wrong with sllvm, it's not obfuscate anything, despite all the flags are valid. The lib size are always same with and without sllvm flags. And I removed some OBFUSCATE and to check in IDA Pro, see if the strings is obfuscated by sllvm, it's not. What i'm doing wrong?

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 5, 2022

It's now working on NDK 24 and 25 and the app ran perfectly as well.
One more thing, the flag -mllvm -strobf is not valid

It should be -mllvm -stringobf instead. Sorry for the confusion.

Ok it works now.

Now I noticed something is wrong with sllvm, it's not obfuscate anything, despite all the flags are valid. The lib size are always same with and without sllvm flags. And I removed some OBFUSCATE and to check in IDA Pro, see if the strings is obfuscated by sllvm, it's not. What i'm doing wrong?

Do other flags also behave like this or only -stringobf?

@ghost
Copy link
Author

ghost commented Nov 5, 2022

All flags. lib sizes are always same with and without flags

image

Now that I remember 2 weeks ago, the compiler was showing debug outputs from sllvm, a sign that it was working. Not sure if you removed debug info recently

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 5, 2022

All flags. lib sizes are always same with and without flags

image

Now that I remember 2 weeks ago, the compiler was showing debug outputs from sllvm, a sign that it was working. Not sure if you removed debug info recently

Yes, with -mllvm -dbg-flatten, -mllvm -dbg-stringobf and -mllvm -dbg-bcf it can show the debug logs.
But the obfuscation passes work well on my device. The right one is compiled with sllvm with -bcf and -flatten. Do you have extra compiler flags enabled that may affect the obfuscation process(although I don't think there will be some flags that stop the obfuscator but just make sure)?
image

@ghost
Copy link
Author

ghost commented Nov 5, 2022

Very sorry, I realized I accidently disabled new pass manager during the rebuild. Recloned and rebuild again with new pass on. Still getting error on 32-bit. Maybe the fix does not apply on Windows?

[armeabi-v7a] Compile++ arm  : MyLibName <= Main.cpp
run instruction substitution
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 6, 2022

Very sorry, I realized I accidently disabled new pass manager during the rebuild. Recloned and rebuild again with new pass on. Still getting error on 32-bit. Maybe the fix does not apply on Windows?

[armeabi-v7a] Compile++ arm  : MyLibName <= Main.cpp
run instruction substitution
error: expected relocatable expression
error: bad relocation fixup type
error: expected relocatable expression
error: bad relocation fixup type

Did you pull the latest submodule?

@ghost
Copy link
Author

ghost commented Nov 6, 2022

Did you pull the latest submodule?

Yes, I did. Just only 32-bit issue left. x86_64 and arm64 compiled fine but -indirbr made the app crashes with exception

x86_64

2022-11-06 17:43:50.298 12838-12838 libc                    com.android.support                  A  Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7ffcfe3cdf80 in tid 12838 (android.support), pid 12838 (android.support)
2022-11-06 17:43:50.630   623-692   VerityUtils             system_process                       E  Failed to measure fs-verity, errno 1: /data/app/~~BFek_h_CKdj9K2-s4r_4VQ==/com.android.support--vO0OETOlHh6V2oOlab7PQ==/base.apk
2022-11-06 17:43:50.771 12884-12884 DEBUG                   pid-12884                            A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-11-06 17:43:50.773 12884-12884 DEBUG                   pid-12884                            A  Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:13/TPB4.220624.004/8808248:userdebug/dev-keys'
2022-11-06 17:43:50.774 12884-12884 DEBUG                   pid-12884                            A  Revision: '0'
2022-11-06 17:43:50.774 12884-12884 DEBUG                   pid-12884                            A  ABI: 'x86_64'
2022-11-06 17:43:50.780 12884-12884 DEBUG                   pid-12884                            A  Timestamp: 2022-11-06 16:43:50.434059800+0000
2022-11-06 17:43:50.781 12884-12884 DEBUG                   pid-12884                            A  Process uptime: 2s
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  Cmdline: com.android.support
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  pid: 12838, tid: 12838, name: android.support  >>> com.android.support <<<
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  uid: 10157
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x00007ffcfe3cdf80
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  Cause: stack pointer is not in a rw map; likely due to stack overflow.
2022-11-06 17:43:50.784 12884-12884 DEBUG                   pid-12884                            A      rax 249a4801cd3bcf00  rbx fffffffffff95351  rcx 00007063abd6e2b0  rdx 00007063abd6e2b0
2022-11-06 17:43:50.784 12884-12884 DEBUG                   pid-12884                            A      r8  00007ffcfebc7ea8  r9  0000000000000000  r10 000000de6d00f000  r11 0000000000000044
2022-11-06 17:43:50.789 12884-12884 DEBUG                   pid-12884                            A      r12 00007ffcfebc80a0  r13 00007ffcfebc818c  r14 00007064db1ca030  r15 00007063abdf0a50
2022-11-06 17:43:50.789 12884-12884 DEBUG                   pid-12884                            A      rdi 00007064db1ca030  rsi 00007064eb1cf450
2022-11-06 17:43:50.793 12884-12884 DEBUG                   pid-12884                            A      rbp 00007063abd703d0  rsp 00007ffcfe3cdf88  rip 00007063abd6e2b0
2022-11-06 17:43:50.799 12884-12884 DEBUG                   pid-12884                            A  backtrace:
2022-11-06 17:43:50.799 12884-12884 DEBUG                   pid-12884                            A        #00 pc 00000000000bf2b0  /data/app/~~BFek_h_CKdj9K2-s4r_4VQ==/com.android.support--vO0OETOlHh6V2oOlab7PQ==/lib/x86_64/libMyLibName.so (BuildId: 62ed3fecc1a644fe8fe326ed4c51c8d6e917ef42)
2022-11-06 17:43:50.835   267-267   tombstoned              pid-267                              E  Tombstone written to: tombstone_05

arm64

2022-11-06 18:03:51.273   623-692   VerityUtils             system_process                       E  Failed to measure fs-verity, errno 1: /data/app/~~nY6eNFuVcCkoXn6I3eaCRQ==/com.android.support--Vwtuyz6BB-YuMdD-ilzSg==/base.apk
2022-11-06 18:03:51.612 14654-14654 Mod_menu                com.android.support                  E  Error. Game's main activity does not exist
2022-11-06 18:03:51.688 14654-14715 libc                    com.android.support                  A  Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7063acf03ff8 in tid 14715 (android.support), pid 14654 (android.support)
2022-11-06 18:03:52.390 14719-14719 DEBUG                   pid-14719                            A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-11-06 18:03:52.390 14719-14719 DEBUG                   pid-14719                            A  Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:13/TPB4.220624.004/8808248:userdebug/dev-keys'
2022-11-06 18:03:52.391 14719-14719 DEBUG                   pid-14719                            A  Revision: '0'
2022-11-06 18:03:52.395 14719-14719 DEBUG                   pid-14719                            A  ABI: 'x86_64'
2022-11-06 18:03:52.395 14719-14719 DEBUG                   pid-14719                            A  Timestamp: 2022-11-06 17:03:51.931470100+0000
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  Process uptime: 2s
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  Cmdline: com.android.support
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  pid: 14654, tid: 14715, name: android.support  >>> com.android.support <<<
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  uid: 10159
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A  signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x00007063acf03ff8
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A  Cause: stack pointer is close to top of stack; likely stack overflow.
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A      rax 249a4801cd3bcf00  rbx 00007063acffbcf0  rcx 00000000000007e0  rdx ffff8f9c55644b10
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A      r8  00007066b2133cb1  r9  0000000000000000  r10 0000000000000008  r11 0000000000000246
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A      r12 0000000000000000  r13 0000000000000000  r14 00007063acffbcf0  r15 00007063aaafc840
2022-11-06 18:03:52.413 14719-14719 DEBUG                   pid-14719                            A      rdi 0000000000000000  rsi 00007063aa9bb4f0
2022-11-06 18:03:52.414 14719-14719 DEBUG                   pid-14719                            A      rbp 000000000002a2fe  rsp 00007063acf04000  rip 00007063aa9bb4f5
2022-11-06 18:03:52.414 14719-14719 DEBUG                   pid-14719                            A  backtrace:
2022-11-06 18:03:52.414 14719-14719 DEBUG                   pid-14719                            A        #00 pc 00000000001654f5  /data/app/~~nY6eNFuVcCkoXn6I3eaCRQ==/com.android.support--Vwtuyz6BB-YuMdD-ilzSg==/lib/x86_64/libMyLibName.so (BuildId: 72186b2c81df5cf449816138e1e70b58b9579c06)
2022-11-06 18:03:52.489   267-267   tombstoned              pid-267                              E  Tombstone written to: tombstone_10

I'm using llvm-mingw 20220906 for compiling sllvm on Windows 10 x64

Sorry for giving you headache

@KpwnZ
Copy link
Owner

KpwnZ commented Nov 11, 2022

Did you pull the latest submodule?

Yes, I did. Just only 32-bit issue left. x86_64 and arm64 compiled fine but -indirbr made the app crashes with exception

x86_64

2022-11-06 17:43:50.298 12838-12838 libc                    com.android.support                  A  Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7ffcfe3cdf80 in tid 12838 (android.support), pid 12838 (android.support)
2022-11-06 17:43:50.630   623-692   VerityUtils             system_process                       E  Failed to measure fs-verity, errno 1: /data/app/~~BFek_h_CKdj9K2-s4r_4VQ==/com.android.support--vO0OETOlHh6V2oOlab7PQ==/base.apk
2022-11-06 17:43:50.771 12884-12884 DEBUG                   pid-12884                            A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-11-06 17:43:50.773 12884-12884 DEBUG                   pid-12884                            A  Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:13/TPB4.220624.004/8808248:userdebug/dev-keys'
2022-11-06 17:43:50.774 12884-12884 DEBUG                   pid-12884                            A  Revision: '0'
2022-11-06 17:43:50.774 12884-12884 DEBUG                   pid-12884                            A  ABI: 'x86_64'
2022-11-06 17:43:50.780 12884-12884 DEBUG                   pid-12884                            A  Timestamp: 2022-11-06 16:43:50.434059800+0000
2022-11-06 17:43:50.781 12884-12884 DEBUG                   pid-12884                            A  Process uptime: 2s
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  Cmdline: com.android.support
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  pid: 12838, tid: 12838, name: android.support  >>> com.android.support <<<
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  uid: 10157
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x00007ffcfe3cdf80
2022-11-06 17:43:50.783 12884-12884 DEBUG                   pid-12884                            A  Cause: stack pointer is not in a rw map; likely due to stack overflow.
2022-11-06 17:43:50.784 12884-12884 DEBUG                   pid-12884                            A      rax 249a4801cd3bcf00  rbx fffffffffff95351  rcx 00007063abd6e2b0  rdx 00007063abd6e2b0
2022-11-06 17:43:50.784 12884-12884 DEBUG                   pid-12884                            A      r8  00007ffcfebc7ea8  r9  0000000000000000  r10 000000de6d00f000  r11 0000000000000044
2022-11-06 17:43:50.789 12884-12884 DEBUG                   pid-12884                            A      r12 00007ffcfebc80a0  r13 00007ffcfebc818c  r14 00007064db1ca030  r15 00007063abdf0a50
2022-11-06 17:43:50.789 12884-12884 DEBUG                   pid-12884                            A      rdi 00007064db1ca030  rsi 00007064eb1cf450
2022-11-06 17:43:50.793 12884-12884 DEBUG                   pid-12884                            A      rbp 00007063abd703d0  rsp 00007ffcfe3cdf88  rip 00007063abd6e2b0
2022-11-06 17:43:50.799 12884-12884 DEBUG                   pid-12884                            A  backtrace:
2022-11-06 17:43:50.799 12884-12884 DEBUG                   pid-12884                            A        #00 pc 00000000000bf2b0  /data/app/~~BFek_h_CKdj9K2-s4r_4VQ==/com.android.support--vO0OETOlHh6V2oOlab7PQ==/lib/x86_64/libMyLibName.so (BuildId: 62ed3fecc1a644fe8fe326ed4c51c8d6e917ef42)
2022-11-06 17:43:50.835   267-267   tombstoned              pid-267                              E  Tombstone written to: tombstone_05

arm64

2022-11-06 18:03:51.273   623-692   VerityUtils             system_process                       E  Failed to measure fs-verity, errno 1: /data/app/~~nY6eNFuVcCkoXn6I3eaCRQ==/com.android.support--Vwtuyz6BB-YuMdD-ilzSg==/base.apk
2022-11-06 18:03:51.612 14654-14654 Mod_menu                com.android.support                  E  Error. Game's main activity does not exist
2022-11-06 18:03:51.688 14654-14715 libc                    com.android.support                  A  Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7063acf03ff8 in tid 14715 (android.support), pid 14654 (android.support)
2022-11-06 18:03:52.390 14719-14719 DEBUG                   pid-14719                            A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-11-06 18:03:52.390 14719-14719 DEBUG                   pid-14719                            A  Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:13/TPB4.220624.004/8808248:userdebug/dev-keys'
2022-11-06 18:03:52.391 14719-14719 DEBUG                   pid-14719                            A  Revision: '0'
2022-11-06 18:03:52.395 14719-14719 DEBUG                   pid-14719                            A  ABI: 'x86_64'
2022-11-06 18:03:52.395 14719-14719 DEBUG                   pid-14719                            A  Timestamp: 2022-11-06 17:03:51.931470100+0000
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  Process uptime: 2s
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  Cmdline: com.android.support
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  pid: 14654, tid: 14715, name: android.support  >>> com.android.support <<<
2022-11-06 18:03:52.397 14719-14719 DEBUG                   pid-14719                            A  uid: 10159
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A  signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x00007063acf03ff8
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A  Cause: stack pointer is close to top of stack; likely stack overflow.
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A      rax 249a4801cd3bcf00  rbx 00007063acffbcf0  rcx 00000000000007e0  rdx ffff8f9c55644b10
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A      r8  00007066b2133cb1  r9  0000000000000000  r10 0000000000000008  r11 0000000000000246
2022-11-06 18:03:52.398 14719-14719 DEBUG                   pid-14719                            A      r12 0000000000000000  r13 0000000000000000  r14 00007063acffbcf0  r15 00007063aaafc840
2022-11-06 18:03:52.413 14719-14719 DEBUG                   pid-14719                            A      rdi 0000000000000000  rsi 00007063aa9bb4f0
2022-11-06 18:03:52.414 14719-14719 DEBUG                   pid-14719                            A      rbp 000000000002a2fe  rsp 00007063acf04000  rip 00007063aa9bb4f5
2022-11-06 18:03:52.414 14719-14719 DEBUG                   pid-14719                            A  backtrace:
2022-11-06 18:03:52.414 14719-14719 DEBUG                   pid-14719                            A        #00 pc 00000000001654f5  /data/app/~~nY6eNFuVcCkoXn6I3eaCRQ==/com.android.support--Vwtuyz6BB-YuMdD-ilzSg==/lib/x86_64/libMyLibName.so (BuildId: 72186b2c81df5cf449816138e1e70b58b9579c06)
2022-11-06 18:03:52.489   267-267   tombstoned              pid-267                              E  Tombstone written to: tombstone_10

I'm using llvm-mingw 20220906 for compiling sllvm on Windows 10 x64

Sorry for giving you headache

I will look into this later. It will take some time since I need to take an exam these days, sorry for that.

@ghost
Copy link
Author

ghost commented Nov 11, 2022

I will look into this later. It will take some time since I need to take an exam these days, sorry for that.

No problem. Good luck with the exam 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant