From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 691C7385703C for ; Mon, 29 Mar 2021 00:39:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 691C7385703C Received: by mail-pf1-x42a.google.com with SMTP id x126so8737878pfc.13 for ; Sun, 28 Mar 2021 17:39:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=1peVR22sr/r3oZrWOWYoJs3ZBC9xWzGbDcsy47j+wZ8=; b=qX3xziXL53EDb5ZJzUIgXESih6hl4EvI2Tqcx9ICQJdI+NezehV+o14KgVqEmQveKR /IpKQWsGf4d/Xi+oF12XnRCPo5Ei3GKC/ZQBptpbsdAgCIJIJhpbEr79g3P0vZ9Lqf58 8AYBaxdI5F7dN8V0KtDj/piEE/rkus5BOLQphB+SMhijXkCzekyNWBzUx5r0B4T6pBaa cbqcVlGlSilbahpg1HpbFJUSYcVqvzkbrOIiHwpvUZghi0BSWOIKgcu7bcH0XHiHKVDD gPi6HE//Lqk2TPbJOq0Dvmen1/oEai/ulLNlZosslsOdXOzfZKo3eqg6RZD08jHb7NE9 9jmw== X-Gm-Message-State: AOAM530owsPvWAcm0VV5CqylATAJNHZZ699wJV89RJPRuoPY922VUp97 3AMw7eTo17EoQr/01d7tEEaM2Ytx1jT19Q== X-Google-Smtp-Source: ABdhPJzm9Bb1KGFxHX97YDGXFVidz4qHiAVPQkq9gOwu2t1YP2MojK6gJYR3cz0jbewylja5JXZBlw== X-Received: by 2002:a65:4887:: with SMTP id n7mr21586438pgs.14.1616978375244; Sun, 28 Mar 2021 17:39:35 -0700 (PDT) Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id p22sm13402054pjg.39.2021.03.28.17.39.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Mar 2021 17:39:34 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id B8D554199E; Mon, 29 Mar 2021 11:09:30 +1030 (ACDT) Date: Mon, 29 Mar 2021 11:09:30 +1030 From: Alan Modra To: binutils@sourceware.org Subject: ELF output symbol hooks int vs. bfd_boolean Message-ID: <20210329003930.GF5425@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-3040.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 29 Mar 2021 00:39:38 -0000 elf_backend_link_output_symbol_hook and elf_link_output_symstrtab may return 2 when a symbol is to be discarded. Update places that use bfd_boolean rather than int for these functions. * elflink.c (elf_link_output_symstrtab): Make flinfo parameter a void pointer. (bfd_elf_final_link): Delete out_sym_func typedef and don't cast elf_link_output_symstrtab when calling output_arch_syms and output_arch_local_syms. * elf-bfd.h (struct elf_backend_data ): Change return type of func arg to match elf_link_output_symstrtab. * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Correct return type. * elf32-nds32.c (nds32_elf_output_symbol_hook): Correct return type. (nds32_elf_output_arch_syms): Correct func return type. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 04785a814e8..dec6925fd4d 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1259,16 +1259,16 @@ struct elf_backend_data not handled in the hash table. */ bfd_boolean (*elf_backend_output_arch_local_syms) (bfd *, struct bfd_link_info *, void *, - bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *)); + int (*) (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); /* This function, if defined, is called after all symbols are emitted into the symtab section. It allows the backend to emit special global symbols not handled in the hash table. */ bfd_boolean (*elf_backend_output_arch_syms) (bfd *, struct bfd_link_info *, void *, - bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *)); + int (*) (void *, const char *, Elf_Internal_Sym *, asection *, + struct elf_link_hash_entry *)); /* Filter what symbols of the output file to include in the import library if one is created. */ diff --git a/bfd/elf-vxworks.h b/bfd/elf-vxworks.h index dbdf1a52e10..d0207a78499 100644 --- a/bfd/elf-vxworks.h +++ b/bfd/elf-vxworks.h @@ -22,7 +22,7 @@ bfd_boolean elf_vxworks_add_symbol_hook (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *); -bfd_boolean elf_vxworks_link_output_symbol_hook +int elf_vxworks_link_output_symbol_hook (struct bfd_link_info *, const char *name, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *); bfd_boolean elf_vxworks_emit_relocs diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 0e63dfb575e..f6a89a78834 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -4677,7 +4677,7 @@ nds32_elf_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd, contents + address); } -static bfd_boolean +static int nds32_elf_output_symbol_hook (struct bfd_link_info *info, const char *name, Elf_Internal_Sym *elfsym ATTRIBUTE_UNUSED, @@ -12461,10 +12461,10 @@ static bfd_boolean nds32_elf_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED, struct bfd_link_info *info, void *finfo ATTRIBUTE_UNUSED, - bfd_boolean (*func) (void *, const char *, - Elf_Internal_Sym *, - asection *, - struct elf_link_hash_entry *) + int (*func) (void *, const char *, + Elf_Internal_Sym *, + asection *, + struct elf_link_hash_entry *) ATTRIBUTE_UNUSED) { FILE *sym_ld_script = NULL; diff --git a/bfd/elflink.c b/bfd/elflink.c index c5db406f2b4..6be14e7c333 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -9767,12 +9767,13 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) /* Add a symbol to the output symbol string table. */ static int -elf_link_output_symstrtab (struct elf_final_link_info *flinfo, +elf_link_output_symstrtab (void *finf, const char *name, Elf_Internal_Sym *elfsym, asection *input_sec, struct elf_link_hash_entry *h) { + struct elf_final_link_info *flinfo = finf; int (*output_symbol_hook) (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, struct elf_link_hash_entry *); @@ -12662,13 +12663,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (bed->elf_backend_output_arch_local_syms && (info->strip != strip_all || emit_relocs)) { - typedef int (*out_sym_func) - (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *); - if (! ((*bed->elf_backend_output_arch_local_syms) - (abfd, info, &flinfo, - (out_sym_func) elf_link_output_symstrtab))) + (abfd, info, &flinfo, elf_link_output_symstrtab))) { ret = FALSE; goto return_local_hash_table; @@ -12796,13 +12792,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (bed->elf_backend_output_arch_syms && (info->strip != strip_all || emit_relocs)) { - typedef int (*out_sym_func) - (void *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *); - if (! ((*bed->elf_backend_output_arch_syms) - (abfd, info, &flinfo, - (out_sym_func) elf_link_output_symstrtab))) + (abfd, info, &flinfo, elf_link_output_symstrtab))) { ret = FALSE; goto return_local_hash_table; -- Alan Modra Australia Development Lab, IBM