From patchwork Wed Nov 29 23:44:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10083935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BAD1C6020B for ; Wed, 29 Nov 2017 23:46:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD28F29C84 for ; Wed, 29 Nov 2017 23:46:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A205429D55; Wed, 29 Nov 2017 23:46:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5605E29C84 for ; Wed, 29 Nov 2017 23:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753380AbdK2XqQ (ORCPT ); Wed, 29 Nov 2017 18:46:16 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33469 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753049AbdK2Xo5 (ORCPT ); Wed, 29 Nov 2017 18:44:57 -0500 Received: by mail-pl0-f68.google.com with SMTP id q7so3094521plk.0 for ; Wed, 29 Nov 2017 15:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B9QnQ0XtQrSdzTOeVKwnXHh07YEtxvCtA8FmQLvHzFQ=; b=Ts1yl9W3iEJFc/n/GrmLQE6rgM2lOtsKSTFVI0dcvdAaX+Q9U3gJDJ6KV4iH1mXXMQ MDPkduaihIiUvm/1DMxzUKzgipK6x/AC1zyLGItPeJ5CLZQwQgJ+hSBRXw6hVcpIIFCF LQPzr/Kum+Aqfcq9RaLE1r7T3UcMcxaptv7/sj531DK9vpXehyD2dmmjL6V5fyuWQkCS 7CiEU5QBJCVbDAUGraxGuLEmEc0sh6IZEXg5ibblTvb2P7feSEavMUFK/EOi2ni7g0yC xqJPalnw40b7bdlr/F0WFwtwXFKr7+qfdiU1xzVQ/QKsC9a7Bgo5Fud4bfQcYIw1aKzA o1hA== 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=B9QnQ0XtQrSdzTOeVKwnXHh07YEtxvCtA8FmQLvHzFQ=; b=j0SMvW8Td2moqNNSFQgN3oRy3qqfBHcX8qxl+xwtCgU5azJbankx5jZWju+BK3SrB3 x3K4PCu7GXm3XnBTcQ6Y6F5Sk5YQBrJW4g+a757E1X+Y8VN27uksTVhidNE2CRqsRHwu qZLY0qmzERISxdwT4ItEAeYauzXnmfuRXD+kL+7I+T/GrSYB4NxHCJjzPty0+IEqMz8r qtG+3QAkj0dw3QPdVBlBBOjNsDNzSfipcTrY6tHSuUrkmBXKygSfrcELOw5+c1rNX1d4 C7C3ploLK1fCRwaOpUNpzrIQTVFF4T6cKsr4GEughavmsMFYVJibBxcS7CmHjSCd2KMw e+Zw== X-Gm-Message-State: AJaThX5TS2Pi1a9aDqE7qnagoaRRQcTodZzx0W48gNz7p1qmDow0fTZv ZDWC0HHqnAHyzmObdWaVrOx2Kg== X-Google-Smtp-Source: AGs4zMZe6Ahk+DsMoKZEmrXLYB3Ylf7TxcTr24E88D4u50FhYO8vh+4y86EEpx8PWgysVnw3XArNNQ== X-Received: by 10.84.252.139 with SMTP id y11mr260286pll.262.1511999096441; Wed, 29 Nov 2017 15:44:56 -0800 (PST) Received: from samitolvanen.mtv.corp.google.com ([100.98.112.14]) by smtp.gmail.com with ESMTPSA id s14sm5326948pfe.36.2017.11.29.15.44.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Nov 2017 15:44:55 -0800 (PST) From: Sami Tolvanen To: Alex Matveev , Andi Kleen , Ard Biesheuvel , Greg Hackmann , Kees Cook , linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Masahiro Yamada , Maxim Kuvyrkov , Michal Marek , Nick Desaulniers , Yury Norov , Matthias Kaehlcke , Nicholas Piggin Cc: Sami Tolvanen Subject: [PATCH 3/7] kbuild: fix LD_DEAD_CODE_DATA_ELIMINATION with GNU gold Date: Wed, 29 Nov 2017 15:44:38 -0800 Message-Id: <20171129234442.655-4-samitolvanen@google.com> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171129234442.655-1-samitolvanen@google.com> References: <20171129234442.655-1-samitolvanen@google.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Don't remove .head.text or .exitcall.exit when linking with --gc-sections, and include .init.text.* in .init.text and .init.rodata.* in .init.rodata. Signed-off-by: Sami Tolvanen Reviewed-by: Nicholas Piggin --- include/asm-generic/vmlinux.lds.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index ee8b707d9fa9..eb4199c12bd2 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -515,7 +515,7 @@ VMLINUX_SYMBOL(__softirqentry_text_end) = .; /* Section used for early init (in .S files) */ -#define HEAD_TEXT *(.head.text) +#define HEAD_TEXT KEEP(*(.head.text)) #define HEAD_TEXT_SECTION \ .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \ @@ -560,7 +560,7 @@ MEM_DISCARD(init.data) \ KERNEL_CTORS() \ MCOUNT_REC() \ - *(.init.rodata) \ + *(.init.rodata .init.rodata.*) \ FTRACE_EVENTS() \ TRACE_SYSCALLS() \ KPROBE_BLACKLIST() \ @@ -579,7 +579,7 @@ EARLYCON_TABLE() #define INIT_TEXT \ - *(.init.text) \ + *(.init.text .init.text.*) \ *(.text.startup) \ MEM_DISCARD(init.text) @@ -596,7 +596,7 @@ MEM_DISCARD(exit.text) #define EXIT_CALL \ - *(.exitcall.exit) + KEEP(*(.exitcall.exit)) /* * bss (Block Started by Symbol) - uninitialized data