From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa2d.google.com (mail-vk1-xa2d.google.com [IPv6:2607:f8b0:4864:20::a2d]) by sourceware.org (Postfix) with ESMTPS id C25313858287 for ; Mon, 8 Aug 2022 07:36:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C25313858287 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-vk1-xa2d.google.com with SMTP id b81so3977518vkf.1 for ; Mon, 08 Aug 2022 00:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=k0OA82BwKTVIlaBiXbw3HeLdWhJFPXZe26ZUD7x+vVg=; b=UIKJLBdn/GIIVjwWCITj3BM6im2E8+LVNE0v6VA3qfFOtjvRceat/1vtd6NBriEs7F 49Xkjpw22Zqpv+MqlQAWtmGH/4EFNQhvweiL/1rOHNMNRn5TUgwBBoxtPTl68J57kjb4 JD8bH/UxAXBIPB+8I8iagsLDk9RlTahIV3fKeLGjhqZYQL+iSE67r/I0GwUg0LxJPiFz zNK/5gPe4cnyxHuPaw4zIbXpPNPv9xymHPBnUksOMavhajeamSHtfCQYz1kGObcwjmvx MB3aKS8CgyG84/WsKCNdiO0v6VIpar++oSfJXfi8oxsqEI2Ye3r+9nC0GrGzk9zpgY7b SLpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=k0OA82BwKTVIlaBiXbw3HeLdWhJFPXZe26ZUD7x+vVg=; b=jWAPxp0z/FQZNIiFMa6ehk61WMtshEJNcbBRTNGfE7o6H6TjDYDxtyZT1ebBrbJVl7 4R6SYhw0VPYR0swKwcgFudu1xLjPRZ1Jjk7BURwRFn3Bk4j+YTZ/X0nydz2oaDOuLv8R bekT/Im4ggN3wF10BBm9roV8tOMogNcfsRBGyPz92oxwML/k3InS7jXwQ3FcBCtrsad8 oGjdNu3ywCTPUmaeUb4PQF4p6gHX2TqkiLlsoGmUN/vSPiiMVrYK/79qrLy2oJZQRYjH XLh5gWT9ZBwYnZkTZiBPpAZRq0oYt+vKM5fFWvF3gYLqXqqoxwEbIzuH+3mnFM4TAatR P9ag== X-Gm-Message-State: ACgBeo3ZnNJus1YmIXYOx6ulij7O1bq/c/SJLzt9SoU01s1of9krKioO KDO+gY/5d1fy3sP4cb2Q/Cou15MHnGQkIIl/5xSc+A== X-Google-Smtp-Source: AA6agR7aiSKhGsb9D+3jAVbU1tZBuuVJqpilsSbwwseqZ1OJXxAzZZelfemSounrhPoEt6OoNo1iqyjiU6T8M0olWmA= X-Received: by 2002:a1f:6142:0:b0:377:4b38:1156 with SMTP id v63-20020a1f6142000000b003774b381156mr6887683vkb.28.1659944181037; Mon, 08 Aug 2022 00:36:21 -0700 (PDT) MIME-Version: 1.0 References: <20220808065523.18152-1-maskray@google.com> In-Reply-To: <20220808065523.18152-1-maskray@google.com> From: Nelson Chu Date: Mon, 8 Aug 2022 15:36:10 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: Remove R_RISCV_GNU_VTINHERIT/R_RISCV_GNU_VTENTRY To: Fangrui Song Cc: binutils@sourceware.org, Kito Cheng Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2022 07:36:24 -0000 Not sure about the history, but if we never use these two relocations, then removing them makes sense to me. Btw, just curious that, will we use numbers 41 and 42 first when adding new relocations? On Mon, Aug 8, 2022 at 2:55 PM Fangrui Song wrote: > > There is no assembler syntax for the two relocation types and therefore > they appear to be never used. Remove related ld code. > > Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/323 > --- > 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_info *info, > > break; > > - 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_info *info, > return true; > } > > -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 != 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 = NULL; > bool resolved_to_zero; > > - if (howto == NULL > - || r_type == R_RISCV_GNU_VTINHERIT || r_type == R_RISCV_GNU_VTENTRY) > + if (howto == NULL) > continue; > > /* This is a final link. */ > @@ -5260,7 +5231,6 @@ riscv_elf_merge_symbol_attribute (struct elf_link_hash_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_sections > -#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[] = > MINUS_ONE, /* dst_mask */ > false), /* pcrel_offset */ > > - /* 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), > > /* 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) > -- > 2.37.1.559.g78731f0fdb-goog >