From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 8115C3858C00 for ; Sat, 20 May 2023 01:17:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8115C3858C00 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-64d24136663so1725467b3a.0 for ; Fri, 19 May 2023 18:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684545423; x=1687137423; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=uDr8NH22EMt9yqNp/h3mjhk4+bQvJrUWZsPZGGhpICo=; b=VdRrV0p9b4+/C1Ot1pt95mx6sEvvOLGGMGQqdSzW7nfCWIIZ55C1cc0Am+4WTzkzJY TEH/XY8R41iKNpnbJnvk7RnzC+fHOGmpM9Ud8Y1zHLhT/JPb10D3EFG5w9napGYvbd/t /zEbvexJ6kxG2fq6MY9YN4MCb1es2UpEfxxquN7ZrnGHpnn0b/sKTmeRJ5nVG32MUdpF apOVBBfzDdOaBufvAUAItoo12S2Mx5Y68PM4622GDL9k4Kvqice/vb2SZQu0PUHDTfZF izhtRWw0wErAzuqHGIlkS4cy2npgHNpgAh/WrfvAlfLf/DhedHzF0rLZwvuqYvC0ruDI QD0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684545423; x=1687137423; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uDr8NH22EMt9yqNp/h3mjhk4+bQvJrUWZsPZGGhpICo=; b=DXy7geQlHA595ZETBrJbNi28B709AumcJOXwYbd50JkKbXn9kMAFKfmoeGG1qNVISr JicZg6WZkpnjhV/dEPcurjbHfO79/fe+zSXYUr8fH29Htflmx3DUjsJafWpxTf9jbjNe snUvs2EViWe3RBtGTKUMi4cqF/CTV778ysixZYPw0akpvbcyZr9EajGrkiNBgFtyrBpM ZSUB7ZB2Mzajrj2n7NQeIEq4AZNMTxDoBHQlf1RaBCQqfrYyggJ9p0SRHnuTA/s59Lyp N6GQ41ivXY14sGhPSRYZgycSHztr7Su2nt0yg7vKV9UGiwvajyxp/7jNPF98SQ4ZtYgZ JcYA== X-Gm-Message-State: AC+VfDxSTnMx5cUT/ja8uI068lxlIx+m4gVPtjC4dxrN8OIlPPPYBh40 dKeGwDUpwKvaXOBVjEQtAIA7FA/tp38= X-Google-Smtp-Source: ACHHUZ6LJlxHT4Q7PqiifV/+4R+6JWmkO++RiCvc2g0hzKYhHsnV1H2zh40buZvTH1b7IIfsn1vNeg== X-Received: by 2002:a05:6a00:9a2:b0:64a:c673:d064 with SMTP id u34-20020a056a0009a200b0064ac673d064mr5430623pfg.17.1684545422990; Fri, 19 May 2023 18:17:02 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id s9-20020aa78289000000b0063f2e729127sm259513pfm.144.2023.05.19.18.17.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 18:17:01 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 4859F114158A; Sat, 20 May 2023 10:46:59 +0930 (ACST) Date: Sat, 20 May 2023 10:46:59 +0930 From: Alan Modra To: binutils@sourceware.org Subject: tic54x set_arch_mach Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3034.8 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,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 List-Id: The tic54x backend provides its own coff_set_arch_mach, but wants to use the standard coff_set_section_contents. BFD_JUMP_TABLE_WRITE defines both of these functions, so the code also provides a wrapper for coff_set_section_contents. This is all quite OK, but I was on a mission to remove unnecessary declarations in coffcode.h, and on deleting the one for coff_set_arch_mach ran into a warning about the function being unused. I could have kept that declaration with its ATTRIBUTE_UNUSED or written "static bool ATTRIBUTE_UNUSED" on the definition but the latter is not usual and looks odd to me. So I had a closer look at tic54x_set_arch_mach and decided the function is very likely wrong to allow bfd_arch_unknown. Thus the backend should be using the standard coff_set_arch_mach. * coff-tic54x.c: Use BFD_JUMP_TABLE_WRITE (coff) in target vecs. (tic54x_coff_set_arch_mach): Delete. (tic54x_set_section_contents): Delete. * coffcode.h: Delete unnecessary forward declarations. diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index 77d99948def..55f87a1b6e5 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -109,23 +109,6 @@ bfd_ticoff_get_section_load_page (asection *sect) return page; } -/* Set the architecture appropriately. Allow unkown architectures - (e.g. binary). */ - -static bool -tic54x_set_arch_mach (bfd *abfd, - enum bfd_architecture arch, - unsigned long machine) -{ - if (arch == bfd_arch_unknown) - arch = bfd_arch_tic54x; - - else if (arch != bfd_arch_tic54x) - return false; - - return bfd_default_set_arch_mach (abfd, arch, machine); -} - static bfd_reloc_status_type tic54x_relocation (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, @@ -335,17 +318,6 @@ ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, #include "coffcode.h" -static bool -tic54x_set_section_contents (bfd *abfd, - sec_ptr section, - const void * location, - file_ptr offset, - bfd_size_type bytes_to_do) -{ - return coff_set_section_contents (abfd, section, location, - offset, bytes_to_do); -} - static void tic54x_reloc_processing (arelent *relent, struct internal_reloc *reloc, @@ -448,7 +420,7 @@ const bfd_target tic54x_coff0_vec = BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), BFD_JUMP_TABLE_SYMBOLS (coff), BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, @@ -510,7 +482,7 @@ const bfd_target tic54x_coff0_beh_vec = BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), BFD_JUMP_TABLE_SYMBOLS (coff), BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), @@ -573,7 +545,7 @@ const bfd_target tic54x_coff1_vec = BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), BFD_JUMP_TABLE_SYMBOLS (coff), BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), @@ -636,7 +608,7 @@ const bfd_target tic54x_coff1_beh_vec = BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), BFD_JUMP_TABLE_SYMBOLS (coff), BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), @@ -699,7 +671,7 @@ const bfd_target tic54x_coff2_vec = BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), BFD_JUMP_TABLE_SYMBOLS (coff), BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), @@ -762,7 +734,7 @@ const bfd_target tic54x_coff2_beh_vec = BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), BFD_JUMP_TABLE_SYMBOLS (coff), BFD_JUMP_TABLE_RELOCS (coff), - BFD_JUMP_TABLE_WRITE (tic54x), + BFD_JUMP_TABLE_WRITE (coff), BFD_JUMP_TABLE_LINK (coff), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 2d429828822..ab22ed092d6 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -398,62 +398,8 @@ CODE_FRAGMENT #define COFF_DEFAULT_LONG_SECTION_NAMES (false), COFF_LONG_SECTION_NAMES_SETTER #endif /* COFF_ENABLE_LONG_SECTION_NAMES */ -#if defined (COFF_LONG_SECTION_NAMES) -static bool bfd_coff_set_long_section_names_allowed - (bfd *, int); -#else /* !defined (COFF_LONG_SECTION_NAMES) */ -static bool bfd_coff_set_long_section_names_disallowed - (bfd *, int); -#endif /* defined (COFF_LONG_SECTION_NAMES) */ -static long sec_to_styp_flags - (const char *, flagword); -static bool styp_to_sec_flags - (bfd *, void *, const char *, asection *, flagword *); -static bool coff_bad_format_hook - (bfd *, void *); -static void coff_set_custom_section_alignment - (bfd *, asection *, const struct coff_section_alignment_entry *, - const unsigned int); -static bool coff_new_section_hook - (bfd *, asection *); -static bool coff_set_arch_mach_hook - (bfd *, void *); -static bool coff_write_relocs - (bfd *, int); -static bool coff_set_flags - (bfd *, unsigned int *, unsigned short *); -static bool coff_set_arch_mach - (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_UNUSED; -static bool coff_compute_section_file_positions - (bfd *); -static bool coff_write_object_contents - (bfd *) ATTRIBUTE_UNUSED; -static bool coff_set_section_contents - (bfd *, asection *, const void *, file_ptr, bfd_size_type); -static bool coff_slurp_line_table - (bfd *, asection *); -static bool coff_slurp_symbol_table - (bfd *); static enum coff_symbol_classification coff_classify_symbol (bfd *, struct internal_syment *); -static bool coff_slurp_reloc_table - (bfd *, asection *, asymbol **); -static long coff_canonicalize_reloc - (bfd *, asection *, arelent **, asymbol **); -#ifndef coff_mkobject_hook -static void * coff_mkobject_hook - (bfd *, void *, void *); -#endif -#ifdef COFF_WITH_PE -static flagword handle_COMDAT - (bfd *, flagword, void *, const char *, asection *); -#endif -#ifdef TICOFF -static bool ticoff0_bad_format_hook - (bfd *, void * ); -static bool ticoff1_bad_format_hook - (bfd *, void * ); -#endif /* void warning(); */ -- Alan Modra Australia Development Lab, IBM