From patchwork Wed Feb 21 06:06:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 203941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp856731dyc; Tue, 20 Feb 2024 22:07:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX+8pyTjd9QYjatg7/6pzC+zzP9qpq8AxiuCLZ6pZJRE3LlKew+k5QrQcwyHgfvWZ0EUib/cS0gmw84lgSXSY5wOJDZTA== X-Google-Smtp-Source: AGHT+IG9bY6IX947t9Ir6NYMuQOACS93ZE6FIF2QRJXj3fe72SdoknFiz2/m/rupe+8NCeAe3U6g X-Received: by 2002:ac8:5a15:0:b0:42d:adce:fcea with SMTP id n21-20020ac85a15000000b0042dadcefceamr21813173qta.36.1708495622546; Tue, 20 Feb 2024 22:07:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708495622; cv=pass; d=google.com; s=arc-20160816; b=QimKVHdYxBjfMnfrW2G7hFanWlzIm/YrOQBtiytU6VxAwltE1ewv3NR0ArlRSGLn8G Iwzf/yOQ2XXx0BaGaknKePAXS48IH0iaFt6udokbRP8xog0ktB1k4z8sIEZQamS7s3HU g8Tm4EJyrXn8rRpRPXlCdxZkJJQLCd65SVqsIGJjYA9rOOmNJS9YrJNbbGKe6nenxDh+ E1vjHGX/R3bYH7W5hI1Ov1OwSS6LuYflAJLJpce2h5mwVAOE7Q9KNr0URpkP7XJeYQ0t /8QSyAtX7qTqtizsUcYm7AZl4g2tMDIOvcHylwN5F59aEHYYzf/Nel+yo1T++hQ/OwDQ oyhg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=rsrNUkQ1F8JGlumOJFLCWJxaZnh1H7/66jUnomTLS1M=; fh=NLxAvL/bDfPg4AGOtxqvQlND8vazkZrNzKLY8+LAbBY=; b=vhkh3rYP4btZF3Q8a+J3AMIlbYwLcG9I/z84PNU8b+ZW/DdM5K4DbnxTIKlCl1MnEo 7RthdyDh2OHPB/iGlQB/SNej9CYZgmDHh8Q/byUeLHLHyWwO5NWQDkjUm5UZ3KW3613r zEGiDFLRgBiWNDfLH2trTd4YcUGMNqpgP2LYfILMhXXmQwt9PDumxRBRws/k2gYANcmP 2aixEHNAmhh+TIKrCQ15KgQI+WSh5iCs7FQ7tZCb5S0vbVbYJcWDHpJQKlQZcskzNMJX yEHW8ySBerGGRGFOHzQQyt6r29VIzz09YuseAs5HWK/D6W8MOyfCwTJfCKyQJ47ogqbZ XU1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qx+tmpYG; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c26-20020ac853da000000b0042c41cfd192si9897147qtq.205.2024.02.20.22.07.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 22:07:02 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Qx+tmpYG; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 436DB3858C42 for ; Wed, 21 Feb 2024 06:07:02 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 832593858D20 for ; Wed, 21 Feb 2024 06:06:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 832593858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 832593858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708495612; cv=none; b=miBnUPIvuThY4wVkpS8G2jSJjoziD2yP2mbXe3mt7yjBVav82t6g/aXUWRl4Kc2tT9JCiaQXYi6fCFl+P1sksiHjKpN4/01ONEOiPNkksvMahMgeWKaTpdWApJw/s5U66yXFhpsmVU6T797ckfITFJDSrQM/7VRHpM45xXMfyus= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708495612; c=relaxed/simple; bh=dEf++Qntt5EwSgsDvu1bTqz9ReH2u7HtaYbKjSoGdDQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=D0+asCccJIk6TJhYC3UJNQPiuKFR51reQsDd8ZANKbG9ksAq6Tr9L3IHQLZKbmFs3Jsv9hxZNB1oi7g2c3sRijbbUl73O1VXg5bp8vOkw+xLBe86wgZn6H0OTiQe6oUAvM1Iy/UID3A7MNryTwu4qAjT/nCrx9+NOrowoWyzOUc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3c0485fc8b8so5054138b6e.3 for ; Tue, 20 Feb 2024 22:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708495604; x=1709100404; darn=sourceware.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=rsrNUkQ1F8JGlumOJFLCWJxaZnh1H7/66jUnomTLS1M=; b=Qx+tmpYGezT94LawF1Q4Zd0GvKApgaAH9byl3sxt3Diti33fUHgxPJpHRlsXchBkoY Zrf6OuePpKd3dNebxFdxihj4EFp7eblxBz1tkDSPE32Yvkdt1vUP8zNGWpy0ZImiXFaq HdcvGgu87TLAh93L1QVO+5Yck8NYRBRHEHZgxxxTSXNa8Q4IV56/qrvBFsxu2AY2mdUO QgyZxkcnSNe28MWyfbH0U9K7tIcQzpNWZ80sUfupEMraVNy6q5SCu5A++ZdMTXha6BsO w8veEKNu8h5FQ7g+y1DXpYw1bJuq0wWjTpb+FT/0rHPEOszQyCxOGxKHj3WQXJsfa086 XibA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708495604; x=1709100404; 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=rsrNUkQ1F8JGlumOJFLCWJxaZnh1H7/66jUnomTLS1M=; b=vMccBsz9vjDaR0R77DMJ88Up1Qmh2uu+/G5LGmqLL9ebqNQeqWBU/LJgw2gjfCIEcH HW/5F1FddbpeSKdCQsdvOwtc5SIhwLcNY9DPwEs979L6RG5SBoRY3zENXNLKIUjTFFui VmeOTqowWzoegyvAfI7yIVGAKRSEq3/MwDFGeB2SqehRIUCj+ztpxsChj9+6JjBumunY d41Psfer68wA3kCKRtFkpaJ7dMg/Nio4eH5yIl0SW/EmfxsjFYKz+SeyWMX2tN7BtDr/ 3tDmXTYjfLXkAnziPoi3ljkqj0IWFBCNoYzOG8Vhp2baeXVSlfSchIGqY+bA+iF8H8Sq TrvA== X-Gm-Message-State: AOJu0YwdadudzcTCLA7aHI4J1XrTwKHdlutA6vhh0lX7fV7eVsU/cOnl g7DS6tyy+yR0Wgd2Jl2dXVMyV4Ga0rfCO1LLnPC16MQgj0oYuwP3HEtnZ1Au X-Received: by 2002:a05:6808:b0b:b0:3c0:2bf5:7c11 with SMTP id s11-20020a0568080b0b00b003c02bf57c11mr17961851oij.17.1708495603818; Tue, 20 Feb 2024 22:06:43 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:68fa:6eca:4c61:c5f7]) by smtp.gmail.com with ESMTPSA id e25-20020aa78259000000b006e0d44e1bd0sm7934100pfn.55.2024.02.20.22.06.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 22:06:43 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id D057C11401F8; Wed, 21 Feb 2024 16:36:40 +1030 (ACDT) Date: Wed, 21 Feb 2024 16:36:40 +1030 From: Alan Modra To: binutils@sourceware.org Subject: Remove is_relocatable_executable from backend code Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3033.4 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791487505648738812 X-GMAIL-MSGID: 1791487505648738812 With the removal of symbian support, most targets no longer or never did set is_relocatable_executable. Remove the backend support that is no longer relevant. * elf32-arm.c (record_arm_to_thumb_glue, elf32_arm_create_thumb_stub), (elf32_arm_final_link_relocate, elf32_arm_check_relocs), (elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs_for_symbol), (elf32_arm_output_arch_local_syms): Remove is_relocatable_executable code and comments. * elf32-csky.c (csky_elf_adjust_dynamic_symbol): Likewise. * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise. * elfnn-kvx.c (elfNN_kvx_final_link_relocate): Likewise. * elfxx-mips.c (count_section_dynsyms): Likewise. diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 1913be50cfe..779c7081c53 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -7351,7 +7351,6 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info, free (tmp_name); if (bfd_link_pic (link_info) - || globals->root.is_relocatable_executable || globals->pic_veneer) size = ARM2THUMB_PIC_GLUE_SIZE; else if (globals->use_blx) @@ -9259,7 +9258,6 @@ elf32_arm_create_thumb_stub (struct bfd_link_info * info, myh->root.u.def.value = my_offset; if (bfd_link_pic (info) - || globals->root.is_relocatable_executable || globals->pic_veneer) { /* For relocatable objects we can't use absolute addresses, @@ -10507,11 +10505,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, rel->r_addend); } - /* When generating a shared object or relocatable executable, these - relocations are copied into the output file to be resolved at - run time. */ + /* When generating a shared library or PIE, these relocations + are copied into the output file to be resolved at run time. */ if ((bfd_link_pic (info) - || globals->root.is_relocatable_executable || globals->fdpic_p) && (input_section->flags & SEC_ALLOC) && !(globals->root.target_os == is_vxworks @@ -15321,15 +15317,6 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, sreloc = NULL; - /* Create dynamic sections for relocatable executables so that we can - copy relocations. */ - if (htab->root.is_relocatable_executable - && ! htab->root.dynamic_sections_created) - { - if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) - return false; - } - if (htab->root.dynobj == NULL) htab->root.dynobj = abfd; if (!create_ifunc_sections (info)) @@ -15601,7 +15588,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_ARM_THM_MOVT_PREL: /* Should the interworking branches be listed here? */ - if ((bfd_link_pic (info) || htab->root.is_relocatable_executable + if ((bfd_link_pic (info) || htab->fdpic_p) && (sec->flags & SEC_ALLOC) != 0) { @@ -16213,10 +16200,8 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, /* If we are creating a shared library, we must presume that the only references to the symbol are via the global offset table. For such cases we need not do anything here; the relocations will - be handled correctly by relocate_section. Relocatable executables - can reference data in shared objects directly, so we don't need to - do anything here. */ - if (bfd_link_pic (info) || globals->root.is_relocatable_executable) + be handled correctly by relocate_section. */ + if (bfd_link_pic (info)) return true; /* We must allocate the symbol in our .dynbss section, which will @@ -16615,7 +16600,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) visibility changes. */ if (bfd_link_pic (info) - || htab->root.is_relocatable_executable || htab->fdpic_p) { /* Relocs that use pc_count are PC-relative forms, which will appear @@ -16670,17 +16654,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) return false; } } - - else if (htab->root.is_relocatable_executable && h->dynindx == -1 - && h->root.type == bfd_link_hash_new) - { - /* Output absolute symbols so that we can create relocations - against them. For normal symbols we output a relocation - against the section that contains them. */ - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return false; - } - } else { @@ -18213,7 +18186,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd, osi.sec_shndx = _bfd_elf_section_from_bfd_section (output_bfd, osi.sec->output_section); - if (bfd_link_pic (info) || htab->root.is_relocatable_executable + if (bfd_link_pic (info) || htab->pic_veneer) size = ARM2THUMB_PIC_GLUE_SIZE; else if (htab->use_blx) diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 87c37259fa1..6f8a787dae8 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -1614,7 +1614,7 @@ csky_elf_adjust_dynamic_symbol (struct bfd_link_info *info, only references to the symbol are via the global offset table. For such cases we need not do anything here; the relocations will be handled correctly by relocate_section. */ - if (bfd_link_pic (info) || htab->elf.is_relocatable_executable) + if (bfd_link_pic (info)) return true; /* We must allocate the symbol in our .dynbss section, which will diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 560983aaed6..3c65ac1f01b 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -5910,11 +5910,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, case BFD_RELOC_AARCH64_NN: - /* When generating a shared object or relocatable executable, these - relocations are copied into the output file to be resolved at - run time. */ - if (((bfd_link_pic (info) - || globals->root.is_relocatable_executable) + /* When generating a shared library or PIE, these relocations + are copied into the output file to be resolved at run time. */ + if ((bfd_link_pic (info) && (input_section->flags & SEC_ALLOC) && (h == NULL || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c index ae5ed6bf3f7..8591dea5432 100644 --- a/bfd/elfnn-kvx.c +++ b/bfd/elfnn-kvx.c @@ -2052,11 +2052,9 @@ elfNN_kvx_final_link_relocate (reloc_howto_type *howto, case BFD_RELOC_KVX_S64_LO10: case BFD_RELOC_KVX_S64_UP27: case BFD_RELOC_KVX_S64_EX27: - /* When generating a shared object or relocatable executable, these - relocations are copied into the output file to be resolved at - run time. */ - if (((bfd_link_pic (info) == true) - || globals->root.is_relocatable_executable) + /* When generating a shared library or PIE, these relocations + are copied into the output file to be resolved at run time. */ + if (bfd_link_pic (info) && (input_section->flags & SEC_ALLOC) && (h == NULL || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 47903069271..89dd34e798b 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -3928,8 +3928,7 @@ count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info) bfd_size_type count; count = 0; - if (bfd_link_pic (info) - || elf_hash_table (info)->is_relocatable_executable) + if (bfd_link_pic (info)) { asection *p; const struct elf_backend_data *bed;