From patchwork Tue Aug 9 09:41:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 1664834 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4M27PV3WH2z9s5W for ; Tue, 9 Aug 2022 19:41:34 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id BBE5B409EE; Tue, 9 Aug 2022 09:41:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BBE5B409EE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lvfwqqSp0cao; Tue, 9 Aug 2022 09:41:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 4328E40996; Tue, 9 Aug 2022 09:41:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4328E40996 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BDBBA1BF5EA for ; Tue, 9 Aug 2022 09:41:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9945A40576 for ; Tue, 9 Aug 2022 09:41:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9945A40576 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id koXdRynWg5Cb for ; Tue, 9 Aug 2022 09:41:25 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 91F4340151 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by smtp2.osuosl.org (Postfix) with ESMTPS id 91F4340151 for ; Tue, 9 Aug 2022 09:41:25 +0000 (UTC) Received: by mail-oi1-x232.google.com with SMTP id p132so13186106oif.9 for ; Tue, 09 Aug 2022 02:41:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=BnYyvuYeQAp5G5OOeg5yITwouNvR1QBZlXWkLN8yuXA=; b=UBc9PThv0jUI8EASgVKV0aPI6b1R8x8i1oq6ACeYs7n2/Q7TJ5L2sRt32vWYnjLIFK B1OPJu9KItypretr3ZRtHOXo+KqBiN9ZZuLrIaiEDToC9kP25J5Ts7fa5dfJhKVKVmyX K3bIYqk1fFcaG+pqWYi3SHusLI8zGZoQcih5rgpaJsPTRKKi859nAexoXHGZ0WfyI4F4 sZSg1Mw1EaRjO8695+ZOwaHGRov7pghEbHD04mcGIcI0UctzLwKY5lV3SqA5/IkGlVvK nbY4RBhlcCHYyhmhR524qFuf28rN8FkKQaCCTwWQ7n0OiTWEnhiInJwgrWtDYVzVSd68 +vBA== X-Gm-Message-State: ACgBeo3tuuHDfTENs+UOc5WhqlwDQUvxyu7lliDq0bY1xYdppkp5UGvl hFLAVYkzw1Z01xnZNBsjT8YCKyvicls= X-Google-Smtp-Source: AA6agR7dDEkUeoZHSMzF4EcRNk3P48klnyGEc+0B2HrCeHnIZ04kWoJM2+6vXpP9bzX3MrQ1zebMLg== X-Received: by 2002:a05:6808:643:b0:343:1207:b0b7 with SMTP id z3-20020a056808064300b003431207b0b7mr869133oih.97.1660038083954; Tue, 09 Aug 2022 02:41:23 -0700 (PDT) Received: from james-x399.localdomain (71-33-138-207.hlrn.qwest.net. [71.33.138.207]) by smtp.gmail.com with ESMTPSA id t2-20020a0568301e2200b00636ff7d2cc7sm826508otr.79.2022.08.09.02.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 02:41:22 -0700 (PDT) From: James Hilliard To: buildroot@buildroot.org Date: Tue, 9 Aug 2022 03:41:08 -0600 Message-Id: <20220809094109.2279598-1-james.hilliard1@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=BnYyvuYeQAp5G5OOeg5yITwouNvR1QBZlXWkLN8yuXA=; b=KFOIJGGyvw5JMTRH5TwZ8/o6klAU8kbXWg8LDrZkeVVSVRTfjzvwqd5/LTVgwtVhUG 5IX5U5+erYuVhg4MmALEzwIolXcfVsItJqjsNacOTnpkstmyzjnmKWpEkMzaSCOIV9hy G26DvtATTKjT8Mq3hMx76H1R1J49aQ6eVYJi9Nc3iINtTpXgyk7Q0U9sjKqqAvaI09KR 1tehUqj6Jyvedh9RwjluoQPIK/X4ZeRvh6R6WjMY0LtLO6eklltyVITKd+WTx47/J2/Z xFdZ8/DuW8TQM0OkQyrBPlsdkkjUDr4opuAEowo67fTf1eak5UEkkkLdTSALVGbrUE2k eMiw== X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=KFOIJGGy Subject: [Buildroot] [PATCH 1/2] package/gcc/gcc-bpf: add BPF target support X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jose E . Marchesi" , David Faust , James Hilliard , Thomas Petazzoni , Giulio Benetti , Romain Naour , Thomas De Schampheleire Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" This adds GCC BPF target support, however unlike traditional targets the BPF target is effectively used by packages such as systemd as a separate language rather than an entirely separate architecture. As such we need to build what is effectively a multi-arch toolchain for GCC BPF support, as the BPF target is effectively a bare metal target this isn't the same as a multi-lib toolchain and generally avoids library conflict issues as the BPF target does not have userspace libraries. This adds an additional gcc build stage which is similar to gcc-final and added as a toolchain dependency when BPF target support is enabled. Similar to our gcc toolchain we also need a toolchain wrapper, this is separate from our normal toolchain wrapper. Cc: Jose E. Marchesi Cc: David Faust Signed-off-by: James Hilliard --- package/Makefile.in | 3 + package/gcc/Config.in.host | 12 ++ package/gcc/gcc-bpf/gcc-bpf.hash | 1 + package/gcc/gcc-bpf/gcc-bpf.mk | 116 ++++++++++++++++++ .../toolchain-buildroot.mk | 4 + 5 files changed, 136 insertions(+) create mode 120000 package/gcc/gcc-bpf/gcc-bpf.hash create mode 100644 package/gcc/gcc-bpf/gcc-bpf.mk diff --git a/package/Makefile.in b/package/Makefile.in index ff60f85092..a6f5292903 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -39,6 +39,9 @@ endif # Compute GNU_TARGET_NAME GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI) +# Compute BPF_TARGET_NAME +BPF_TARGET_NAME = bpf-$(TARGET_VENDOR)-none + # FLAT binary format needs uclinux, except RISC-V 64-bits which needs # the regular linux name. ifeq ($(BR2_BINFMT_FLAT):$(BR2_RISCV_64),y:) diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host index ba2a2ee072..c49f6e6b26 100644 --- a/package/gcc/Config.in.host +++ b/package/gcc/Config.in.host @@ -60,6 +60,10 @@ config BR2_GCC_VERSION_12_X endchoice +config BR2_GCC_SUPPORTS_BPF + bool + default y if BR2_TOOLCHAIN_GCC_AT_LEAST_12 + # libcilkrts was introduced in gcc 4.9 and removed in gcc 8.x config BR2_GCC_SUPPORTS_LIBCILKRTS bool @@ -94,6 +98,14 @@ config BR2_EXTRA_GCC_CONFIG_OPTIONS include. Those options are applied for all of the gcc initial, gcc intermediate and gcc final passes. +config BR2_TOOLCHAIN_BUILDROOT_BPF + bool "Enable bpf support" + depends on BR2_GCC_SUPPORTS_BPF + depends on BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_BPF + help + Enable this option if you want your toolchain to support BPF + targets. + config BR2_TOOLCHAIN_BUILDROOT_CXX bool "Enable C++ support" select BR2_INSTALL_LIBSTDCPP diff --git a/package/gcc/gcc-bpf/gcc-bpf.hash b/package/gcc/gcc-bpf/gcc-bpf.hash new file mode 120000 index 0000000000..7ac9361ab2 --- /dev/null +++ b/package/gcc/gcc-bpf/gcc-bpf.hash @@ -0,0 +1 @@ +../gcc.hash \ No newline at end of file diff --git a/package/gcc/gcc-bpf/gcc-bpf.mk b/package/gcc/gcc-bpf/gcc-bpf.mk new file mode 100644 index 0000000000..b12d27ad00 --- /dev/null +++ b/package/gcc/gcc-bpf/gcc-bpf.mk @@ -0,0 +1,116 @@ +################################################################################ +# +# gcc-bpf +# +################################################################################ + +GCC_BPF_VERSION = $(GCC_VERSION) +GCC_BPF_SITE = $(GCC_SITE) +GCC_BPF_SOURCE = $(GCC_SOURCE) + +HOST_GCC_BPF_DL_SUBDIR = gcc + +HOST_GCC_BPF_DEPENDENCIES = \ + $(HOST_GCC_COMMON_DEPENDENCIES) \ + $(BR_LIBC) + +HOST_GCC_BPF_EXCLUDES = $(HOST_GCC_EXCLUDES) + +HOST_GCC_BPF_POST_PATCH_HOOKS += HOST_GCC_APPLY_PATCHES + +# gcc doesn't support in-tree build, so we create a 'build' +# subdirectory in the gcc sources, and build from there. +HOST_GCC_BPF_SUBDIR = build + +HOST_GCC_BPF_PRE_CONFIGURE_HOOKS += HOST_GCC_CONFIGURE_SYMLINK + +HOST_GCC_BPF_CONF_OPTS = \ + --target=$(BPF_TARGET_NAME) \ + --prefix="$(HOST_DIR)" \ + --sysconfdir="$(HOST_DIR)/etc" \ + --enable-languages=c \ + --with-gnu-ld \ + --enable-static \ + --disable-decimal-float \ + --disable-gcov \ + --disable-libssp \ + --disable-multilib \ + --disable-shared \ + --with-gmp=$(HOST_DIR) \ + --with-mpc=$(HOST_DIR) \ + --with-mpfr=$(HOST_DIR) \ + --with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \ + --with-bugurl="http://bugs.buildroot.net/" \ + --without-zstd \ + $(call qstrip,$(BR2_EXTRA_GCC_CONFIG_OPTIONS)) + +ifeq ($(BR2_GCC_ENABLE_GRAPHITE),y) +HOST_GCC_BPF_DEPENDENCIES += host-isl +HOST_GCC_BPF_CONF_OPTS += --with-isl=$(HOST_DIR) +else +HOST_GCC_BPF_CONF_OPTS += --without-isl --without-cloog +endif + +# Don't build documentation. It takes up extra space / build time, +# and sometimes needs specific makeinfo versions to work +HOST_GCC_BPF_CONF_ENV = \ + MAKEINFO=missing + +# Make sure we have 'cc' +define HOST_GCC_BPF_CREATE_CC_SYMLINKS + if [ ! -e $(HOST_DIR)/bin/$(BPF_TARGET_NAME)-cc ]; then \ + ln -f $(HOST_DIR)/bin/$(BPF_TARGET_NAME)-gcc \ + $(HOST_DIR)/bin/$(BPF_TARGET_NAME)-cc; \ + fi +endef + +HOST_GCC_BPF_POST_INSTALL_HOOKS += HOST_GCC_BPF_CREATE_CC_SYMLINKS + +HOST_GCC_BPF_MAKE_OPTS = $(HOST_GCC_COMMON_MAKE_OPTS) all-gcc all-target-libgcc +HOST_GCC_BPF_INSTALL_OPTS = install-gcc install-target-libgcc + +HOST_GCC_BPF_TOOLCHAIN_WRAPPER_ARGS = -DBR_SYSROOT='"$(STAGING_SUBDIR)"' +HOST_GCC_BPF_TOOLCHAIN_WRAPPER_ARGS += $(HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS) + +define HOST_GCC_BPF_TOOLCHAIN_WRAPPER_BUILD + $(HOSTCC) $(HOST_CFLAGS) $(HOST_GCC_BPF_TOOLCHAIN_WRAPPER_ARGS) \ + -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \ + toolchain/toolchain-wrapper.c \ + -o $(@D)/toolchain-wrapper-bpf +endef + +define HOST_GCC_BPF_TOOLCHAIN_WRAPPER_INSTALL + $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper-bpf \ + $(HOST_DIR)/bin/toolchain-wrapper-bpf +endef + +HOST_GCC_BPF_POST_BUILD_HOOKS += HOST_GCC_BPF_TOOLCHAIN_WRAPPER_BUILD +HOST_GCC_BPF_POST_INSTALL_HOOKS += HOST_GCC_BPF_TOOLCHAIN_WRAPPER_INSTALL + +define HOST_GCC_BPF_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS + $(Q)cd $(HOST_DIR)/bin; \ + for i in $(BPF_TARGET_NAME)-*; do \ + case "$$i" in \ + *.br_real) \ + ;; \ + *-ar|*-ranlib|*-nm) \ + ln -snf $$i bpf$${i##$(BPF_TARGET_NAME)}; \ + ;; \ + *cc|*cc-*|*++|*++-*|*cpp|*-gfortran|*-gdc) \ + rm -f $$i.br_real; \ + mv $$i $$i.br_real; \ + ln -sf toolchain-wrapper-bpf $$i; \ + ln -sf toolchain-wrapper-bpf bpf$${i##$(BPF_TARGET_NAME)}; \ + ln -snf $$i.br_real bpf$${i##$(BPF_TARGET_NAME)}.br_real; \ + ;; \ + *) \ + ln -snf $$i bpf$${i##$(BPF_TARGET_NAME)}; \ + ;; \ + esac; \ + done + +endef + +HOST_GCC_BPF_POST_INSTALL_HOOKS += HOST_GCC_BPF_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS + +$(eval $(host-autotools-package)) diff --git a/toolchain/toolchain-buildroot/toolchain-buildroot.mk b/toolchain/toolchain-buildroot/toolchain-buildroot.mk index b30cc332d2..34e7e49a5f 100644 --- a/toolchain/toolchain-buildroot/toolchain-buildroot.mk +++ b/toolchain/toolchain-buildroot/toolchain-buildroot.mk @@ -12,6 +12,10 @@ BR_LIBC = $(call qstrip,$(BR2_TOOLCHAIN_BUILDROOT_LIBC)) TOOLCHAIN_BUILDROOT_DEPENDENCIES = host-gcc-final +ifeq ($(BR2_TOOLCHAIN_BUILDROOT_BPF),y) +TOOLCHAIN_BUILDROOT_DEPENDENCIES += host-gcc-bpf +endif + TOOLCHAIN_BUILDROOT_ADD_TOOLCHAIN_DEPENDENCY = NO $(eval $(virtual-package)) From patchwork Tue Aug 9 09:41:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 1664835 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4M27Pk5Jgwz9s5W for ; Tue, 9 Aug 2022 19:41:46 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D824F81882; Tue, 9 Aug 2022 09:41:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D824F81882 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g6NAC1IkeVeh; Tue, 9 Aug 2022 09:41:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id E080D81769; Tue, 9 Aug 2022 09:41:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E080D81769 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 2D5C41BF5EA for ; Tue, 9 Aug 2022 09:41:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 12E0640999 for ; Tue, 9 Aug 2022 09:41:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 12E0640999 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4-p7smURnVpN for ; Tue, 9 Aug 2022 09:41:27 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 09DDB40996 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by smtp4.osuosl.org (Postfix) with ESMTPS id 09DDB40996 for ; Tue, 9 Aug 2022 09:41:26 +0000 (UTC) Received: by mail-oi1-x22f.google.com with SMTP id l188so13207717oia.4 for ; Tue, 09 Aug 2022 02:41:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Fb09blZkcAQZj7FDCAXGDUiLvKH6b2nnyzx2H2/bdos=; b=nZ3SRqWBiv2psSWd4aFBgftuFiMpOKnk7Wt8CycATQgy6PWg7O+CCrGq6d+3ZGuCHl bWcumXt5IGm+OkcSPSmHzrLkEWQ6vgJAzx3/wh5+jOZDD7UcHKYpoPjG1xZSBp3XoG44 BzZsTXPDTTaxfBRV8/xEJfbb/+KIBK/yRa4Tah2MLlPvhFS7BDCTCadYkDH5VOxpKORj Ya5iWfTIhugsVupdm6MMNh0gYzgck4ROsreZIFIeivhCrQxlCqqp/2Dpr6V7kBKVJ3tz ccKIULSSQIjqD7bVVSygVVTSxQQ11fY7HVTv7wGLba5oG/IFmxSzTO4WCFnNww9nkSmB /AZg== X-Gm-Message-State: ACgBeo30I6k0+BcSqK144p36r1aTP1sKNvH29qlm1gt0/8RVdhjbmfsE 4vPIsspdnvkpXXpb2/6ArAR5H1P1WLU= X-Google-Smtp-Source: AA6agR67svIWQtQ4GuUVXMwNzNQu2cFpH7z/AaNVuxgomemk7IYLJzzXHZV9CbtDrei7oIeeu4KcSw== X-Received: by 2002:a05:6808:2385:b0:342:ee52:ccf5 with SMTP id bp5-20020a056808238500b00342ee52ccf5mr3841851oib.239.1660038085502; Tue, 09 Aug 2022 02:41:25 -0700 (PDT) Received: from james-x399.localdomain (71-33-138-207.hlrn.qwest.net. [71.33.138.207]) by smtp.gmail.com with ESMTPSA id t2-20020a0568301e2200b00636ff7d2cc7sm826508otr.79.2022.08.09.02.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 02:41:24 -0700 (PDT) From: James Hilliard To: buildroot@buildroot.org Date: Tue, 9 Aug 2022 03:41:09 -0600 Message-Id: <20220809094109.2279598-2-james.hilliard1@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220809094109.2279598-1-james.hilliard1@gmail.com> References: <20220809094109.2279598-1-james.hilliard1@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Fb09blZkcAQZj7FDCAXGDUiLvKH6b2nnyzx2H2/bdos=; b=lVVKjkqaVNebax4IcAEvNfMwcGnWEraWhnWKgGSv5cAu/rm3bfcMLJzNd6h+ELshxE jIp55OQ3w2RZobZ749iXkxP8BBMjNa7RkdxOD17naNZSn/etZVbMUQDHaoUnzuo8TTK9 nG9myI2VVl+TBDAB4hrvCjbnwa/iVFrKhew3A/pbafoesgBUKlAhIRyI9dQzXgdjkcAB S2s4pmwkimtGNpu/QD5uS+kOCi+kTtxpvhwpnGuxHiqt5QpHiFVEbOvlp7x0GUPZ3nTH +274UY9VVExOdqPhEXwlBz0dLXFEAzCTtN30qfsYuV/MxIyvlWAlwd/nwAGG1/Di6YAG pScw== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=lVVKjkqa Subject: [Buildroot] [PATCH 2/2] package/binutils: add BPF support X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jose E . Marchesi" , David Faust , James Hilliard , Thomas Petazzoni , Giulio Benetti , Romain Naour , Thomas De Schampheleire Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" In order for our BPF target builds to work correctly we also need to build BPF targeted binutils. To build BPF binutils at the same time as our normal binutils use an isolated build directory similar to the one created by HOST_GCC_CONFIGURE_SYMLINK and execute the build stages for both targets. Cc: Jose E. Marchesi Cc: David Faust Signed-off-by: James Hilliard --- package/binutils/Config.in.host | 5 ++ package/binutils/binutils.mk | 100 ++++++++++++++++++++++++++++++-- 2 files changed, 101 insertions(+), 4 deletions(-) diff --git a/package/binutils/Config.in.host b/package/binutils/Config.in.host index 9fa0cc4e8d..be46a12ae0 100644 --- a/package/binutils/Config.in.host +++ b/package/binutils/Config.in.host @@ -1,5 +1,10 @@ comment "Binutils Options" +config BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_BPF + bool + default y if BR2_BINUTILS_VERSION_2_37_X + default y if BR2_BINUTILS_VERSION_2_38_X + config BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_CFI bool default y diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk index 6362cb1641..78fd26b612 100644 --- a/package/binutils/binutils.mk +++ b/package/binutils/binutils.mk @@ -77,24 +77,116 @@ endif # "host" binutils should actually be "cross" # We just keep the convention of "host utility" for now -HOST_BINUTILS_CONF_OPTS = \ +HOST_BINUTILS_COMMON_CONF_OPTS = \ + --prefix="$(HOST_DIR)" \ + --sysconfdir="$(HOST_DIR)/etc" \ + --localstatedir="$(HOST_DIR)/var" \ --disable-multilib \ --disable-werror \ - --target=$(GNU_TARGET_NAME) \ --disable-shared \ --enable-static \ - --with-sysroot=$(STAGING_DIR) \ - --enable-poison-system-directories \ + --disable-gtk-doc \ + --disable-gtk-doc-html \ + --disable-doc \ + --disable-docs \ + --disable-documentation \ + --disable-debug \ + --with-xmlto=no \ + --with-fop=no \ + --disable-nls \ --without-debuginfod \ --enable-plugins \ --enable-lto \ $(BINUTILS_DISABLE_GDB_CONF_OPTS) \ $(BINUTILS_EXTRA_CONFIG_OPTIONS) +HOST_BINUTILS_CONF_OPTS = \ + $(HOST_BINUTILS_COMMON_CONF_OPTS) \ + --target=$(GNU_TARGET_NAME) \ + --with-sysroot=$(STAGING_DIR) + +HOST_BINUTILS_BPF_CONF_OPTS = \ + $(HOST_BINUTILS_COMMON_CONF_OPTS) \ + --target=$(BPF_TARGET_NAME) + # binutils run configure script of subdirs at make time, so ensure # our TARGET_CONFIGURE_ARGS are taken into consideration for those BINUTILS_MAKE_ENV = $(TARGET_CONFIGURE_ARGS) +HOST_BINUTILS_TARGET_BUILDDIR = build +HOST_BINUTILS_BPF_BUILDDIR = build-bpf + +define HOST_BINUTILS_TARGET_CONFIGURE_SYMLINK + mkdir -p $(@D)/$(HOST_BINUTILS_TARGET_BUILDDIR) + ln -sf ../configure $(@D)/$(HOST_BINUTILS_TARGET_BUILDDIR)/configure +endef +HOST_BINUTILS_PRE_CONFIGURE_HOOKS += HOST_BINUTILS_TARGET_CONFIGURE_SYMLINK + +ifeq ($(BR2_TOOLCHAIN_BUILDROOT_BPF),y) +define HOST_BINUTILS_BPF_CONFIGURE_SYMLINK + mkdir -p $(@D)/$(HOST_BINUTILS_BPF_BUILDDIR) + ln -sf ../configure $(@D)/$(HOST_BINUTILS_BPF_BUILDDIR)/configure +endef +HOST_BINUTILS_PRE_CONFIGURE_HOOKS += HOST_BINUTILS_BPF_CONFIGURE_SYMLINK +endif + +define HOST_BINUTILS_TARGET_CONFIGURE_CMDS + (cd $(@D)/$(HOST_BINUTILS_TARGET_BUILDDIR) && rm -rf config.cache; \ + $(HOST_CONFIGURE_OPTS) \ + CFLAGS="$(HOST_CFLAGS)" \ + LDFLAGS="$(HOST_LDFLAGS)" \ + $(HOST_BINUTILS_CONF_ENV) \ + ./configure \ + $(QUIET) $(HOST_BINUTILS_CONF_OPTS) \ + ) +endef + +ifeq ($(BR2_TOOLCHAIN_BUILDROOT_BPF),y) +define HOST_BINUTILS_BPF_CONFIGURE_CMDS + (cd $(@D)/$(HOST_BINUTILS_BPF_BUILDDIR) && rm -rf config.cache; \ + $(HOST_CONFIGURE_OPTS) \ + CFLAGS="$(HOST_CFLAGS)" \ + LDFLAGS="$(HOST_LDFLAGS)" \ + $(HOST_BINUTILS_CONF_ENV) \ + ./configure \ + $(QUIET) $(HOST_BINUTILS_BPF_CONF_OPTS) \ + ) +endef +endif + +define HOST_BINUTILS_CONFIGURE_CMDS + $(HOST_BINUTILS_TARGET_CONFIGURE_CMDS) + $(HOST_BINUTILS_BPF_CONFIGURE_CMDS) +endef + +define HOST_BINUTILS_TARGET_BUILD_CMDS + $(HOST_MAKE_ENV) $(MAKE) $(HOST_BINUTILS_MAKE_OPTS) -C $(@D)/$(HOST_BINUTILS_TARGET_BUILDDIR) +endef + +ifeq ($(BR2_TOOLCHAIN_BUILDROOT_BPF),y) +define HOST_BINUTILS_BPF_BUILD_CMDS + $(HOST_MAKE_ENV) $(MAKE) $(HOST_BINUTILS_MAKE_OPTS) -C $(@D)/$(HOST_BINUTILS_BPF_BUILDDIR) +endef +endif + +define HOST_BINUTILS_BUILD_CMDS + $(HOST_BINUTILS_TARGET_BUILD_CMDS) + $(HOST_BINUTILS_BPF_BUILD_CMDS) +endef + +define HOST_BINUTILS_TARGET_INSTALL_CMDS + $(HOST_MAKE_ENV) $(MAKE) $(HOST_BINUTILS_INSTALL_OPTS) -C $(@D)/$(HOST_BINUTILS_TARGET_BUILDDIR) +endef + +define HOST_BINUTILS_BPF_INSTALL_CMDS + $(HOST_MAKE_ENV) $(MAKE) $(HOST_BINUTILS_INSTALL_OPTS) -C $(@D)/$(HOST_BINUTILS_BPF_BUILDDIR) +endef + +define HOST_BINUTILS_INSTALL_CMDS + $(HOST_BINUTILS_TARGET_INSTALL_CMDS) + $(HOST_BINUTILS_BPF_INSTALL_CMDS) +endef + # We just want libbfd, libiberty and libopcodes, # not the full-blown binutils in staging define BINUTILS_INSTALL_STAGING_CMDS