public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ilie Halip <ilie.halip@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Andy <luto@kernel.org>, Ilie Halip <ilie.halip@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, clang-built-linux@googlegroups.com
Subject: [PATCH v3] x86/boot: discard .eh_frame sections
Date: Tue, 26 Nov 2019 16:45:44 +0200	[thread overview]
Message-ID: <20191126144545.19354-1-ilie.halip@gmail.com> (raw)
In-Reply-To: <20191118175223.GM6363@zn.tnic>

When using GCC as compiler and LLVM's lld as linker, linking
setup.elf fails:
      LD      arch/x86/boot/setup.elf
    ld.lld: error: init sections too big!

This happens because GCC generates .eh_frame sections for most
of the files in that directory, then ld.lld places the merged
section before __end_init, triggering an assert in the linker
script.

Fix this by discarding the .eh_frame sections, as suggested by
Boris. The kernel proper linker script discards them too.

Signed-off-by: Ilie Halip <ilie.halip@gmail.com>
Link: https://lore.kernel.org/lkml/20191118175223.GM6363@zn.tnic/
Link: https://github.com/ClangBuiltLinux/linux/issues/760
Suggested-by: Borislav Petkov <bp@alien8.de>
---

Changes in V3:
 * discard .eh_frame instead of placing it after .rodata

Changes in V2:
 * removed wildcard for input sections (.eh_frame* -> .eh_frame)

 arch/x86/boot/setup.ld | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld
index 0149e41d42c2..3da1c37c6dd5 100644
--- a/arch/x86/boot/setup.ld
+++ b/arch/x86/boot/setup.ld
@@ -51,7 +51,10 @@ SECTIONS
 	. = ALIGN(16);
 	_end = .;
 
-	/DISCARD/ : { *(.note*) }
+	/DISCARD/	: {
+		*(.eh_frame)
+		*(.note*)
+	}
 
 	/*
 	 * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
-- 
2.17.1


  reply	other threads:[~2019-11-26 14:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04  9:03 [PATCH] x86/boot: explicitly place .eh_frame after .rodata Ilie Halip
2019-11-04 17:54 ` Nick Desaulniers
2019-11-05 14:37   ` Ilie Halip
2019-11-06 12:06   ` [PATCH V2] " Ilie Halip
2019-11-06 17:23     ` Nick Desaulniers
2019-11-18 10:22       ` Ilie Halip
2019-11-18 14:35     ` Borislav Petkov
2019-11-18 17:46       ` Nick Desaulniers
2019-11-18 17:52         ` Borislav Petkov
2019-11-26 14:45           ` Ilie Halip [this message]
2019-11-26 17:16             ` [PATCH v3] x86/boot: discard .eh_frame sections Nick Desaulniers
2019-12-06 21:53               ` Nick Desaulniers
2019-12-14  7:12             ` [tip: x86/boot] x86/boot: Discard " tip-bot2 for Ilie Halip

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191126144545.19354-1-ilie.halip@gmail.com \
    --to=ilie.halip@gmail.com \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ndesaulniers@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox