Shared object(.so) issue using Arm Clang (section [index 9] has invalid sh_entsize: expected 16, but got 8 error)

Hi,

I am working on a project where i am trying to run an executable on android device by linking with the shared object.

Arm clang compiler/linker used: ARMCompiler6.19

OS: Windows and WSL(windows subsystem on linux running on ubuntu)

Demo files to describe the problem: demo.c and demo1.c each files has one simple add functions.

Issues:

1. Using the below commands on linux(WSL) i have created object files and archived it to a static library.

/opt/arm/developmentstudio-2019.0-1/sw/ARMCompiler6.19/bin/armclang --target=aarch64-arm-none-eabi -c -o demo.o demo.c -fpic
/opt/arm/developmentstudio-2019.0-1/sw/ARMCompiler6.19/bin/armclang --target=aarch64-arm-none-eabi -c -o demo1.o demo1.c -fpic
/opt/arm/developmentstudio-2019.0-1/sw/ARMCompiler6.19/bin/armar -r library.a demo.o demo1.o

  • While using this static library(library.a) to generate .so in android NDK or GCC, the shared object is created only without any symbols in it(no function details from demo.c and demo1.c). Dummy .so is created.
  • I used same arm compiler toolchain on windows environment as well and did the same procedures. Same issue. No symbols in .so using the static library created in windows or WSL linux environment.

2. Using the below commands i have created the .so shared object using arm linker itself instead of GCC or android NDK

/opt/arm/developmentstudio-2019.0-1/sw/ARMCompiler6.19/bin/armclang --target=aarch64-arm-none-eabi -c -o demo.o demo.c -fpic
/opt/arm/developmentstudio-2019.0-1/sw/ARMCompiler6.19/bin/armclang --target=aarch64-arm-none-eabi -c -o demo1.o demo1.c -fpic
/opt/arm/developmentstudio-2019.0-1/sw/ARMCompiler6.19/bin/armar -r library.a demo.o demo1.o
/opt/arm/developmentstudio-2019.0-1/sw/ARMCompiler6.19/bin/armlink --fpic --shared -o library_a.so library.a\(*.o\)

  • The .so created via arm linker(library_a.so) has all the symbol details from demo.c and demo1.c. Things are fine here
  • But i want to link this .so to create an executable to run it on android device. I use Android NDK to link this .so and create an executable.
  • I get this error section [index 9] has invalid sh_entsize: expected 16, but got 8 error while linking the .so to create an executable.
  • Please note, I am not mixing the environment here. If i am using arm toolchain on windows i am using android NDK in windows itself. For the .so built on WSL i am using linux version of Android NDK to create an executable.
  • Either in windows environment or WSL environment i am unable to link the .so created via clang. section [index 9] has invalid sh_entsize: expected 16, but got 8 error error exists.

Kindly share your inputs and feedback if anyone has faced this issue or any insight on what and why it is going wrong.

Thanks in advance.