From: Borislav Petkov <bp@alien8.de>
To: Nick Desaulniers <ndesaulniers@google.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Jarkko Sakkinen <jarkko.sakkinen@intel.com>
Cc: tglx@linutronix.de, mingo@redhat.com,
clang-built-linux@googlegroups.com, x86@kernel.org,
Tri Vo <trong@android.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Rob Herring <robh@kernel.org>,
George Rimar <grimar@accesssoftek.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] x86, realmode: explicitly set entry via command line
Date: Wed, 25 Sep 2019 12:20:41 +0200 [thread overview]
Message-ID: <20190925102041.GB3891@zn.tnic> (raw)
In-Reply-To: <20190924193310.132104-1-ndesaulniers@google.com>
+ some more people who did the unified realmode thing.
On Tue, Sep 24, 2019 at 12:33:08PM -0700, Nick Desaulniers wrote:
> Linking with ld.lld via $ make LD=ld.lld produces the warning:
> ld.lld: warning: cannot find entry symbol _start; defaulting to 0x1000
>
> Linking with ld.bfd shows the default entry is 0x1000:
> $ readelf -h arch/x86/realmode/rm/realmode.elf | grep Entry
> Entry point address: 0x1000
>
> While ld.lld is being pedantic, just set the entry point explicitly,
> instead of depending on the implicit default.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/216
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Changes V1 -> V2:
> * Use command line flag, rather than linker script, as ld.bfd produces a
> syntax error for `ENTRY(0x1000)` but is happy with `-e 0x1000`
>
> arch/x86/realmode/rm/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
> index f60501a384f9..338a00c5257f 100644
> --- a/arch/x86/realmode/rm/Makefile
> +++ b/arch/x86/realmode/rm/Makefile
> @@ -46,7 +46,7 @@ $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
> targets += realmode.lds
> $(obj)/realmode.lds: $(obj)/pasyms.h
>
> -LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
> +LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -e 0x1000 -T
So looking at arch/x86/realmode/rm/realmode.lds.S: what's stopping
people from adding more sections before the first
. = ALIGN(PAGE_SIZE);
which, with enough bytes to go above the first 4K, would cause that
alignment to go to 0x2000 and then your hardcoded address would be
wrong, all of a sudden.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2019-09-25 10:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-23 22:24 [PATCH] x86, realmode: explicitly set ENTRY in linker script Nick Desaulniers
2019-09-24 17:30 ` Sedat Dilek
2019-09-24 18:24 ` Nathan Chancellor
2019-09-24 18:32 ` Nick Desaulniers
2019-09-24 19:33 ` [PATCH v2] x86, realmode: explicitly set entry via command line Nick Desaulniers
2019-09-24 19:37 ` Nick Desaulniers
2019-09-25 10:20 ` Borislav Petkov [this message]
2019-09-25 16:35 ` Nick Desaulniers
2019-09-25 17:02 ` Peter Smith
2019-09-25 17:10 ` Borislav Petkov
2019-09-25 18:09 ` [PATCH v3] x86, realmode: explicitly set entry via ENTRY in linker script Nick Desaulniers
2019-10-01 10:37 ` [tip: x86/boot] x86/realmode: Explicitly set entry point " tip-bot2 for Nick Desaulniers
2019-10-01 20:18 ` tip-bot2 for Nick Desaulniers
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=20190925102041.GB3891@zn.tnic \
--to=bp@alien8.de \
--cc=clang-built-linux@googlegroups.com \
--cc=grimar@accesssoftek.com \
--cc=hpa@zytor.com \
--cc=jarkko.sakkinen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=ndesaulniers@google.com \
--cc=robh@kernel.org \
--cc=tglx@linutronix.de \
--cc=trong@android.com \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
/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;
as well as URLs for NNTP newsgroup(s).