From patchwork Fri Sep 1 13:59:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 137398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c792:0:b0:3f2:4152:657d with SMTP id b18csp904463vqu; Fri, 1 Sep 2023 07:00:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJQLyGceBfl8D3V3AtoMu+NAEw0o4jZD4p0BpwXZ2rZ8nRrK6RcKamIVQ4hrnh0LcmZaih X-Received: by 2002:aa7:d346:0:b0:51e:53eb:88a3 with SMTP id m6-20020aa7d346000000b0051e53eb88a3mr1952070edr.25.1693576838644; Fri, 01 Sep 2023 07:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693576838; cv=none; d=google.com; s=arc-20160816; b=VMnYxqMQpalcpXHzCjeta3wnikW6bwbwbzNRAtbXvQT71n9hOJ6hFmN9oiThigf+yM prHi0u6IITmoUTBkrVzRlDVL07NkNvpMDWzXeuStVwYRgNjNw4TcjAt+loXlwE/Hqo4D +yyi7936CGI1KXAxUgpLuuR6H6WIjrVPOXQpDcjyHrG42qwJsH7hhujd2DCT/dcSU8Mv YJK9roQRq073GdOfhQutSNAvXFPfj/Zbt7X/0Uuet0aMfkhvHSkFFjXw1Eyvz4KGuWrN hEt6zUSyyD3hD5OFgSMSDlVGnNt/Hrk/wES8Om6tzYyDG5pKaLgXb0sW41XxI8h3O5Ig rkXA== 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=88nxyJFUHm04QWhClAgBl5ezjiXdwwUQWa/mP/jerXk=; fh=MTFBtdq73KnoBh2/0L1Cyccf7AHp5t5eO5j2r5QHQIM=; b=sO1F8iGy20GyjiKCqf2+olemnApnvsTWqFV2OtEcgfF9Saa9kKFsfyFCYFRThTeqmT rVkanBNPh707qPQRftOETX67Tn7dqQ6uqwfyj/I00bqBCdEe3mgdA9FiqyTBTYZsy8nr v6fnIMN2qtZ0V/rwlohOJKEE3Y/a0Yzg+LQRfGJdfDH5vAPjxOjebwphsjeUv84gOvGs zje+YghiJy1wK3I1NlkFlPs3bBXOTYTLILLi3277eq4NMCxQ4uCPCSnxCKydf7dbrZ6L 5Ajji81I9Enu/YepQQSWweexiW3QOAyzgsWM4iKONJQcbpKztGAAzF/BdIZwqg3m1IES GZgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Bd+WIIgn; 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=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d12-20020aa7d68c000000b0052a3c55ce1esi2601292edr.369.2023.09.01.07.00.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 07:00:38 -0700 (PDT) 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=@sourceware.org header.s=default header.b=Bd+WIIgn; 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=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 998D03854826 for ; Fri, 1 Sep 2023 14:00:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 998D03854826 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693576827; bh=88nxyJFUHm04QWhClAgBl5ezjiXdwwUQWa/mP/jerXk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Bd+WIIgnjwKqnX48wimwL69dxEZRu8mgxrfMNNMP+nLn3auaziSYAb5QL2IIC2qzq oiM59cK9OCMDJzruL3mVwHhejQ5X0X/6ouP6hw2dlvUjfMZNRj0i45h6b6pQP+oDUM EG0edsipdbZOlW2XSsM3R2PeZ1IRB//cH8R8OeF4= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 5A8AE385B528 for ; Fri, 1 Sep 2023 14:00:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A8AE385B528 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6bf038b8f87so1618940a34.1 for ; Fri, 01 Sep 2023 07:00:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693576815; x=1694181615; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=88nxyJFUHm04QWhClAgBl5ezjiXdwwUQWa/mP/jerXk=; b=UV9wde64nBPJwM8s+yRzgAJfjzVx+3l8CqwyCyGwNcOoEGGKRXJssVBT9rcMWWsWPc /RAXK8QjWuKCpLVymMqnxFUiy4UEY9xEMrKMnrbdK3ODPMlD7mdrDIKRml3sihatco0U H3v1HVbj8UGPS+NsMduB9d27Mq9K8twlKeftBjl4gvCjv0WiquUP6sWbt9REOl1djTBt hAcQV38t+FX1Q7wMPuHfMevkQH0WWM8WjkPvXvbM9JjXix69YpKnKQ9vpww6x+mCDhU6 NV+zFBgfv4ZWIsVObbPPB/wHbdU4mo9QQ5G/mG3G7du3HqNQW53SOgGZDlA+W6BRK9qm i1Mg== X-Gm-Message-State: AOJu0YxtYMGHg3fki4XaKa9TffyZNRPBBg/DlMHtHQFJ3QO8dKBbXxZE dCHPAcSeW14UvIW+gRBx9Sekgs3fHo4oz0YpGUseXL1a X-Received: by 2002:a05:6808:198c:b0:3a8:40c9:87b0 with SMTP id bj12-20020a056808198c00b003a840c987b0mr1650298oib.4.1693576815296; Fri, 01 Sep 2023 07:00:15 -0700 (PDT) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id j16-20020aca1710000000b003a3860b375esm1976332oii.34.2023.09.01.07.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 07:00:14 -0700 (PDT) To: binutils@sourceware.org, nickc@redhat.com, richard.earnshaw@arm.com Subject: [PATCH] arm: Make 'conflicting CPU architectures' error message more user-friendly Date: Fri, 1 Sep 2023 13:59:58 +0000 Message-Id: <20230901135958.186407-1-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: , X-Patchwork-Original-From: Christophe Lyon via Binutils From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775844027025756191 X-GMAIL-MSGID: 1775844027025756191 Error messages such as "conflicting CPU architectures 10/16" are not very to understand, so this patch replaces the numbers with the description they actually mean: "conflicting CPU architectures ARM v7E-M vs Pre v4" 2023-09-01 Christophe Lyon bfd/ * elf32-arm.c (tag_cpu_arch_combine): Add name_table parameter and use it. (elf32_arm_merge_eabi_attributes): Update call to tag_cpu_arch_combine. ld/ * testsuite/ld-arm/attr-merge-9.out: Update expected error message. * testsuite/ld-arm/attr-merge-arch-2.d: Likewise. --- bfd/elf32-arm.c | 9 +++++---- ld/testsuite/ld-arm/attr-merge-9.out | 2 +- ld/testsuite/ld-arm/attr-merge-arch-2.d | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 3b7cee3de1c..f3ad270a6a0 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -14119,7 +14119,7 @@ set_secondary_compatible_arch (bfd *abfd, int arch) static int tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out, - int newtag, int secondary_compat) + int newtag, int secondary_compat, const char* name_table[]) { #define T(X) TAG_CPU_ARCH_##X int tagl, tagh, result; @@ -14436,8 +14436,8 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out, if (result == -1) { - _bfd_error_handler (_("error: %pB: conflicting CPU architectures %d/%d"), - ibfd, oldtag, newtag); + _bfd_error_handler (_("error: conflicting CPU architectures %s vs %s in %pB"), + name_table[oldtag], name_table[newtag], ibfd); return -1; } @@ -14632,7 +14632,8 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info) arch_attr = tag_cpu_arch_combine (ibfd, out_attr[i].i, &secondary_compat_out, in_attr[i].i, - secondary_compat); + secondary_compat, + name_table); /* Return with error if failed to merge. */ if (arch_attr == -1) diff --git a/ld/testsuite/ld-arm/attr-merge-9.out b/ld/testsuite/ld-arm/attr-merge-9.out index 6c3e5f36c17..552a80ab4d1 100644 --- a/ld/testsuite/ld-arm/attr-merge-9.out +++ b/ld/testsuite/ld-arm/attr-merge-9.out @@ -1,2 +1,2 @@ -.*: error: .*: conflicting CPU architectures 10/16 +.*: error: conflicting CPU architectures ARM v7 vs ARM v8-M.baseline in .* .*: failed to merge target specific data of file tmpdir/attr-merge-9b.o diff --git a/ld/testsuite/ld-arm/attr-merge-arch-2.d b/ld/testsuite/ld-arm/attr-merge-arch-2.d index f7de02cf240..cebea49acbe 100644 --- a/ld/testsuite/ld-arm/attr-merge-arch-2.d +++ b/ld/testsuite/ld-arm/attr-merge-arch-2.d @@ -2,4 +2,4 @@ #source: attr-merge-arch-2b.s #as: #ld: -e main -#error: conflicting CPU architectures 13/0 +#error: conflicting CPU architectures ARM v7E-M vs Pre v4 in .*