Received: by 10.213.65.68 with SMTP id h4csp1788800imn; Thu, 29 Mar 2018 11:02:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx48FcTksYeANeXbuj2QvoNqu2xg+wxq0Ke0vn+0BUQD0eMkV8YLbTBehRc1TsW6rjPyxfZMw X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr9305934plb.269.1522346575254; Thu, 29 Mar 2018 11:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522346575; cv=none; d=google.com; s=arc-20160816; b=aFhZexDOO/7gzRVL7aBf0kkgM1ud5VO/FgG330Tsd5nI0VdqMIDKiGunOLLO04QaUL rAjXHL2jJv8YiPnVgrhKzWe4pMpjSuDu23HC+iMN5kH+u7wD+7+fVNfitdkVGs7T+OD0 F+iZ+teHZtQwiBuaqul0etOv+5Om1jKYqYLqPrA/ebRoD1e3F7oqoXQgZBqi5ikHOIdr NU7/DouedpY7fh8x/ljQcE829nFE+VhZMRTaP/CXJcKzq4v4izXoeSIsCL0X0eJHnKDk CpESIKBgd9hGiMgQtyDDScdu+ErPZKZoK7zP971+j6WeJDTLazlQdDfwAQntl71TqWJ0 BIrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=4gZzQAlQ2S+bsrqYCRTqAjfz5DQ217oh4KxSZvCHLiw=; b=I2aHE11roTAjP1h5sloX4/USxa7ifivGY522fyxBsmKQL2ls4EZS2edzfq+ntn1yfh fxBeYwKAW7oLxPZyX33xozMKYrYyBIJY7e0LDs6OCrH84DG26p9GVWBlUpT4PNPpVWIX Ikux4/g1STgpoyE1/6XlbNcYpCpCzH4FGcUxjvlIC7aNLy292IgZa4zPxBoF3AxfDhM+ LTg7DXmBxLCK7sAGD4zpds6VmMcfULcOcFOgvGDIPkC1DNzTO/vKt3ubO5ItL/UgVpN9 LHrJFHB0EkMnhex/FnPfSp8l7kaeznfIZtlQLE0f196niI578XVnajLtEeN6BSd2jy1Q hylA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6-v6si6071906plk.746.2018.03.29.11.02.40; Thu, 29 Mar 2018 11:02:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752197AbeC2SB3 (ORCPT + 99 others); Thu, 29 Mar 2018 14:01:29 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:39124 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbeC2SBW (ORCPT ); Thu, 29 Mar 2018 14:01:22 -0400 Received: by mail-pf0-f193.google.com with SMTP id c78so3753222pfj.6 for ; Thu, 29 Mar 2018 11:01: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; bh=4gZzQAlQ2S+bsrqYCRTqAjfz5DQ217oh4KxSZvCHLiw=; b=Ro/ZQPg3VT+zrXFhWVSsZRT2iUPqrg1yTZ2IWxIrC/r0EW/wNVp1FbFYXHmkNJkRCq N1Zsdqex9Prx/O2xTGG1rrGw7IkicF3wL6AvHCPdg5t6U1CiY3F6G8lRP63iEw35sSZF U78Dx7X7q1ABNB8QmWpkg42vlWD6jnmv1perku5uZ17bwCh9I/fNRiQG//+9CnQ7SLrq 2dFE7dgqNhZph71G8yX2RYaT1WgGtLHo0R96iPRosZsBIHj/CODEL9itEDTVRBl8I3Yd nTYJJkixl0PnbA9s7jjopcfFFiTFbZpKr0gHaC5NOfDv9BuAkqcMQau5Eb8qAJQw9eut FYVA== X-Gm-Message-State: AElRT7Ey12gdEY1aqcnaFE87miToyHmLNNO+UOu4ruQKX5F984A7ZNPm o7ZInc/FSs/nZ2+2Als+D9L+rg== X-Received: by 2002:a17:902:ab88:: with SMTP id f8-v6mr3487150plr.34.1522346481857; Thu, 29 Mar 2018 11:01:21 -0700 (PDT) Received: from localhost.localdomain.utopia.net ([2601:602:9802:a8dc::19fb]) by smtp.gmail.com with ESMTPSA id m21sm4762432pgn.0.2018.03.29.11.01.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Mar 2018 11:01:20 -0700 (PDT) From: Laura Abbott To: Andy Lutomirski , mjw@fedoraproject.org, "H . J . Lu" , Masahiro Yamada Cc: Laura Abbott , Linus Torvalds , X86 ML , linux-kernel@vger.kernel.org, Nick Clifton , Cary Coutant , linux-kbuild@vger.kernel.org Subject: [RFCv2 PATCH 2/3] kbuild: Link with generated build-salt header Date: Thu, 29 Mar 2018 11:01:11 -0700 Message-Id: <20180329180112.11055-3-labbott@redhat.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180329180112.11055-1-labbott@redhat.com> References: <20180329180112.11055-1-labbott@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have a header with appropriate data, link it into the kernel and modules. If BUILD_ID_SALT isn't set, the script should be empty. Signed-off-by: Laura Abbott --- v2: Changed names to be consistent --- Makefile | 4 +++- scripts/.gitignore | 1 + scripts/Makefile | 2 +- scripts/build-salt.lds.S | 5 +++++ scripts/link-vmlinux.sh | 3 ++- 5 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 scripts/build-salt.lds.S diff --git a/Makefile b/Makefile index b80c2d6d0854..171f82295e5e 100644 --- a/Makefile +++ b/Makefile @@ -425,7 +425,8 @@ KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE -KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds +KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds \ + -T $(srctree)/scripts/build-salt.lds GCC_PLUGINS_CFLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC @@ -1004,6 +1005,7 @@ export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) export KBUILD_VMLINUX_LIBS := $(libs-y1) export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds +export EXTRA_LDS := scripts/build-salt.lds export LDFLAGS_vmlinux # used by scripts/package/Makefile export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) diff --git a/scripts/.gitignore b/scripts/.gitignore index 0442c06eefcb..1c840ef4f0c8 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -13,3 +13,4 @@ asn1_compiler extract-cert sign-file insert-sys-cert +build-salt.lds diff --git a/scripts/Makefile b/scripts/Makefile index 25ab143cbe14..47f6ed5b0bcd 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -25,7 +25,7 @@ HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include HOSTLOADLIBES_sign-file = -lcrypto HOSTLOADLIBES_extract-cert = -lcrypto -always := $(hostprogs-y) $(hostprogs-m) +always := $(hostprogs-y) $(hostprogs-m) build-salt.lds # The following hostprogs-y programs are only build on demand hostprogs-y += unifdef diff --git a/scripts/build-salt.lds.S b/scripts/build-salt.lds.S new file mode 100644 index 000000000000..f85981f1187e --- /dev/null +++ b/scripts/build-salt.lds.S @@ -0,0 +1,5 @@ +#include + +SECTIONS { + BUILD_ID_SALT +} diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index be56a1153014..2b57e0139acb 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -93,6 +93,7 @@ modpost_link() vmlinux_link() { local lds="${objtree}/${KBUILD_LDS}" + local extra_lds="${objtree}/${EXTRA_LDS}" local objects if [ "${SRCARCH}" != "um" ]; then @@ -114,7 +115,7 @@ vmlinux_link() fi ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ - -T ${lds} ${objects} + -T ${lds} -T ${extra_lds} ${objects} else if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then objects="-Wl,--whole-archive \ -- 2.16.2