From patchwork Sat Feb 24 04:26:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 205771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp984834dyb; Fri, 23 Feb 2024 20:27:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkDrck442pUhwY3asYoQMvLENOKc2cFGA4K+Hlx1LXszZuTWbh/YY8oeMVFsL4CJcvlmIhn4YCy3Ynk/J6ol3LA9EqXw== X-Google-Smtp-Source: AGHT+IFlYFMLIrwhWzf2Ev3YRLYiKW0QlU4qITtr3D5kMI+HRNuH8863dpWBjnmd+5sK8VrkkNNT X-Received: by 2002:a05:622a:11cc:b0:42e:4f6d:2cde with SMTP id n12-20020a05622a11cc00b0042e4f6d2cdemr1455355qtk.40.1708748824085; Fri, 23 Feb 2024 20:27:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708748824; cv=pass; d=google.com; s=arc-20160816; b=EGIr+TuzbiWBx8cEWlRGNNxhKSKPZZM8zU/OSbchYlkF3C0dY+NhEroM5NCGdgHMAA oFcY+LSFS49zMUtjc7FADskhD42EjilOpWxEwrnqMvlRlL5aqbjtft/zIeYME4dGQ1+0 FdUI+dZYpLJSdkKMSva7OWwWQVudD4Rdy4Yra4V4VeLLvZ+mEO4MoCIlUGnIunmVF6gK rOPkksRMS4EsJJ+1bZAYIr1iRv5vsfr2hLGF8qDLlVND0rYeRXe8Bk4EeN6THwDD7a6O a2jNAfJDhL5w9MgyCb/eT7785dM96mvZJFbQLhvqdo5JkbVZEJz88zrt5TJOZtfNxbrA g6dg== 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=wQlqDxkP+1MGLFvJLXno6PO4Qsuzrx6OWV8z0D4SwLs=; fh=NLxAvL/bDfPg4AGOtxqvQlND8vazkZrNzKLY8+LAbBY=; b=xpy+K0m+cQ6rS7GLXrZEOhDGK6OIJcPEDIvREYDmdDzZW8nBwh89lQ4qBxUQ2zWtKY I7O0pBjvR5CS7u6EnjrDMEt8XJdi16qhCc2tpIMr3BS2SUOs5Psd2ySAeElw5ADaW5QG via60bSWOVPP/6G86DWux0NitsQrYxmwRnzbuy/YQq5WM0NrpZIlRvKyPRm3QwT2voF1 iTYfDAAvVf6SMip5msWl808VtZJrHo6Y/KeO453uSg7siCWgms5cEob7OpumybYN18Li dQHF0CHfsMg2IOoukPvb50Iru+GjLiKf1fy1qsvBd0i+gkzkm72o4GfPl1QOkNiPb8nb zARA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d42BKR46; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id 15-20020ac8594f000000b0042e46d4d72dsi458737qtz.212.2024.02.23.20.27.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 20:27:04 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d42BKR46; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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 B5AD6385841A for ; Sat, 24 Feb 2024 04:27:03 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 1FA563858C53 for ; Sat, 24 Feb 2024 04:26:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1FA563858C53 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 1FA563858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708748813; cv=none; b=JOrEuxQnUWPUbu0YwytLLIupMp5tiKOJBUhABc7O5/EJxOynzP0nTYWmFHsv5oUFpRqdPHrr1cWYkdDAzVSKdsqO5SYmtAjDhPqUbU659Z9flxcPLguo0wetrKLfgw/nX2yS3OBvHLW/SH9una2zUCSbepCrhSCZVBFhMk2cDyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708748813; c=relaxed/simple; bh=HF8lOyvO7+flfPQfShS4BpkURC7acYqlyCtq7g4G9kg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=eeNBXRWVQA9Bg8ScNpknWOo60QlqCPyjlKKcdbl7f5sTYhSZFWMa3zsgHzIiGtSYDgo92pzDalszdilaVW/LsU5VSkcE+/w0jH7x+hLWi/iK/KHGJNX4mjzMkNjyO5nupwyWGBtUlYN5vWsJEKyXpdc6/sKZgJXoFtKwG8nnbLg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6e4804fc21cso445888a34.3 for ; Fri, 23 Feb 2024 20:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708748809; x=1709353609; darn=sourceware.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=wQlqDxkP+1MGLFvJLXno6PO4Qsuzrx6OWV8z0D4SwLs=; b=d42BKR46NQk10ykHGWnKZ6pgnJFTCmKP98IVwtI1CFf3Amv3KZIkI22sd1HS/l0JOS HE1CWQNjonBL33mFjj4rXvPAzLYE1zbctB9LQt+epnHxyCeOVQnmyjIgIG3DmVlhyPyJ e9FSbnYJZb5V3aXEndcktxn/3a1mavkVVpBzjry1oh1njBaYaO+b7fFmNcESBcyaNG+R 0jcCJUiO2FMnhNy03Ndf7SN/YJl3GwuLYuuimcvGOVwaB1eoC8KsP4x3ubPFwJMfGGkj g93V4LU+emqIjyneV7PrUXdK/STfl94jrulz6qnO00HDlWX2JK5qK/PGtnUWcJHjH1pr IKOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708748809; x=1709353609; 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=wQlqDxkP+1MGLFvJLXno6PO4Qsuzrx6OWV8z0D4SwLs=; b=QEtQtBHTA8weDyvcQf3TZHymLGsb4hgOVThxTRKo6r7ANNeliFT4AEXWoFYln3eSsT xD+136BlOj73q7qFmPotnOnMtq7/rusXK/kDaeRNp0I+fchzl5zHQeYWmGljMI0Vd6Cx MRWYye2IoR9CZxf4TMZh/Bl2ywDd0znZMtB84hXNYwdvxyinWPTMoaVirYi2/diI3yEf ST8phbAbyjSofukdfprnmxwb2cB+tnVBp383K2cmDCFyU38bSmuOLypuBQFScCj230HX xNMvTnTworC8ArJ9ZNCoCCAknip4v1O9n9UvaZ7EB1Xt6lvbqv6DX7z6SclOp6LD6qAA oQTg== X-Gm-Message-State: AOJu0YxfxMXyYMpc0e8maE7PDzaW8EVFkr/+ScDSI/taa9Gt5+2nWkNN x+zXHdgoLMafLAWqZG9MgATJIu0vNOIlWiQufVTr26OFOjKHDrqNwv+DOi29 X-Received: by 2002:a05:6358:570c:b0:17b:6cc5:f525 with SMTP id a12-20020a056358570c00b0017b6cc5f525mr2289405rwf.6.1708748809375; Fri, 23 Feb 2024 20:26:49 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:efd8:19ec:564:6ae4]) by smtp.gmail.com with ESMTPSA id t26-20020a62d15a000000b006e4883591e7sm291384pfl.144.2024.02.23.20.26.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 20:26:48 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id BFB951140478; Sat, 24 Feb 2024 14:56:45 +1030 (ACDT) Date: Sat, 24 Feb 2024 14:56:45 +1030 From: Alan Modra To: binutils@sourceware.org Subject: xtensa: move xtensa_make_property_section from bfd to gas 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: 1791753007223677844 X-GMAIL-MSGID: 1791753007223677844 This function is only used by gas, so move it there. Necessary for gas to keep track of group sections as they are created. PR 25333 bfd/ * elf32-xtensa.c (xtensa_make_property_section): Delete. (xtensa_property_section_name): Make public. include/ * elf/xtensa.h (xtensa_make_property_section): Delete. (xtensa_property_section_name): Declare gas/ * config/tc-xtensa.c (xtensa_make_property_section): New, moved from elf32-xtensa.c. diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 4061341d38f..e73f96a7dcc 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -11253,7 +11253,7 @@ xtensa_add_names (const char *base, const char *suffix) static int linkonce_len = sizeof (".gnu.linkonce.") - 1; -static char * +char * xtensa_property_section_name (asection *sec, const char *base_name, bool separate_sections) { @@ -11335,38 +11335,6 @@ xtensa_get_property_section (asection *sec, const char *base_name) } -asection * -xtensa_make_property_section (asection *sec, const char *base_name) -{ - char *prop_sec_name; - asection *prop_sec; - - /* Check if the section already exists. */ - prop_sec_name = xtensa_property_section_name (sec, base_name, - elf32xtensa_separate_props); - prop_sec = bfd_get_section_by_name_if (sec->owner, prop_sec_name, - match_section_group, - (void *) elf_group_name (sec)); - /* If not, create it. */ - if (! prop_sec) - { - flagword flags = (SEC_RELOC | SEC_HAS_CONTENTS | SEC_READONLY); - flags |= (bfd_section_flags (sec) - & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)); - - prop_sec = bfd_make_section_anyway_with_flags - (sec->owner, strdup (prop_sec_name), flags); - if (! prop_sec) - return 0; - - elf_group_name (prop_sec) = elf_group_name (sec); - } - - free (prop_sec_name); - return prop_sec; -} - - flagword xtensa_get_property_predef_flags (asection *sec) { diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index c6e6881ae68..188715d9619 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -11789,6 +11789,36 @@ get_frag_is_literal (const fragS *fragP) return fragP->tc_frag_data.is_literal; } +static asection * +xtensa_make_property_section (asection *sec, const char *base_name) +{ + char *prop_sec_name; + asection *prop_sec; + + /* Check if the section already exists. */ + prop_sec_name = xtensa_property_section_name (sec, base_name, + elf32xtensa_separate_props); + prop_sec = bfd_get_section_by_name_if (sec->owner, prop_sec_name, + match_section_group, + (void *) elf_group_name (sec)); + /* If not, create it. */ + if (! prop_sec) + { + flagword flags = (SEC_RELOC | SEC_HAS_CONTENTS | SEC_READONLY); + flags |= (bfd_section_flags (sec) + & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)); + + prop_sec = bfd_make_section_anyway_with_flags + (sec->owner, strdup (prop_sec_name), flags); + if (! prop_sec) + return 0; + + elf_group_name (prop_sec) = elf_group_name (sec); + } + + free (prop_sec_name); + return prop_sec; +} static void xtensa_create_property_segments (frag_predicate property_function, diff --git a/include/elf/xtensa.h b/include/elf/xtensa.h index 402d9ad5465..523855e7e81 100644 --- a/include/elf/xtensa.h +++ b/include/elf/xtensa.h @@ -215,7 +215,7 @@ typedef struct property_table_entry_t #define XTENSA_PROP_INSN_ABSLIT 0x00020000 -extern asection *xtensa_make_property_section (asection *, const char *); +extern char *xtensa_property_section_name (asection *, const char *, bool); extern int xtensa_read_table_entries (bfd *abfd, asection *section,