From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7814) id E4D733857BB2; Thu, 11 Aug 2022 05:01:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4D733857BB2 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Fangrui Song To: bfd-cvs@sourceware.org Subject: [binutils-gdb] RISC-V: Remove R_RISCV_GNU_VTINHERIT/R_RISCV_GNU_VTENTRY X-Act-Checkin: binutils-gdb X-Git-Author: Fangrui Song X-Git-Refname: refs/heads/master X-Git-Oldrev: 4d74aab7aa562fe79d4669cdad0c32610531cbc0 X-Git-Newrev: 453595283c323e106a60b229999756b45ae6b2d8 Message-Id: <20220811050143.E4D733857BB2@sourceware.org> Date: Thu, 11 Aug 2022 05:01:43 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2022 05:01:44 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D453595283c32= 3e106a60b229999756b45ae6b2d8 commit 453595283c323e106a60b229999756b45ae6b2d8 Author: Fangrui Song Date: Wed Aug 10 22:01:41 2022 -0700 RISC-V: Remove R_RISCV_GNU_VTINHERIT/R_RISCV_GNU_VTENTRY =20 They were legacy relocation types copied from other ports. The related -fvtable-gc was removed from GCC in 2003. =20 The associated assembler directives (.vtable_inherit and .vtable_entry) have never been supported by the RISC-V port. Remove related ld code. =20 Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/323 Diff: --- bfd/elfnn-riscv.c | 32 +------------------------------- bfd/elfxx-riscv.c | 32 +++----------------------------- include/elf/riscv.h | 2 -- 3 files changed, 4 insertions(+), 62 deletions(-) diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 8f9f0d8a86a..86cb207b573 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -932,16 +932,6 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_inf= o *info, =20 break; =20 - case R_RISCV_GNU_VTINHERIT: - if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return false; - break; - - case R_RISCV_GNU_VTENTRY: - if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) - return false; - break; - default: break; } @@ -950,24 +940,6 @@ riscv_elf_check_relocs (bfd *abfd, struct bfd_link_inf= o *info, return true; } =20 -static asection * -riscv_elf_gc_mark_hook (asection *sec, - struct bfd_link_info *info, - Elf_Internal_Rela *rel, - struct elf_link_hash_entry *h, - Elf_Internal_Sym *sym) -{ - if (h !=3D NULL) - switch (ELFNN_R_TYPE (rel->r_info)) - { - case R_RISCV_GNU_VTINHERIT: - case R_RISCV_GNU_VTENTRY: - return NULL; - } - - return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); -} - /* Adjust a symbol defined by a dynamic object and referenced by a regular object. The current definition is in some section of the dynamic object, but we're not including those sections. We have to @@ -2027,8 +1999,7 @@ riscv_elf_relocate_section (bfd *output_bfd, char *msg_buf =3D NULL; bool resolved_to_zero; =20 - if (howto =3D=3D NULL - || r_type =3D=3D R_RISCV_GNU_VTINHERIT || r_type =3D=3D R_RISCV_GNU_VTE= NTRY) + if (howto =3D=3D NULL) continue; =20 /* This is a final link. */ @@ -5260,7 +5231,6 @@ riscv_elf_merge_symbol_attribute (struct elf_link_has= h_entry *h, #define elf_backend_relocate_section riscv_elf_relocate_section #define elf_backend_finish_dynamic_symbol riscv_elf_finish_dynamic_symbol #define elf_backend_finish_dynamic_sections riscv_elf_finish_dynamic_secti= ons -#define elf_backend_gc_mark_hook riscv_elf_gc_mark_hook #define elf_backend_plt_sym_val riscv_elf_plt_sym_val #define elf_backend_grok_prstatus riscv_elf_grok_prstatus #define elf_backend_grok_psinfo riscv_elf_grok_psinfo diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index 0b2021f5cc7..c9636bcbdc8 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -599,35 +599,9 @@ static reloc_howto_type howto_table[] =3D MINUS_ONE, /* dst_mask */ false), /* pcrel_offset */ =20 - /* GNU extension to record C++ vtable hierarchy */ - HOWTO (R_RISCV_GNU_VTINHERIT, /* type */ - 0, /* rightshift */ - 8, /* size */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - NULL, /* special_function */ - "R_RISCV_GNU_VTINHERIT", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ - - /* GNU extension to record C++ vtable member usage */ - HOWTO (R_RISCV_GNU_VTENTRY, /* type */ - 0, /* rightshift */ - 8, /* size */ - 0, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - _bfd_elf_rel_vtable_reloc_fn, /* special_function */ - "R_RISCV_GNU_VTENTRY", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - false), /* pcrel_offset */ + /* 41 and 42 are reserved. */ + EMPTY_HOWTO (0), + EMPTY_HOWTO (0), =20 /* Indicates an alignment statement. The addend field encodes how many bytes of NOPs follow the statement. The desired alignment is the diff --git a/include/elf/riscv.h b/include/elf/riscv.h index d0acf6886d8..9b3ea376ff3 100644 --- a/include/elf/riscv.h +++ b/include/elf/riscv.h @@ -71,8 +71,6 @@ START_RELOC_NUMBERS (elf_riscv_reloc_type) RELOC_NUMBER (R_RISCV_SUB16, 38) RELOC_NUMBER (R_RISCV_SUB32, 39) RELOC_NUMBER (R_RISCV_SUB64, 40) - RELOC_NUMBER (R_RISCV_GNU_VTINHERIT, 41) - RELOC_NUMBER (R_RISCV_GNU_VTENTRY, 42) RELOC_NUMBER (R_RISCV_ALIGN, 43) RELOC_NUMBER (R_RISCV_RVC_BRANCH, 44) RELOC_NUMBER (R_RISCV_RVC_JUMP, 45)