From patchwork Fri Nov 20 22:40:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 1404184 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CdBRt4j61z9sVK for ; Sat, 21 Nov 2020 09:44:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=CSj11HYA; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CdBRs501wzDqjb for ; Sat, 21 Nov 2020 09:44:09 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--morbo.bounces.google.com (client-ip=2607:f8b0:4864:20::b4a; helo=mail-yb1-xb4a.google.com; envelope-from=360w4xwukdfwgil5iaiiaf8.6igfchorjj6-78pfcmnm.itf45m.ila@flex--morbo.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=CSj11HYA; dkim-atps=neutral Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CdBN40yMXzDqyw for ; Sat, 21 Nov 2020 09:40:45 +1100 (AEDT) Received: by mail-yb1-xb4a.google.com with SMTP id a126so13522254ybb.11 for ; Fri, 20 Nov 2020 14:40:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=d+bIZ09nG8hw+ySjYPTAu1+6YR5JEF4dm7h9RsWiYik=; b=CSj11HYAwXoLO/bTOWahWYZ245Tj2efGfJyfcoNT4TDiUwNdKu8AK8Vy3ljvFF7nAt K0i0/0g7ZqZkr6mGDDJCj7zPy/DqfK+etqj+JKpe5t6o/lhzMEuIAB/tdGe4tKgoauXo wZMXq0xkfflL3lhwFlAcHhO5vHVco9k410Uv8OboiLV2UBQwWrJ7Y/OinohyB78dyha1 P/W9SamgKT7kAxfj55vr4SLDBqIj6/ObFq+BzVXRdc4PGTqsy30wTHFicrSXoSKq8XX/ R0vaj66XlOII1/e7OqW4gQ0PHws+BJAh/gmIpKwLhjGqHDkefjrCC2RyizwXLjhmjNPa 5HKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=d+bIZ09nG8hw+ySjYPTAu1+6YR5JEF4dm7h9RsWiYik=; b=qGijIac03wpacrlM1DsihMyX9UEQnX4e0BsCQM2fzkeB06yBb831R5YLjU77Ui9iHw x5/V0o4lEesLxc8P6Y34rw1xSHbqWuMZLwjaDJ18NraQgOcP9nG2r/kVge+7NbmwZ3fk 0vUt7sr5Wvg6UMjnNZin1CcetsG9nnuoiH2GKCeAUzV7bVdQRV8syjP1/ESbxUjwvnUk ofUrh01doUS6eyeF1HHTwDt4G7QGUPMsvfQr68Jxc4wff3sjVf5uBl65efKbQQOXok2C XzMAE8YAExreKFFVPUqDT2qkXIouFrJGJaWB5XqCh1hmVulRHBZsbZpM3lr5X1ZrI6oz NS1w== X-Gm-Message-State: AOAM532dlQrtwMcJeJlLwsGwBRLCUdTS69EavbU10OcxDwWlqbUf48ND UGl+IAcge8wkIOI/I5a/2/B3h7gv X-Google-Smtp-Source: ABdhPJyh0wl3htiuHCSYoNb4GGXs51BTzAsohHHC2UrpSiiqvwVNxcFqJ8uJa0WKSWY2TyDsk2LegGiRrA== X-Received: from fawn.svl.corp.google.com ([100.116.77.50]) (user=morbo job=sendgmr) by 2002:a25:7481:: with SMTP id p123mr21066335ybc.167.1605912043815; Fri, 20 Nov 2020 14:40:43 -0800 (PST) Date: Fri, 20 Nov 2020 14:40:33 -0800 In-Reply-To: <20201120224034.191382-1-morbo@google.com> Message-Id: <20201120224034.191382-3-morbo@google.com> Mime-Version: 1.0 References: <20201118223513.2704722-1-morbo@google.com> <20201120224034.191382-1-morbo@google.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v3 2/3] powerpc/boot: Use clang when CC is clang From: Bill Wendling To: Michael Ellerman , linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Bill Wendling Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The gcc compiler may not be available if CC is clang. Signed-off-by: Bill Wendling --- arch/powerpc/boot/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index f8ce6d2dde7b..68a7534454cd 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -21,7 +21,11 @@ all: $(obj)/zImage ifdef CROSS32_COMPILE +ifdef CONFIG_CC_IS_CLANG + BOOTCC := $(CROSS32_COMPILE)clang +else BOOTCC := $(CROSS32_COMPILE)gcc +endif BOOTAR := $(CROSS32_COMPILE)ar else BOOTCC := $(CC) From patchwork Fri Nov 20 22:40:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Wendling X-Patchwork-Id: 1404183 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CdBPn2Rgqz9sVH for ; Sat, 21 Nov 2020 09:42:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=bSqMnS2O; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CdBPm3NxqzDr2k for ; Sat, 21 Nov 2020 09:42:20 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--morbo.bounces.google.com (client-ip=2607:f8b0:4864:20::b4a; helo=mail-yb1-xb4a.google.com; envelope-from=37uw4xwukdf4ikn7kckkcha.8kihejqtll8-9arheopo.kvh67o.knc@flex--morbo.bounces.google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=bSqMnS2O; dkim-atps=neutral Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CdBN26gSnzDqyw for ; Sat, 21 Nov 2020 09:40:47 +1100 (AEDT) Received: by mail-yb1-xb4a.google.com with SMTP id i184so13472798ybg.7 for ; Fri, 20 Nov 2020 14:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=d7fl0fThhSjhiBN90Kr8mMkxDJV0yAB+ftlc2k02ID4=; b=bSqMnS2OCayQ0njnn6h7CIIgrwFlxOUhPJLbh9Q92joJKIvAqJWYuk8SZVCoQvzzf8 8leZMSosVpUFZ7vulCNie/XuPvFuoVziKGfEFa/Ba+ISVYmWcF+KZ8vIPwcVkC7nQDP9 bq5yUydrPCqjDsOrgOeYJzllvaPlHWAoqMAcjuumSrvAmLBOPaP5WTrlTULrG7amKQjd TMPZerrAJcK6kJQPsaD0CRK7B12B8tRCT+WlFSl7qW0zrwYwbUU1QCXljokL4a+d9+Iu oSrrgwK+cNM1XqONYaob1A7IHjNeAfrNgSh1W1UKV+RTVGtW8FCKOOZZksfq/01sSEb4 I6nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=d7fl0fThhSjhiBN90Kr8mMkxDJV0yAB+ftlc2k02ID4=; b=Zt3HAZFvTOfjymay4UnGVSdSdoxXaNNZCZV4ikz/Npn4MXG6si+FJIFz9Y36UmAb66 ypHsPjjCre0z8a0v+FFMGFshr1Y6k2UO/NbHCAfghFjEQVE8NjIX7gM4NRpPPvXE0hh6 BStSdCmQ0RcmHospggCSeazPg+QaCCSxUh9fHb4rOVhgqz+HdWikydw+uKngLR5bCHBj gj9oq3o1Qtarl5AyUysx6p37GH4CowG2BOjm1AP7Q36Y4ehLem4YtXBKrlnKy7/w4ifV 74ARrR33KkA/ehk8zfPOAJwII22kVj0QEO5RD/1Ze60CWVQRwbIMwSDNBs8CaohRyoAK U+Lg== X-Gm-Message-State: AOAM531Lz+5GZc9yyujig+3aL/WlQqmoOBmJtVnVDJc5PTYj376HcnfS ZgY+xddX1VFiG+iAorx88ZyANNi+ X-Google-Smtp-Source: ABdhPJzgjdAuRYNu288kB5cMxScJVBMg8nySw3oWF/i7vA7KbVUFG5ZmdAFeAuvGr9irQ/c/WnReZJoBdQ== X-Received: from fawn.svl.corp.google.com ([100.116.77.50]) (user=morbo job=sendgmr) by 2002:a25:468a:: with SMTP id t132mr26198019yba.312.1605912045665; Fri, 20 Nov 2020 14:40:45 -0800 (PST) Date: Fri, 20 Nov 2020 14:40:34 -0800 In-Reply-To: <20201120224034.191382-1-morbo@google.com> Message-Id: <20201120224034.191382-4-morbo@google.com> Mime-Version: 1.0 References: <20201118223513.2704722-1-morbo@google.com> <20201120224034.191382-1-morbo@google.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v3 3/3] powerpc/64s: feature: Work around inline asm issues From: Bill Wendling To: Michael Ellerman , linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers , Bill Wendling Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The clang toolchain treats inline assembly a bit differently than straight assembly code. In particular, inline assembly doesn't have the complete context available to resolve expressions. This is intentional to avoid divergence in the resulting assembly code. We can work around this issue by borrowing a workaround done for ARM, i.e. not directly testing the labels themselves, but by moving the current output pointer by a value that should always be zero. If this value is not null, then we will trigger a backward move, which is explicitly forbidden. Signed-off-by: Bill Wendling --- arch/powerpc/include/asm/feature-fixups.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h index b0af97add751..f81036518edb 100644 --- a/arch/powerpc/include/asm/feature-fixups.h +++ b/arch/powerpc/include/asm/feature-fixups.h @@ -36,6 +36,18 @@ label##2: \ .align 2; \ label##3: +/* + * If the .org directive fails, it means that the feature instructions + * are smaller than the alternate instructions. This used to be written + * as + * + * .ifgt (label##4b-label##3b) - (label##2b-label##1b) + * .error "Feature section else case larger than body" + * .endif + * + * but clang's assembler complains about the expression being non-absolute + * when the code appears in an inline assembly statement. + */ #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ label##4: \ .popsection; \ @@ -48,12 +60,9 @@ label##5: \ FTR_ENTRY_OFFSET label##2b-label##5b; \ FTR_ENTRY_OFFSET label##3b-label##5b; \ FTR_ENTRY_OFFSET label##4b-label##5b; \ - .ifgt (label##4b- label##3b)-(label##2b- label##1b); \ - .error "Feature section else case larger than body"; \ - .endif; \ + .org . - ((label##4b-label##3b) > (label##2b-label##1b)); \ .popsection; - /* CPU feature dependent sections */ #define BEGIN_FTR_SECTION_NESTED(label) START_FTR_SECTION(label) #define BEGIN_FTR_SECTION START_FTR_SECTION(97)