From patchwork Wed Aug 14 21:36:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jose E. Marchesi" X-Patchwork-Id: 1147241 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-506984-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="UAJSXSWf"; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="VzHBXTlK"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4682x42s3vz9s3Z for ; Thu, 15 Aug 2019 07:37:28 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=QxYwU5TMHLmWAjtG1ijDXpOjs4281x2lEGLyPJf/I2DbZHFv7R0fM IFfMF9QjMxr/3h/K+vhGmpmY13TXtf6J6iOngI1fu8PaBDjTwo4N1bSgE5KzntUM /jwfNl9+73iTcE0Lgrt3k4cFowsjABOzO55iZtrFiLRM/xexln9mgI= 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:from :to:subject:date:message-id:in-reply-to:references; s=default; bh=tWXNcBxJdfmi+TzpxWkXNbf+GAU=; b=UAJSXSWf7xZRVMBEq1sxLrGtFZWM s7RaOEPbiM8ZuprkHxACFVhGhlRqGb2yffySEsCWN2d2foGpSN8FYSmdivC+YcTQ TFybN7EJS7K0a9WjRDMrGysLFNORkBQTn76ZiCpKoCMFfA0kQlUo6akC3yyzF43g +fyzsca7hG6Zm2Q= Received: (qmail 83381 invoked by alias); 14 Aug 2019 21:37:07 -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 83331 invoked by uid 89); 14 Aug 2019 21:37:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy=UD:host, peculiar, t X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Aug 2019 21:37:05 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7ELYCvw091765 for ; Wed, 14 Aug 2019 21:37:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=codWRFRRqGawQHxJ1hpm9bdSDut6MlDg1pwrw5odYbM=; b=VzHBXTlKRUje8u17lrsEDBbUwJ1qqdpqbQzasn7cVpXeENJREa/746G1tvhbSVFw7V1E tRqSjks6T2kUu5wt8cs0lp6nw0zPex572ap8UUeQdJgaDvmjMV01MdlPF16LYSNkVYYt U6t+UGdKav1zTG1cFTJo0NmvVYnoaquXQxy3Bkh2U8+vnLIg8y9NSnPN3AGmu7l2tGtZ 9U8EQKiUi1stHZLyX8mL73DlWSBM1Ie+Y8/ndX0nx2OLuBq4coJJ8KW8OnrKCxrnw3Np i15WkZedqm+uYQoFIm2wbCLZPEfMw6RP2hGqe3sMEF+lmcspf3eauQ4zyXn5fJ8TohmB nw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2u9pjqq8x4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 14 Aug 2019 21:37:03 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7ELSIP4122420 for ; Wed, 14 Aug 2019 21:37:03 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2ucmwhx5mn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 14 Aug 2019 21:37:03 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7ELb2uw028924 for ; Wed, 14 Aug 2019 21:37:02 GMT Received: from termi.localdomain (/10.175.39.187) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 Aug 2019 14:37:01 -0700 From: "Jose E. Marchesi" To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/8] bpf: new libgcc port Date: Wed, 14 Aug 2019 23:36:46 +0200 Message-Id: <20190814213651.20286-4-jose.marchesi@oracle.com> In-Reply-To: <20190814213651.20286-1-jose.marchesi@oracle.com> References: <20190814213651.20286-1-jose.marchesi@oracle.com> X-IsSubscribed: yes This patch adds an eBPF port to libgcc. As of today, compiled eBPF programs do not support a single-entry point schema. Instead, a BPF "executable" is a relocatable ELF object file containing multiple entry points, in certain named sections. Also, the BPF loaders in the kernel do not execute .ini/.fini constructors/destructors. Therefore, this patch provides empty crtn.S and cri.S files. libgcc/ChangeLog: * config.host: Set cpu_type for bpf-*-* targets. * config/bpf/t-bpf: Likewise. * config/bpf/crtn.S: Likewise. * config/bpf/crti.S: New file. --- libgcc/ChangeLog | 7 +++++++ libgcc/config.host | 7 +++++++ libgcc/config/bpf/crti.S | 0 libgcc/config/bpf/crtn.S | 0 libgcc/config/bpf/t-bpf | 24 ++++++++++++++++++++++++ 5 files changed, 38 insertions(+) create mode 100644 libgcc/config/bpf/crti.S create mode 100644 libgcc/config/bpf/crtn.S create mode 100644 libgcc/config/bpf/t-bpf diff --git a/libgcc/config.host b/libgcc/config.host index 503ebb6be20..2e9fbc35482 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -107,6 +107,9 @@ avr-*-*) bfin*-*) cpu_type=bfin ;; +bpf-*-*) + cpu_type=bpf + ;; cr16-*-*) ;; crisv32-*-*) @@ -526,6 +529,10 @@ bfin*-*) tmake_file="$tmake_file bfin/t-bfin t-fdpbit" extra_parts="crtbegin.o crtend.o crti.o crtn.o" ;; +bpf-*-*) + tmake_file="$tmake_file ${cpu_type}/t-${cpu_type}" + extra_parts="crti.o crtn.o" + ;; cr16-*-elf) tmake_file="${tmake_file} cr16/t-cr16 cr16/t-crtlibid t-fdpbit" extra_parts="$extra_parts crti.o crtn.o crtlibid.o" diff --git a/libgcc/config/bpf/crti.S b/libgcc/config/bpf/crti.S new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libgcc/config/bpf/crtn.S b/libgcc/config/bpf/crtn.S new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libgcc/config/bpf/t-bpf b/libgcc/config/bpf/t-bpf new file mode 100644 index 00000000000..c1bda7c98cb --- /dev/null +++ b/libgcc/config/bpf/t-bpf @@ -0,0 +1,24 @@ +HOST_LIBGCC2_CFLAGS += -O0 +LIB2ADDEH = + +crti.o: $(srcdir)/config/bpf/crti.S + $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< + +crtn.o: $(srcdir)/config/bpf/crtn.S + $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< + +# Some of the functions defined in libgcc2 exceed the eBPF stack +# limit, or other restrictions imposed by this peculiar target. +# Therefore we have to exclude them here. +# +# Patterns in bpf.md must guarantee that no calls to the excluded +# functions are ever generated, and compiler tests should make sure +# this holds. +# +# Note that the modes in the function names below are misleading: di +# means TImode. +LIB2FUNCS_EXCLUDE = _mulvdi3 _divdi3 _moddi3 _divmoddi4 _udivdi3 _umoddi3 \ + _udivmoddi4 + +# Prevent building "advanced" stuff (for example, gcov support). +INHIBIT_LIBC_CFLAGS = -Dinhibit_libc