From patchwork Tue May 19 20:37:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1293754 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=PLdvq4oR; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 49RSQ55ph3z9sT4 for ; Wed, 20 May 2020 06:38:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA65E3897820; Tue, 19 May 2020 20:38:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA65E3897820 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589920694; bh=2Q/3nTceEZ391I3b3RhkysOOJWhmvQQyOS9vFP25wd4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=PLdvq4oR8FUN2VVGU1YuqASr7hUSS/ZK5/Sf3hHdDCQrbB1iW8Xi9qUdcewo0wrLI pPl1OXdLuaeaYntJFlJW++KJ8eJ7w7fBy2UrDhNu7UeYSCW3lTgVf6WfyMwSRkkM2J K9abOXdJHcY0C8EooQfD1XuNeSttp6O9xMnqBeBs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by sourceware.org (Postfix) with ESMTPS id CCAB53840C23 for ; Tue, 19 May 2020 20:38:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CCAB53840C23 Received: by mail-pj1-x1042.google.com with SMTP id t40so191731pjb.3 for ; Tue, 19 May 2020 13:38:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2Q/3nTceEZ391I3b3RhkysOOJWhmvQQyOS9vFP25wd4=; b=RioInTXmuqEzWw7/n5TQTAQk0vFMer9PqEp4AEMqKjO9Vi9k3R+iDEgyo26Db0p3M7 cPgQgQLLYT6y4TIt8dVR1MAmiAVVzF2/iGyt9V7tNrzl6TKuMuOex0Xv1aqGT7d+54QK PZ/eslkfra5gqT78iZWoOa5R+kBB7j/6RW4bH33sgV1YUY+8LAzXSOVFn8aVyQYv5J9E Vw13RzBkbP3McNM3WLPuyCBWz2ggMGvmsfkwO+5Bf9GRsrwMtXuQ9GYajDf6/NHgt6E5 0k0IZ+Loq44rvKaM2SUR1VNpUQ3/1m/xqfUo5NO92GUnLTLg1WUZaw2I8cCbtb9Wc75d 5JJg== X-Gm-Message-State: AOAM532q1kvSHG7F553T/tG92mzIKoD29pxJP+UdL4uwW2dYDVGQmSAA aQir/qPfnnyyEf4ohrNcQNVS+19/ X-Google-Smtp-Source: ABdhPJyMVXO8nBe+OaeipfZkt0PBUdQMKuKquNYxip990clEABRyRRIfoiuDBtuEKOBF1uIhPVKPMg== X-Received: by 2002:a17:902:8d8d:: with SMTP id v13mr1217653plo.67.1589920691460; Tue, 19 May 2020 13:38:11 -0700 (PDT) Received: from localhost (g216.222-224-245.ppp.wakwak.ne.jp. [222.224.245.216]) by smtp.gmail.com with ESMTPSA id jx10sm325067pjb.46.2020.05.19.13.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 13:38:10 -0700 (PDT) To: GCC patches Subject: [PATCH 1/5] or1k: Implement profile hook calling _mcount Date: Wed, 20 May 2020 05:37:46 +0900 Message-Id: <20200519203750.401593-2-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200519203750.401593-1-shorne@gmail.com> References: <20200519203750.401593-1-shorne@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Gcc-patches From: Stafford Horne Reply-To: Stafford Horne Cc: Openrisc Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Defining this to not abort as found when working on running tests in the glibc test suite. We implement this with a call to _mcount with no arguments. The required return address's will be pulled from the stack. Passing the LR (r9) as an argument had problems as sometimes r9 is clobbered by the GOT logic in the prologue before the call to _mcount. gcc/ChangeLog: * config/or1k/or1k.h (NO_PROFILE_COUNTERS): Define as 1. (PROFILE_HOOK): Define to call _mcount. (FUNCTION_PROFILER): Change from abort to no-op. --- gcc/config/or1k/or1k.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h index 23db771d8fb..be089900fd4 100644 --- a/gcc/config/or1k/or1k.h +++ b/gcc/config/or1k/or1k.h @@ -379,8 +379,19 @@ do { \ /* Always pass the SYMBOL_REF for direct calls to the expanders. */ #define NO_FUNCTION_CSE 1 -/* Profiling */ -#define FUNCTION_PROFILER(FILE,LABELNO) (abort (), 0) +#define NO_PROFILE_COUNTERS 1 + +/* Emit rtl for profiling. Output assembler code to call "_mcount" for + profiling a function entry. */ +#define PROFILE_HOOK(LABEL) \ + { \ + rtx fun; \ + fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount"); \ + emit_library_call (fun, LCT_NORMAL, VOIDmode); \ + } + +/* All the work is done in PROFILE_HOOK, but this is still required. */ +#define FUNCTION_PROFILER(STREAM, LABELNO) do { } while (0) /* Dwarf 2 Support */ #define DWARF2_DEBUGGING_INFO 1 From patchwork Tue May 19 20:37:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1293755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=PPNDGuEC; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 49RSQ83t7Wz9sT4 for ; Wed, 20 May 2020 06:38:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 55208393F850; Tue, 19 May 2020 20:38:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55208393F850 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589920698; bh=TTUFYwWDvOiJCsEUoawAAeSkrNPZW6mfc23MYkaJV30=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=PPNDGuECEDP7/yRQRT1ntoKNpbAyCsCZ05YOruIVqPje4BrbQ2yWjXj4P4J86nbwX izmxfonqFURFniAyZZeCPrCZAGS8gcnycRujhoTDgTwi0Ow0E+t+EpGNZQYaJBIRPV jV6Vniea5cOewLe+RaNzmcWta1+Ptp2L+sEzWOTY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by sourceware.org (Postfix) with ESMTPS id A4BD33840C23 for ; Tue, 19 May 2020 20:38:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A4BD33840C23 Received: by mail-pf1-x442.google.com with SMTP id y18so438359pfl.9 for ; Tue, 19 May 2020 13:38:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TTUFYwWDvOiJCsEUoawAAeSkrNPZW6mfc23MYkaJV30=; b=S5+GkGSvA9V+BbAk9RpeqjsM7TydQUGRG0U1xFfZzIAyaCQZ947Fq33YIv+UDc0wVc HqKOfDSRi2ugkOo5LbxtnYkE6oAasqauV9QWz/0xWaDxiitjJsqKZgbpavpVGv2XHqA6 Znk5nygsva2y9S1qv7f2iXiSMcy7d837iJScM4+xQnq1laOJOyiqGmUmHrS39g3ylSAd +rv555vzaHwA+pntWMI3Se9RuCkkEB3L6RfCbJLphqul2cEEREVR5aJ/djAe/9YC8Brl JSXHX04eAhop+t/jiUHUoiq0u9DKtU80V51tg3FvQWrnYAHrUDHQ8JQ4jx6bnxvUx5ex UvfQ== X-Gm-Message-State: AOAM531HNJ4KarHl81x2fD7LFxj/m3Tla1j2jUw+b/qCCqkxitj/ewbD mUphPH5tHihgz5HEMlx34RVcgIN2 X-Google-Smtp-Source: ABdhPJyagXQbDCS7D5qNOMHIoTrI37TLAGcDmruP959RAHC2VQga9DE379E79rk1KcSj926Cb2HX0g== X-Received: by 2002:aa7:85da:: with SMTP id z26mr844925pfn.25.1589920694461; Tue, 19 May 2020 13:38:14 -0700 (PDT) Received: from localhost (g216.222-224-245.ppp.wakwak.ne.jp. [222.224.245.216]) by smtp.gmail.com with ESMTPSA id w7sm296734pfw.82.2020.05.19.13.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 13:38:13 -0700 (PDT) To: GCC patches Subject: [PATCH 2/5] or1k: Add builtin define to detect hard float Date: Wed, 20 May 2020 05:37:47 +0900 Message-Id: <20200519203750.401593-3-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200519203750.401593-1-shorne@gmail.com> References: <20200519203750.401593-1-shorne@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Gcc-patches From: Stafford Horne Reply-To: Stafford Horne Cc: Openrisc Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This is used in libgcc and now glibc to detect when hardware floating point operations are supported by the target. gcc/ChangeLog: * config/or1k/or1k.h (TARGET_CPU_CPP_BUILTINS): Add builtin define for __or1k_hard_float__. --- gcc/config/or1k/or1k.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h index be089900fd4..0d6fed5f4ca 100644 --- a/gcc/config/or1k/or1k.h +++ b/gcc/config/or1k/or1k.h @@ -30,6 +30,8 @@ builtin_define ("__or1k__"); \ if (TARGET_CMOV) \ builtin_define ("__or1k_cmov__"); \ + if (TARGET_HARD_FLOAT) \ + builtin_define ("__or1k_hard_float__"); \ builtin_assert ("cpu=or1k"); \ builtin_assert ("machine=or1k"); \ } \ From patchwork Tue May 19 20:37:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1293756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=h1yZxzck; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 49RSQF0V8sz9sT3 for ; Wed, 20 May 2020 06:38:29 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6D3A1394C005; Tue, 19 May 2020 20:38:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D3A1394C005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589920701; bh=QHZ8NJ9g0fmCcb+/vfv0FRgPQRQYCW/QUBmwtXWAVoQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=h1yZxzckXaERE3e/PYHXzlDnfPXm5bkR+p3kUIvKCzSoWvLzuITcsWHZgEiCg5zkP 2g9c658sa2D/Sb4b1+cJ4qiVjmkST4XxJ1GrkKrGcPVTBi6wZ3p6iV9iCzToPWWOpb 0amgtLdiHOeaF4gnZzRMFgnORpmNtFbC7ud5d1nM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by sourceware.org (Postfix) with ESMTPS id 14E1D394C005 for ; Tue, 19 May 2020 20:38:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 14E1D394C005 Received: by mail-pl1-x644.google.com with SMTP id d3so375980pln.1 for ; Tue, 19 May 2020 13:38:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QHZ8NJ9g0fmCcb+/vfv0FRgPQRQYCW/QUBmwtXWAVoQ=; b=WLXTh1LK0Vud16/InyJ2fohiuuNSSeYnaEh/G1A/VIJSKJz40iovHUBb+Hz67QvEAw ig/aKzWWWT3IIvKT4B4lZvTTc6GJ6eUU8fYYywpbQfV/YmoojVKYY/UoCluhLKkseWYi f/q8WkeJHMQvFI4pnPDGAVsjzWPb3/JPk1oQwV7xRVB9XyWIdAuN+oXoO9xKslm26eh3 Bbn+SeC5ki9CS7ntWfHQAijmfQQlgY1Sm7oJOwL1+BTSYeO9DI4fciEF9tNGCFKapIgY 34EAf+3I/OwPrhfE8/yYisU9H1BwA3CoqppDEGYCnoqSljN2vHN8YfTSFCi36YVc8iJ0 q1AQ== X-Gm-Message-State: AOAM533p5fijXWwOYxkOFe2SsDqWFI1YYZ3hCJWvui87PVWHwYCNP9lj nvhr5gsVttaZDwZ+GSK0JKIwVNJE X-Google-Smtp-Source: ABdhPJyg/cFxQqPp5wUsNTfdnOK2AVGHEQcupeiS1B7iZt6AD9y2MrgPvUX/u+53NWvkpNFL0zO9MA== X-Received: by 2002:a17:902:b405:: with SMTP id x5mr1106585plr.31.1589920697814; Tue, 19 May 2020 13:38:17 -0700 (PDT) Received: from localhost (g216.222-224-245.ppp.wakwak.ne.jp. [222.224.245.216]) by smtp.gmail.com with ESMTPSA id w69sm301332pff.168.2020.05.19.13.38.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 13:38:16 -0700 (PDT) To: GCC patches Subject: [PATCH 3/5] or1k: Support for softfloat to emulate hw exceptions Date: Wed, 20 May 2020 05:37:48 +0900 Message-Id: <20200519203750.401593-4-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200519203750.401593-1-shorne@gmail.com> References: <20200519203750.401593-1-shorne@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Gcc-patches From: Stafford Horne Reply-To: Stafford Horne Cc: Openrisc Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This allows the openrisc softfloat implementation to set exceptions. This also sets the correct tininess after rounding value to be consistent with hardware and simulator implementations. libgcc/ChangeLog: * config/or1k/sfp-machine.h (FP_RND_NEAREST, FP_RND_ZERO, FP_RND_PINF, FP_RND_MINF, FP_RND_MASK, FP_EX_OVERFLOW, FP_EX_UNDERFLOW, FP_EX_INEXACT, FP_EX_INVALID, FP_EX_DIVZERO, FP_EX_ALL): New constant macros. (_FP_DECL_EX, FP_ROUNDMODE, FP_INIT_ROUNDMODE, FP_HANDLE_EXCEPTIONS): New macros. (_FP_TININESS_AFTER_ROUNDING): Change to 1. --- libgcc/config/or1k/sfp-machine.h | 41 +++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/libgcc/config/or1k/sfp-machine.h b/libgcc/config/or1k/sfp-machine.h index 5da9e84990d..eebe5b0578e 100644 --- a/libgcc/config/or1k/sfp-machine.h +++ b/libgcc/config/or1k/sfp-machine.h @@ -41,12 +41,51 @@ R##_c = FP_CLS_NAN; \ } while (0) +/* Handle getting and setting rounding mode for soft fp operations. */ + +#define FP_RND_NEAREST (0x0 << 1) +#define FP_RND_ZERO (0x1 << 1) +#define FP_RND_PINF (0x2 << 1) +#define FP_RND_MINF (0x3 << 1) +#define FP_RND_MASK (0x3 << 1) + +#define FP_EX_OVERFLOW 1 << 3 +#define FP_EX_UNDERFLOW 1 << 4 +#define FP_EX_INEXACT 1 << 8 +#define FP_EX_INVALID 1 << 9 +#define FP_EX_DIVZERO 1 << 11 +#define FP_EX_ALL \ + (FP_EX_INVALID | FP_EX_DIVZERO | FP_EX_OVERFLOW | FP_EX_UNDERFLOW \ + | FP_EX_INEXACT) + +#define _FP_DECL_EX \ + unsigned int _fpcsr __attribute__ ((unused)) = FP_RND_NEAREST + +#define FP_ROUNDMODE (_fpcsr & FP_RND_MASK) + +#ifdef __or1k_hard_float__ +#define FP_INIT_ROUNDMODE \ +do { \ + __asm__ volatile ("l.mfspr %0,r0,20" : "=r" (_fpcsr)); \ +} while (0) + +#define FP_HANDLE_EXCEPTIONS \ +do { \ + if (__builtin_expect (_fex, 0)) \ + { \ + _fpcsr &= ~FP_EX_ALL; \ + _fpcsr |= _fex; \ + __asm__ volatile ("l.mtspr r0,%0,20" : : "r" (_fpcsr)); \ + } \ +} while (0) +#endif + #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #define __BYTE_ORDER __BIG_ENDIAN -#define _FP_TININESS_AFTER_ROUNDING 0 +#define _FP_TININESS_AFTER_ROUNDING 1 /* Define ALIASNAME as a strong alias for NAME. */ # define strong_alias(name, aliasname) _strong_alias(name, aliasname) From patchwork Tue May 19 20:37:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1293757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=iWtC4hAN; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 49RSQK2H1jz9sT3 for ; Wed, 20 May 2020 06:38:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 09013393BC2A; Tue, 19 May 2020 20:38:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09013393BC2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589920705; bh=3GhgA5JXTcYl1x/8KyqIEVFscg5nAasjIcBUCad7ahc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=iWtC4hANaWc5V8p3MszE145LF5kRkR8hu2KPvd0AzeCZ2vrc972xQ43UtqGXvWzhE Jq5TfFKoTJsfZGJPwR3RuVdNIttCn/zYw1yNds6FP1Moe6jpC6FsVO3bBmq+ki9G8N gczspIbr+4IyU4rBvERkpSkqEvPIIDnRAVwep8vY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by sourceware.org (Postfix) with ESMTPS id 92706395445A for ; Tue, 19 May 2020 20:38:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 92706395445A Received: by mail-pl1-x643.google.com with SMTP id k19so360979pll.9 for ; Tue, 19 May 2020 13:38:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3GhgA5JXTcYl1x/8KyqIEVFscg5nAasjIcBUCad7ahc=; b=eHpowjP6WRVg8XEMsl+CsYtMu7wkQESVlzCqUthaRtd3gz+R6RfPiT1IoiEL6ne6BT LTgaZrgggM+6MJkL+WOsgyLs0E/lhZAIWtBAXw0/lNe5wQh43WBTtkD3qaDm8WWoP7tR 3r1CgPp+hpDgbx3v96kL1Ge3AnxRl1nlvNft2Uagn18XIWXycEsCueX0Ujk7gFsJvLt3 vwnlO/in5tctz4mL4P+t7I0f5157mpc/OSMNx81k0lHIrHyN4yToo5EdIPFRLZNmf+um +WI/cNj32B5TFhFw9jfcWb4oXqzGTfQhL7AZ95hfYfbHukh4dHEUyDcyHRT05dh6ZQnN +lzA== X-Gm-Message-State: AOAM531GHS4w5SmHeEkRY35t31J1Hebg2CnMXtcSatSIRc8rro6+EZQI jmhHkkZ0KnkW9hbAPPuoKoOqL+Nc X-Google-Smtp-Source: ABdhPJyQj70vMaVQLaFacH0yNUatyGG6L1LpFjdkEpuqLF3yxi1AwT0xL+m+PypBOHP/qeAD2CM4Dg== X-Received: by 2002:a17:902:14f:: with SMTP id 73mr1229173plb.86.1589920701375; Tue, 19 May 2020 13:38:21 -0700 (PDT) Received: from localhost (g216.222-224-245.ppp.wakwak.ne.jp. [222.224.245.216]) by smtp.gmail.com with ESMTPSA id u45sm336933pjb.7.2020.05.19.13.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 13:38:20 -0700 (PDT) To: GCC patches Subject: [PATCH 4/5] or1k: Add note to indicate execstack Date: Wed, 20 May 2020 05:37:49 +0900 Message-Id: <20200519203750.401593-5-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200519203750.401593-1-shorne@gmail.com> References: <20200519203750.401593-1-shorne@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Gcc-patches From: Stafford Horne Reply-To: Stafford Horne Cc: Openrisc Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Define TARGET_ASM_FILE_END as file_end_indicate_exec_stack to allow generation of the ".note.GNU-stack" section note. This allows binutils to properly set PT_GNU_STACK in the program header. This fixes a glibc execstack testsuite test failure found while working on the OpenRISC glibc port. gcc/ChangeLog: * config/or1k/linux.h (TARGET_ASM_FILE_END): Define macro. --- gcc/config/or1k/linux.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/config/or1k/linux.h b/gcc/config/or1k/linux.h index 21cef067dda..8693e884e2a 100644 --- a/gcc/config/or1k/linux.h +++ b/gcc/config/or1k/linux.h @@ -42,4 +42,6 @@ %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}} \ %{static-pie:-Bstatic -pie --no-dynamic-linker -z text}" +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack + #endif /* GCC_OR1K_LINUX_H */ From patchwork Tue May 19 20:37:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1293758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=a+SDkgST; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 49RSQP2Ytfz9sT3 for ; Wed, 20 May 2020 06:38:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 954593954C07; Tue, 19 May 2020 20:38:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 954593954C07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589920707; bh=1eS04HQIrseje/Q4T6o8uHgDrYxqZKme96HxdkpBXa4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=a+SDkgSTQjAp207i8F3NVvZiFnSzPmLI5CgDy1R/BwmdZPHtE9OoQVpL+ca/382ZF Nzdw99c+V78ZmYruZvLtA8nmfZBMwfNQaqym0fl60SIrxoX06sySc0bDCuTGNWDs9t g4TnUb3fIM8YuyolhduwjQ3PXrlLqP+oxj+Fntns= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by sourceware.org (Postfix) with ESMTPS id 87CE43894E6A for ; Tue, 19 May 2020 20:38:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 87CE43894E6A Received: by mail-pf1-x443.google.com with SMTP id y18so438567pfl.9 for ; Tue, 19 May 2020 13:38:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1eS04HQIrseje/Q4T6o8uHgDrYxqZKme96HxdkpBXa4=; b=j7c4JTws8Nt8JREMFyJdYux5NP6obnEGWU8U50vXkibsJNSAkRfgUJGx9L0nZCCGJB 5d9PM4cqvo0F9drilKJXvD95HuFDUrMpgd3LfboyHea2cLcOx92jiuQaT+SB47J3bkFk S29dkWWlxZtpoZ14NcBkABt5nESyU+7f0urhV5kT8SpVmMO3tKqAtudIyWiHIIRw5NXl QeXydZFXniBi0fTbLliuZhUP4O7+7pKcKcE10Urx/SyTUCMtUUePVUyDoembmu8QKxcS 2T5XcgH1YIluf7z1OhPbWCM0qD9MTlcBd59zn6ZxVOlSB/4nMXUStBVinpSfQ9PlO8gR WK7g== X-Gm-Message-State: AOAM531+3gf/mxHP9qeQkxPsj3i/i7Ys603d7ydwRKuGt780zoBgYXK1 bU4PFHgQYXYT2jnSXDd/Oy+XuuNC X-Google-Smtp-Source: ABdhPJzXtVcvvi+QZNY4+c4tQolyJJbB0rLBt8tUwady0uW+SQtRQn/w8eS3GGpklG+i/hbA4yFEoQ== X-Received: by 2002:a63:f958:: with SMTP id q24mr931203pgk.338.1589920704353; Tue, 19 May 2020 13:38:24 -0700 (PDT) Received: from localhost (g216.222-224-245.ppp.wakwak.ne.jp. [222.224.245.216]) by smtp.gmail.com with ESMTPSA id h17sm313111pfr.25.2020.05.19.13.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 13:38:23 -0700 (PDT) To: GCC patches Subject: [PATCH 5/5] or1k: Fixup exception header data encodings Date: Wed, 20 May 2020 05:37:50 +0900 Message-Id: <20200519203750.401593-6-shorne@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200519203750.401593-1-shorne@gmail.com> References: <20200519203750.401593-1-shorne@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Gcc-patches From: Stafford Horne Reply-To: Stafford Horne Cc: Openrisc Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" While running glibc tests several *-textrel tests failed showing that relocations remained against read only sections. It turned out this was related to exception headers data encoding being wrong. By default pointer encoding will always use the DW_EH_PE_absptr format. This patch uses format DW_EH_PE_pcrel and DW_EH_PE_sdata4. Optionally DW_EH_PE_indirect is included for global symbols. This eliminates the relocations. gcc/ChangeLog: * config/or1k/or1k.h (ASM_PREFERRED_EH_DATA_FORMAT): New macro. --- gcc/config/or1k/or1k.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h index 0d6fed5f4ca..2fe62f0b90c 100644 --- a/gcc/config/or1k/or1k.h +++ b/gcc/config/or1k/or1k.h @@ -408,4 +408,8 @@ do { \ ((N) < 4 ? HW_TO_GCC_REGNO (25) + (N) : INVALID_REGNUM) #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, EH_RETURN_REGNUM) +/* Select a format to encode pointers in exception handling data. */ +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ + (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) + #endif /* GCC_OR1K_H */