This is the mail archive of the
mailing list for the binutils project.
Re: [AArch64/bfd/2.24] relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against
- From: David Abdurachmanov <david dot abdurachmanov at gmail dot com>
- To: pinskia at gmail dot com
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Mon, 14 Jul 2014 10:14:51 +0200
- Subject: Re: [AArch64/bfd/2.24] relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against
- Authentication-results: sourceware.org; auth=none
- References: <B98BFD30-327B-47F6-94F3-CAD15DD20917 at gmail dot com> <6EF92E14-28C0-4822-95E3-EDBA100BB05A at gmail dot com>
On Jul 13, 2014, at 9:42 AM, email@example.com wrote:
>> On Jul 11, 2014, at 1:19 PM, David Abdurachmanov <firstname.lastname@example.org> wrote:
>> Tested on Fedora 19 Remix aarch64 (GCC 4.8.1, binutils 188.8.131.52.1-9.fc19 20130226) and June 28 Fedora 21 (rawhide) (GCC 4.9.0, binutils 2.24). Default linker if bfd.
>> I am building a package called CVMFS. It depends on pacparser, which internally depends on Mozilla's SpiderMonkey JS engine.
>> The packages compiles on i386, x86_64, and armv7hl for Fedora 19 and 20.
>> I got these linker errors:
> This could be a bug in gcc too. I had debugged a case in the aarch64 backend where it would change from the small coding model to the tiny one in some cases. I have a fix but I don't have it right now as I am on vacation. I can post it around Tuesday or so. I saw this while using a gcc 4.7 based gcc and with a distro build (I cannot remember the program right now either, maybe python).
That would explain it.
But the following should be good enough for 4GB offset (small code model), IIUC.
82348: 90000000 adrp x0, 7e20c <Curl_FormReader>
8234c: f9400000 ldr x0, [x0]
And ldr here takes imm12 unsigned offset. 82348 calculates page address the Curl_FormReader sits, and 8234c offset inside that page. ld.bfd does not complain about 82348 relocation, only about 8234c.
I can test your patch once it arrives. I am watching gcc-patches.
I know that changing code model compiles fine, but fPIC is not supported with mcmode=large. I could compile the code with mcmode=large, but I couldn't run it. This static library needs fPIC.
I can share the static libraries and combine_libs scripts if someone would like to test locally.
To confirm that problem is in GCC I packed Clang 3.4.1 for F19 on aarch64, but that didn't work. Some porting is needed for Clang (will debug it).
I checked random function addresses and they seems to be 4-byte aligned, not 8-byte.