From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6bf038b8f87so1618940a34.1 for ; Fri, 01 Sep 2023 07:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693576815; x=1694181615; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=88nxyJFUHm04QWhClAgBl5ezjiXdwwUQWa/mP/jerXk=; b=iynpbca9TQQJYDuPA7OW9Gzuya1mOBaexWiZn/XHHLavBO9qvuGY1cujex0LG473Kw Qfvo0KAdnBi21xV8I6I5dYxSu7fwqG2et36py8upNKBQ593llZuu5TyBksdNLckpEh0Q a6+X1VORyN8MGto81q8uqimGFhg0JkXhzteu/POcp8jqzUlDzL28i9gay3PTKNYlyeeF PCw8tO97NxAqmqs/rFdglri6bc93FouTfU2sRRHriIZk2JFWJReRGeMbhShpZMIo7bqm 3KzchZe95J+jnn2GRwJo0afUrg5CX1+dMLD3ESI/ulYzjqxYwBqZ9WBQ0HVBDDyHD9Ga 5oRw== 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-Google-Smtp-Source: AGHT+IGhiAZyGZEmee0zBXj9RYZ2VslJa6jpajkO57lRh8ifaVp4XctUZRxTowmmKybbtGu12G6axA== 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) From: Christophe Lyon To: binutils@sourceware.org, nickc@redhat.com, richard.earnshaw@arm.com Cc: Christophe Lyon 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 .* -- 2.34.1