From patchwork Thu Nov 30 23:38:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sami Tolvanen X-Patchwork-Id: 10085805 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 C437A602BC for ; Thu, 30 Nov 2017 23:40:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B571D2A423 for ; Thu, 30 Nov 2017 23:40:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9EAC2A428; Thu, 30 Nov 2017 23:40:59 +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 5DEFC2A426 for ; Thu, 30 Nov 2017 23:40:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751591AbdK3Xk6 (ORCPT ); Thu, 30 Nov 2017 18:40:58 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:38561 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878AbdK3XjL (ORCPT ); Thu, 30 Nov 2017 18:39:11 -0500 Received: by mail-it0-f65.google.com with SMTP id r6so508470itr.3 for ; Thu, 30 Nov 2017 15:39:11 -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=kcNfnLsDsq+8Qk0UpSEsjuJn2km725DmFTFvpzdA5+M=; b=LqoFeabKJ6UDt6f1Z1siOyotuLOYV9zXj8ne95An+t0MeUYoZEY65bbjra+r3KiXgK eiY3+wwGEdrFMMoeKxmyg7CAgG9bZKfwXk/eF1BX6IfSs22QhMK77K/1TaTtGXDgakGC VoIQnBh7my1UEVnMh3RDZG/8MQUwqS5m7ACKR9wUrNuhBM68VRyd/AmYKP3GA7pnz+0Z +caaxQY9kUTODdOC1SbpGQ7G2S6J4oO3U8izg57dkiF7C/i9OLwwUJz4mZfbZMcP/AeZ 73UX40eQFRxRqlwzOyD1EwzhVliDafXSDOpNza+mqlnY1YeMpD6eN+GciDIcZF+USmCp Y1VQ== 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=kcNfnLsDsq+8Qk0UpSEsjuJn2km725DmFTFvpzdA5+M=; b=FH9KSnMQLwiYtN4oUkzFbcZNyFQvJZiAbC74IXvbne0/QDEwsJJfT2mqUE3jczJkss kNvnFExoRpmbegE34XJsB+Uk3+C5Xb8dIhW2hv3lZYGNUl6ht5LD9azI15CesX44ehav CnkIvuazGr04v9NTxsO7Yymazm4q5EHHnZ9nNUXV9vhCadg8pSzUAmWzJGGlIC2Y+/6A mAzAJzui7CORqZ9YRsvA5qssdzsMe1MBSn7QQqkNWh35GYouOlS5YN86+yzNUpwpl6+V /wzfqaN1mjtSqCsDrdRXNsKzIjIhTvFyOVJUxeful4MF4yiiU+zbksOCBNOly/nNss0K Hh5g== X-Gm-Message-State: AJaThX51UIVENBTecf8pWi9ws39TKkeYEeXYXsapN79wbcYOLBf/rd2U amJMV7gpHrvJ0ykIoIfdKhaSiw== X-Google-Smtp-Source: AGs4zMajpBUF3E/DTVnKaIvajTSErdOo8ULFLsfDbEEmxaTeeJ/ArGC9sWyc0j1WnARp0LbHtk5EcA== X-Received: by 10.36.77.79 with SMTP id l76mr5606075itb.14.1512085150782; Thu, 30 Nov 2017 15:39:10 -0800 (PST) Received: from samitolvanen.mtv.corp.google.com ([100.98.112.14]) by smtp.gmail.com with ESMTPSA id h73sm2896676itb.21.2017.11.30.15.39.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Nov 2017 15:39:10 -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 v2 1/7] kbuild: fix LD_DEAD_CODE_DATA_ELIMINATION Date: Thu, 30 Nov 2017 15:38:59 -0800 Message-Id: <20171130233905.130602-2-samitolvanen@google.com> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171130233905.130602-1-samitolvanen@google.com> References: <20171129234442.655-1-samitolvanen@google.com> <20171130233905.130602-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