From patchwork Wed Sep 26 17:39:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 147605 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1009385lji; Wed, 26 Sep 2018 10:39:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV61mteDFumw6nm9ATZL88VzXxVrwrHbd+gE3csAvm+u9AjAMOyyMcGRnUgd/gKnE4lgpqVwa X-Received: by 2002:a63:c14a:: with SMTP id p10-v6mr6593692pgi.305.1537983582442; Wed, 26 Sep 2018 10:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537983582; cv=none; d=google.com; s=arc-20160816; b=mm0Rh0kQu7fQqxzo1V0OtRwSxF5Cy/W1JrHkHYLFsH3M1WM6vISi/vJJ7bwWux/Bx0 3BV86pp1VwrvXHl7DxwXhzPBlrB83n4exehWpvL2LKJs4Nr1fwM40rhFc5FpSaZPN4+F t7p4tFhZMyDT+u/2NSdc6XDO924y0NBUM+xRzs+HZ6FMZPtvxy5ljs/970tpvWRlchBD jUKj7nOTL+bA/vixHNkaxSNanG9JkR1fqAN6+URP7rHlf074SOdblYLcqmIB0QyKZUY8 ntCnXVEL/MhnXUw8o4wqu83njhNi79LSt5WvtaxU462zm59bDA/+iq1+PW+zLIJjBm/u urwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature :delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=fcOtx5/qIpZOhLZfGjA/1J7kz6CI+QUf7MxRuH+EHTE=; b=BCkjkRmOXgSBc78agORlum9R2MF0D0yr89CsN9doif3y0/jo0qHzbupEEe/OQ1yKvH Lk1XSqCou6TytgNI5z2yUWje/LfOa6/1We9o+cG3ByDalhnaVDaeU4ZAlX0RzjAG0IZp 5QqU+PQpSGHFj6axXj697qs+tI67YWCH4gCrh41f0AohdBSoNLuFnqRjuMjweakbNUNP l1XX9a19B3au4wmwtd14ylIrgXN/ldViMOb7in8roSNl22NZWjpzSZAJDuCkRTw0++FU TJYrJjvROszQXAzJTfCp8wvJfdXMKn6k9diLQ9oCbonFUblu2K5Z94sZU2IooaakgzM4 YN+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HyeDWa1Q; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=I8ZciB3e; spf=pass (google.com: domain of gcc-patches-return-486491-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-486491-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s13-v6si5824920pgi.73.2018.09.26.10.39.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 10:39:42 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-486491-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=HyeDWa1Q; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=I8ZciB3e; spf=pass (google.com: domain of gcc-patches-return-486491-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-486491-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=xmK3F8JpaLxgrrNV30xknm4Yob6d6XZBUKC410i9oA07Ep RYaeQZ769T/bTupiQrdLRMPiNyN0Eps0VvWR9Jx5btQRTd81+joBLZdepbC9qkHb jCnUiht/TiGx0UElqZ8Kt5z8sOiBLbvbtGQmM5/kQhK/CBPtTovxyTk8eYNmI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=4qcfs/JNTJgs8WAhBq9VmHCxmYU=; b=HyeDWa1QEgVl8XRhe31V osQjezMRdIfodxBThNUd+/KxvBFW+JCfT408vP3ZITiuSU9jRjeZnF+TRYQQ9NsU 2Y0BtSSMSEZnuCl2HWq/fFWNR1OUuT1EaPwpWyDLJo8QgCuGlYoFzdtRS4CpfdZj QdgWgyZ7yeb23dWU/amcT3M= Received: (qmail 87728 invoked by alias); 26 Sep 2018 17:39:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 87718 invoked by uid 89); 26 Sep 2018 17:39:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=settings, feelings, forbids X-HELO: mail-it1-f196.google.com Received: from mail-it1-f196.google.com (HELO mail-it1-f196.google.com) (209.85.166.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Sep 2018 17:39:24 +0000 Received: by mail-it1-f196.google.com with SMTP id j81-v6so4143023ite.0 for ; Wed, 26 Sep 2018 10:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=PpgaAmxKk20RIfb7vJnI58OpIZ5AcEg2hDT17obUuys=; b=I8ZciB3eoxE50jSCN419qetuZMhnkj1UX2H8vl2iPU4Ggxo+GpIcbbCk4QBpTh1EC+ xWQT2+pJhsWQxoUmJU9JBJ7XN/0O0dsO69BWe1/5wqv7Hh9/VQNNjzhROY73rN4dXWS2 zHFyTf5nFp9YFje2EhflkfqVAcPq6lNHzpCoI= MIME-Version: 1.0 From: Thomas Preudhomme Date: Wed, 26 Sep 2018 18:39:11 +0100 Message-ID: Subject: [PATCH, GCC/ARM] Fix PR87374: ICE with -mslow-flash-data and -mword-relocations To: kyrylo.tkachov@foss.arm.com, Ramana Radhakrishnan , Richard Earnshaw , gcc-patches@gcc.gnu.org X-IsSubscribed: yes Hi, GCC ICEs under -mslow-flash-data and -mword-relocations because there is no way to load an address, both literal pools and MOVW/MOVT being forbidden. This patch gives an error message when both options are specified by the user and adds the according dg-skip-if directives for tests that use either of these options. ChangeLog entries are as follows: *** gcc/ChangeLog *** 2018-09-25 Thomas Preud'homme PR target/87374 * config/arm/arm.c (arm_option_check_internal): Disable the combined use of -mslow-flash-data and -mword-relocations. *** gcc/testsuite/ChangeLog *** 2018-09-25 Thomas Preud'homme PR target/87374 * gcc.target/arm/movdi_movt.c: Skip if both -mslow-flash-data and -mword-relocations would be passed when compiling the test. * gcc.target/arm/movsi_movt.c: Likewise. * gcc.target/arm/pr81863.c: Likewise. * gcc.target/arm/thumb2-slow-flash-data-1.c: Likewise. * gcc.target/arm/thumb2-slow-flash-data-2.c: Likewise. * gcc.target/arm/thumb2-slow-flash-data-3.c: Likewise. * gcc.target/arm/thumb2-slow-flash-data-4.c: Likewise. * gcc.target/arm/thumb2-slow-flash-data-5.c: Likewise. * gcc.target/arm/tls-disable-literal-pool.c: Likewise. Testing: Bootstrapped in Thumb-2 mode. No testsuite regression when targeting arm-none-eabi. Modified tests get skipped as expected when running the testsuite with -mslow-flash-data (pr81863.c) or -mword-relocations (all the others). Is this ok for trunk? I'd also appreciate guidance on whether this is worth a backport. It's a simple patch but on the other hand it only prevents some option combination, it does not fix anything so I have mixed feelings. Best regards, Thomas diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 6332e68df05..5beffc875c1 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -2893,17 +2893,22 @@ arm_option_check_internal (struct gcc_options *opts) flag_pic = 0; } - /* We only support -mpure-code and -mslow-flash-data on M-profile targets - with MOVT. */ - if ((target_pure_code || target_slow_flash_data) - && (!TARGET_HAVE_MOVT || arm_arch_notm || flag_pic || TARGET_NEON)) + if (target_pure_code || target_slow_flash_data) { const char *flag = (target_pure_code ? "-mpure-code" : "-mslow-flash-data"); - error ("%s only supports non-pic code on M-profile targets with the " - "MOVT instruction", flag); - } + /* We only support -mpure-code and -mslow-flash-data on M-profile targets + with MOVT. */ + if (!TARGET_HAVE_MOVT || arm_arch_notm || flag_pic || TARGET_NEON) + error ("%s only supports non-pic code on M-profile targets with the " + "MOVT instruction", flag); + + /* Cannot load addresses: -mslow-flash-data forbids literal pool and + -mword-relocations forbids relocation of MOVT/MOVW. */ + if (target_word_relocations) + error ("%s incompatible with -mword-relocations", flag); + } } /* Recompute the global settings depending on target attribute options. */ diff --git a/gcc/testsuite/gcc.target/arm/movdi_movt.c b/gcc/testsuite/gcc.target/arm/movdi_movt.c index e2a28ccbd99..a01ffa0dc93 100644 --- a/gcc/testsuite/gcc.target/arm/movdi_movt.c +++ b/gcc/testsuite/gcc.target/arm/movdi_movt.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { arm_cortex_m && { arm_thumb2_ok || arm_thumb1_movt_ok } } } } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-O2 -mslow-flash-data" } */ unsigned long long diff --git a/gcc/testsuite/gcc.target/arm/movsi_movt.c b/gcc/testsuite/gcc.target/arm/movsi_movt.c index 3cf46e2fd17..19d202ecd33 100644 --- a/gcc/testsuite/gcc.target/arm/movsi_movt.c +++ b/gcc/testsuite/gcc.target/arm/movsi_movt.c @@ -1,4 +1,5 @@ /* { dg-do compile { target { arm_cortex_m && { arm_thumb2_ok || arm_thumb1_movt_ok } } } } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-O2 -mslow-flash-data" } */ unsigned diff --git a/gcc/testsuite/gcc.target/arm/pr81863.c b/gcc/testsuite/gcc.target/arm/pr81863.c index 63b1ed66b2c..225a0c5cc2b 100644 --- a/gcc/testsuite/gcc.target/arm/pr81863.c +++ b/gcc/testsuite/gcc.target/arm/pr81863.c @@ -1,5 +1,6 @@ /* testsuite/gcc.target/arm/pr48183.c */ /* { dg-do compile } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mslow-flash-data" } } */ /* { dg-options "-O2 -mword-relocations -march=armv7-a -marm" } */ /* { dg-final { scan-assembler-not "\[\\t \]+movw" } } */ diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-1.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-1.c index 089a72b67f3..d10391a69ac 100644 --- a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-1.c +++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-1.c @@ -6,6 +6,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_cortex_m } */ /* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-O2 -mthumb -mslow-flash-data" } */ float sf; diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-2.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-2.c index c87e050639d..90bd44e27e5 100644 --- a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-2.c +++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-2.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target arm_thumb2_ok } */ /* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mcpu=*" } { "-mcpu=cortex-m4" "-mcpu=cortex-m7" } } */ /* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" } } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-march=armv7e-m+fp -mfloat-abi=hard -O2 -mthumb -mslow-flash-data" } */ float f (float); diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c index 8c6210ee6c9..5d9cd9c4df2 100644 --- a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c +++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target arm_thumb2_ok } */ /* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mcpu=*" } { "-mcpu=cortex-m4" "-mcpu=cortex-m7" } } */ /* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" } } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-march=armv7e-m+fp -mfloat-abi=hard -mthumb -mslow-flash-data" } */ /* From PR71607 */ diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-4.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-4.c index 1bcb6924ed2..0eeddd5e6ec 100644 --- a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-4.c +++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-4.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target arm_thumb2_ok } */ /* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mcpu=*" } { "-mcpu=cortex-m4" "-mcpu=cortex-m7" } } */ /* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" } } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-march=armv7e-m+fp -mfloat-abi=hard -O2 -mthumb -mslow-flash-data" } */ double __attribute__ ((target ("fpu=fpv5-d16"))) diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c index 808fff05faa..7d52f3801b6 100644 --- a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c +++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target arm_thumb2_ok } */ /* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mcpu=*" } { "-mcpu=cortex-m4" "-mcpu=cortex-m7" } } */ /* { dg-skip-if "do not override -mfloat-abi" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" } } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-march=armv7e-m+fp -mfloat-abi=hard -O2 -mthumb -mslow-flash-data" } */ double __attribute__ ((target ("fpu=fpv5-sp-d16"))) diff --git a/gcc/testsuite/gcc.target/arm/tls-disable-literal-pool.c b/gcc/testsuite/gcc.target/arm/tls-disable-literal-pool.c index 283201fdd97..834eaf6db92 100644 --- a/gcc/testsuite/gcc.target/arm/tls-disable-literal-pool.c +++ b/gcc/testsuite/gcc.target/arm/tls-disable-literal-pool.c @@ -2,6 +2,7 @@ /* { dg-require-effective-target tls_native } */ /* { dg-require-effective-target arm_cortex_m } */ /* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-skip-if "-mslow-flash-data and -mword-relocations incompatible" { *-*-* } { "-mword-relocations" } } */ /* { dg-options "-mslow-flash-data" } */ __thread int x = 0;