From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37058 invoked by alias); 20 May 2015 10:51:20 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 37046 invoked by uid 89); 20 May 2015 10:51:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_50,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 May 2015 10:51:19 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-18.uk.mimecast.lan; Wed, 20 May 2015 11:51:15 +0100 Received: from e104437-lin ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 20 May 2015 11:51:14 +0100 From: Jiong Wang To: "binutils\@sourceware.org" Subject: [AArch64][2/2] BFD support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 Date: Wed, 20 May 2015 10:51:00 -0000 Message-ID: MIME-Version: 1.0 X-MC-Unique: ND2rfEC3T0O3bStr8_1DzA-1 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2015-05/txt/msg00178.txt.bz2 --=-=-= Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-length: 622 This patch add BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 relocation supoprt in bf= d linker. native check-ld OK OK for trunk? 2015-05-19 Jiong Wang bfd/ * elfnn-aarch64.c (aarch64_reloc_got_type): Support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14. (elfNN_aarch64_final_link_relocate): Ditto. (elfNN_aarch64_gc_swap_hook): Ditto. (elfNN_aarch64_check_relocs): Ditto. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto. ld/testsuite/ * ld-aarch64/emit-relocs-28.s: New test file. * ld-aarch64/emit-relocs-28.d: Ditto. * ld-aarch64/aarch64-elf.exp: Run new test. --=20 Regards, Jiong --=-=-= Content-Type: text/x-diff; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename=ld-3.patch Content-length: 6708 commit 1c7c422019b7474bb26d0ed924d5d009438d480d Author: Jiong Wang Date: Tue May 12 14:21:09 2015 +0000 3 diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index e9e63c8..91878bf 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4067,6 +4067,7 @@ aarch64_reloc_got_type (bfd_reloc_code_real_type r_ty= pe) { case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -4621,6 +4622,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *= howto, howto, value); case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -4682,7 +4684,8 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *= howto, value =3D aarch64_calculate_got_entry_vma (h, globals, info, value, output_bfd, unresolved_reloc_p); - if (bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15) + if (bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 + || bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14) addend =3D (globals->root.sgot->output_section->vma + globals->root.sgot->output_offset); value =3D _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, @@ -4890,6 +4893,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *= howto, =20 case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -4902,7 +4906,8 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *= howto, value =3D aarch64_calculate_got_entry_vma (h, globals, info, value, output_bfd, unresolved_reloc_p); - if (bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15) + if (bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 + || bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14) addend =3D (globals->root.sgot->output_section->vma + globals->root.sgot->output_offset); value =3D _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, @@ -4960,7 +4965,8 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *= howto, the direct data access into indirect data access through GOT. */ value =3D got_entry_addr; =20 - if (bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15) + if (bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 + || bfd_r_type =3D=3D BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14) addend =3D base_got->output_section->vma + base_got->output_offset; =20 value =3D _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value, @@ -5965,6 +5971,7 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd, { case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -6327,6 +6334,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_lin= k_info *info, case BFD_RELOC_AARCH64_CALL26: case BFD_RELOC_AARCH64_GOT_LD_PREL19: case BFD_RELOC_AARCH64_JUMP26: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -6439,6 +6447,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_lin= k_info *info, there are no dangling GOT_PAGE relocs. */ case BFD_RELOC_AARCH64_ADR_GOT_PAGE: case BFD_RELOC_AARCH64_GOT_LD_PREL19: + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index 889b0d0..b720592 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -257,6 +257,7 @@ _bfd_aarch64_elf_put_addend (bfd *abfd, contents =3D reencode_add_imm (contents, addend); break; =20 + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC: @@ -414,6 +415,7 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_rea= l_type r_type, value =3D PG (value + addend) - PG (place); break; =20 + case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14: case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15: /* Caller must make sure addend is the base address of .got section.= */ value =3D value - PG (addend); diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarc= h64/aarch64-elf.exp index 79b5a3e..6b1109a 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -50,6 +50,7 @@ run_dump_test "erratum843419" =20 # Relocation Tests run_dump_test "weak-undefined" +run_dump_test "emit-relocs-28" run_dump_test "emit-relocs-257" run_dump_test "emit-relocs-257-be" # 258 is tested in 257 diff --git a/ld/testsuite/ld-aarch64/emit-relocs-28.d b/ld/testsuite/ld-aar= ch64/emit-relocs-28.d new file mode 100644 index 0000000..f138fb1 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-28.d @@ -0,0 +1,19 @@ +#source: emit-relocs-28.s +#as: -mabi=3Dilp32 +#ld: -m aarch64linux32 --defsym globala=3D0x11000 --defsym globalb=3D0x450= 00 --defsym globalc=3D0x1234 -e0 --emit-relocs +#objdump: -dr + +.*: +file format .* + + +Disassembly of section .text: + +00400074 <\.text>: + 400074: 90000082 adrp x2, 410000 + 400074: R_AARCH64_P32_ADR_PREL_PG_HI21 _GLOBAL_OFFSET_TABLE_ + 400078: f9408c40 ldr x0, \[x2,#280\] + 400078: R_AARCH64_P32_LD32_GOTPAGE_LO14 globala + 40007c: f9409040 ldr x0, \[x2,#288\] + 40007c: R_AARCH64_P32_LD32_GOTPAGE_LO14 globalb + 400080: f9408840 ldr x0, \[x2,#272\] + 400080: R_AARCH64_P32_LD32_GOTPAGE_LO14 globalc diff --git a/ld/testsuite/ld-aarch64/emit-relocs-28.s b/ld/testsuite/ld-aar= ch64/emit-relocs-28.s new file mode 100644 index 0000000..b13a0e5 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-28.s @@ -0,0 +1,5 @@ + .text + adrp x2, _GLOBAL_OFFSET_TABLE_ + ldr x0, [x2, #:gotpage_lo14:globala] + ldr x0, [x2, #:gotpage_lo14:globalb] + ldr x0, [x2, #:gotpage_lo14:globalc] --=-=-=--