Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Relocations in .text on arm #16369

@radekdoulik

Description

@radekdoulik

It looks like AOT compiler produces shared libraries on XA/arm, which contains relocations in .text section.

Discussed it with @vargaz on slack and he thinks it was introduced recently by 9ff3b0d65ee4

I have tried older XA d16.1 and it indeed didn't contain relocations in .text, while current XA with mono-2019-06 does.

d16.1:

arm-linux-androideabi-readelf  -a /Users/rodo/git/monodroid-samples/android5.0/Topeka/Topeka/obj/Release/aot/armeabi-v7a/libaot-Topeka.dll.so |grep TEXT

Relevant part of source

.text 1
        .align 3
method_addresses:
        .local method_addresses
        .type method_addresses,#function
bl .Lm_0
bl .Lm_1
bl .Lm_2
...

No relocations in .text:

Section Headers:
...
  [ 5] .text             PROGBITS        00000240 000240 022a30 00  AX  0   0 16
...
Relocation section '.rel.dyn' at offset 0x178 contains 24 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00024008  00000017 R_ARM_RELATIVE   
0002401c  00000017 R_ARM_RELATIVE   
00024020  00000017 R_ARM_RELATIVE   
00024024  00000017 R_ARM_RELATIVE   
00024028  00000017 R_ARM_RELATIVE   
0002402c  00000017 R_ARM_RELATIVE   
00024030  00000017 R_ARM_RELATIVE   
00024034  00000017 R_ARM_RELATIVE   
00024038  00000017 R_ARM_RELATIVE   
0002403c  00000017 R_ARM_RELATIVE   
00024040  00000017 R_ARM_RELATIVE   
00024044  00000017 R_ARM_RELATIVE   
0002404c  00000017 R_ARM_RELATIVE   
00024050  00000017 R_ARM_RELATIVE   
00024054  00000017 R_ARM_RELATIVE   
00024058  00000017 R_ARM_RELATIVE   
0002405c  00000017 R_ARM_RELATIVE   
0002407c  00000017 R_ARM_RELATIVE   
00024080  00000017 R_ARM_RELATIVE   
00024084  00000017 R_ARM_RELATIVE   
00024088  00000017 R_ARM_RELATIVE   
0002408c  00000017 R_ARM_RELATIVE   
00024090  00000017 R_ARM_RELATIVE   
00024094  00000017 R_ARM_RELATIVE   

master (which uses mono-2019-06):

arm-linux-androideabi-readelf  -a /Users/rodo/git/monodroid-samples/android5.0/Topeka/Topeka/obj/Release-master/aot/armeabi-v7a/libaot-Topeka.dll.so |grep TEXT
 0x00000016 (TEXTREL)                    0x0
 0x0000001e (FLAGS)                      TEXTREL

Relevant part of source:

.text 1
        .align 3
method_addresses:
        .local method_addresses
        .type method_addresses,#function
ldr pc,=.Lm_0
.ltorg
ldr pc,=.Lm_1
.ltorg
ldr pc,=.Lm_2

Relocations in .text

Section Headers:
...
  [ 5] .text             PROGBITS        00001580 001580 022e78 00  AX  0   0 16
...
Relocation section '.rel.dyn' at offset 0x178 contains 640 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00020fe4  00000017 R_ARM_RELATIVE   
00020fec  00000017 R_ARM_RELATIVE   
00020ff4  00000017 R_ARM_RELATIVE   
00020ffc  00000017 R_ARM_RELATIVE
...

This probably affects the performance and will potentially cause problems on Android as the shared libs should not contain .text relocations on API >= 23. (https://android-developers.googleblog.com/2016/06/android-changes-for-ndk-developers.html)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions