[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libobjc2 relocation issue in aarch64
From: |
Jordan Schidlowsky |
Subject: |
Re: libobjc2 relocation issue in aarch64 |
Date: |
Thu, 18 Jul 2019 12:19:31 -0600 |
So after moving a few things to shared libraries, I started experiencing some
strange things with the new runtime... I'm running under asan and compiling
and running latest libobjc2 master branch for arm-v7a android. Compiler is
Frederik's latest here: https://github.com/gnustep/tools-android
So I'm ending up hitting an assert in the runtime on the second __objc_load
when loading libs-base shared lib. (first __objc_load on libobjc2 completes
fine).
When __objc_load is called the second time when loading libs-base, I end up
hitting this assert below (loader.c line 225):
assert((((uintptr_t)init->cat_end-(uintptr_t)init->cat_begin) %
sizeof(*init->cat_begin)) == 0);
The category end minus start size ends up being 8992, and the size of the cat
struct is 28.
Any thoughts?
-Jordan
> On Jul 17, 2019, at 2:42 PM, Jordan Schidlowsky <address@hidden> wrote:
>
> Yep. Shared library removes the relocation problem. There's no real reason
> why I'm static linking libobjc in, I'm fine to move to a shared lib. Thanks!
>
>
>> On Jul 17, 2019, at 1:56 PM, David Chisnall <address@hidden> wrote:
>>
>> I think the main hint is to use a dynamic library. Static linking is not
>> well tested on any platform and the assembly code expects a PIC model. I’m
>> happy to accept patches that improve the static linking experience, but it’s
>> not something that I have any plans to work on personally.
>>
>> David
>>
>>> On 17 Jul 2019, at 20:43, Jordan Schidlowsky <address@hidden> wrote:
>>>
>>> I can't seem to get libobjc2 to link in properly to my android app on
>>> arm64-v8a. I'm using the latest clang prebuilt by Frederik here:
>>> https://github.com/gnustep/tools-android
>>>
>>> I've tried 3 different linkers, and all report the same
>>> R_AARCH64_ADR_PREL_LO21 issue. bfd was the only linker to provide any
>>> insight, but it seems like it's related to the SmallObjectClasses symbol.
>>> Output from each linker is below:
>>>
>>> gold:
>>> libs/libobjc2/objc_msgSend.aarch64.S:97: error: relocation overflow in
>>> R_AARCH64_ADR_PREL_LO21
>>>
>>> lld:
>>> ld.lld: error:
>>> ../../../../libs/libobjc2/objc_msgSend.aarch64.S:97:(.text+0xD0):
>>> relocation R_AARCH64_ADR_PREL_LO21 out of range: 16077624 is not in
>>> [-1048576, 1048575]
>>>
>>> bfd:
>>> libs/libobjc2/libobjc.a(objc_msgSend.S.o): In function
>>> `objc_msgSend_stret': libs/libobjc2/objc_msgSend.aarch64.S:97:(.text+0xd0):
>>> relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against symbol
>>> `SmallObjectClasses' defined in COMMON section in
>>> libs/libobjc2/libobjc.a(class_table.c.o)
>>>
>>>
>>> Any thoughts?
>>> -Jordan
>>
>