From patchwork Fri Jan 13 12:54:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?556/5LuZ5re8?= X-Patchwork-Id: 43288 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp251556wrt; Fri, 13 Jan 2023 04:55:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXs3xKS+ZilczSAVl+U/NVQA7TEfSJwEF1iOTs7OlMaCuz5xBF7SHLXMwjdROv4qt6fyzSLy X-Received: by 2002:a17:906:6a1a:b0:7b9:ee36:6153 with SMTP id qw26-20020a1709066a1a00b007b9ee366153mr89730177ejc.2.1673614516786; Fri, 13 Jan 2023 04:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673614516; cv=none; d=google.com; s=arc-20160816; b=t7QlDoeuRHpJN/fSQH6ZTJfCB6JCv9WktjdnKlGFkHyY06L1Y0OlFVYLfN/65DKrtL ILiLjq55UvJ1VKrG46Zubn9f8DOrXQnYqevP1VFI+6crb0CJ3fLYE6gOb2xc1o9AmPm1 PTUjA9sYq1Hty5u3+lp5/UToadTOYswcNvf4YaDjSRZ6sO68LyzeTOLZdKlaAU6IAeOJ 1AhbuQpiYW59kSCZAPDWaztH5gMNe3F4NcAKfl6+EBJCvXwcqC7PLq6WY6nEI3sJO21N TS+iaSemV/BeByTNrnO29Pk40010P102GIncc7COc77d/2Q7XuiV2P6Ph1Yffz3hhTUY DXcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=5TBnyIkA9vzLRAVTY1srw99TdmHbo2KbOxUoTqtivPw=; b=Tr4U5qyddovIJguaOwFKjkunaPqpy0SFwQHSAfVMQ8qU5aWYOmQfKyq3ZuxmcqgKbl e+90HDRPED5cSu5Zs7FnmmlrYPryLTfKjO2O7JN9k0vGHaZ/UpxtsxtQlD87ZsQeYW1w /X4EWZzMVclU3y9qd9t92G6Aa2tafbpM3k/7O257z88HMJXEVwOPGxuqUXwjNxg1Lwe7 uMNFy6qi1aYpHZtp/zIFjy906ce5fhk6TsC5q5XyHp8A6oJxRbQ/Q9+d8AbA9JIGWGCK SGLF0RDaqena1JvXfmTDX4HlKrZaG6k2PvpzBy3h/c+YpyMOUwFu0Bl3Z7CkIL+Rhimg HFAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=D+SWkHJo; 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=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dd7-20020a1709069b8700b0078dd12d0a9bsi23686816ejc.875.2023.01.13.04.55.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 04:55:16 -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=@sourceware.org header.s=default header.b=D+SWkHJo; 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=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B0A93858425 for ; Fri, 13 Jan 2023 12:55:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B0A93858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673614515; bh=5TBnyIkA9vzLRAVTY1srw99TdmHbo2KbOxUoTqtivPw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=D+SWkHJornuW0PaXksCpQKluYjzJ1H0g8HkiPcwGeg146E6gFeduv89OSR6hI5JMe HrhQ/fWHtbTvRCyWkaED/fV6N/SxPa6Lgqis5+ba0QBuQtXl5D58xqjdJSzJCRlhrb 3IMZfhZk3jTzN2qM8MRbn9EbdW6JNNhD2KILOytA= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by sourceware.org (Postfix) with ESMTPS id 48D6F3858D32 for ; Fri, 13 Jan 2023 12:55:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 48D6F3858D32 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R581e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045176; MF=cooper.qu@linux.alibaba.com; NM=1; PH=DS; RN=2; SR=0; TI=SMTPD_---0VZUorQn_1673614495; Received: from localhost(mailfrom:cooper.qu@linux.alibaba.com fp:SMTPD_---0VZUorQn_1673614495) by smtp.aliyun-inc.com; Fri, 13 Jan 2023 20:54:55 +0800 To: binutils@sourceware.org, lifang_xia@linux.alibaba.com Subject: [PATCH] C-SKY: Fix machine flag. Date: Fri, 13 Jan 2023 20:54:54 +0800 Message-Id: <20230113125454.75744-1-cooper.qu@linux.alibaba.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) MIME-Version: 1.0 X-Spam-Status: No, score=-20.6 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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-Patchwork-Original-From: Xianmiao Qu via Binutils From: =?utf-8?b?556/5LuZ5re8?= Reply-To: Xianmiao Qu Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754912015502317757?= X-GMAIL-MSGID: =?utf-8?q?1754912015502317757?= bfd/ * elf32-csky.c (elf32_csky_merge_attributes): Don't save and restore the ARCH attribute, it will actually clear the ARCH attribute. (csky_elf_merge_private_bfd_data): Store the machine flag correctly. --- bfd/elf32-csky.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index 7e03a3bc44d..7c2bd5dd8c0 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -2892,16 +2892,8 @@ elf32_csky_merge_attributes (bfd *ibfd, struct bfd_link_info *info) /* This is the first object. Copy the attributes. */ out_attr = elf_known_obj_attributes_proc (obfd); - /* If Tag_CSKY_CPU_NAME is already set, save it. */ - memcpy (&tattr, &out_attr[Tag_CSKY_ARCH_NAME], sizeof (tattr)); - _bfd_elf_copy_obj_attributes (ibfd, obfd); - out_attr = elf_known_obj_attributes_proc (obfd); - - /* Restore Tag_CSKY_CPU_NAME. */ - memcpy (&out_attr[Tag_CSKY_ARCH_NAME], &tattr, sizeof (tattr)); - /* Use the Tag_null value to indicate the attributes have been initialized. */ out_attr[0].i = 1; @@ -3067,11 +3059,12 @@ csky_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) out_attr = elf_known_obj_attributes_proc (obfd); /* the flags like"e , f ,g ..." , we take collection. */ - newest_flag = (old_flags & (~CSKY_ARCH_MASK)) - | (new_flags & (~CSKY_ARCH_MASK)); + newest_flag = old_flags | new_flags; sec_name = get_elf_backend_data (ibfd)->obj_attrs_section; - if (bfd_get_section_by_name (ibfd, sec_name) == NULL) + if (bfd_get_section_by_name (ibfd, sec_name) == NULL + || (new_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK) != + old_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK))) { /* Input BFDs have no ".csky.attribute" section. */ new_arch = csky_find_arch_with_eflag (new_flags & CSKY_ARCH_MASK); @@ -3110,9 +3103,6 @@ csky_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) out_attr[Tag_CSKY_ARCH_NAME].s = _bfd_elf_attr_strdup (obfd, newest_arch->name); } - else - newest_flag |= ((new_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK)) - | (old_flags & (CSKY_ARCH_MASK | CSKY_ABI_MASK))); } else {