From: Nathan Chancellor <natechancellor@gmail.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
Arnd Bergmann <arnd@arndb.de>,
Nick Desaulniers <ndesaulniers@google.com>,
Russell King <linux@armlinux.org.uk>,
Stefan Agner <stefan@agner.ch>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 2/2] ARM: Wrap '--pic-veneer' with ld-option
Date: Wed, 5 Dec 2018 11:36:06 -0700 [thread overview]
Message-ID: <20181205183606.GA7274@flashbox> (raw)
In-Reply-To: <CAKv+Gu9Nq51Fj_14MYS6MEm0VPHOJB1CBFkCHmyC8Wt0=NWpRg@mail.gmail.com>
On Wed, Dec 05, 2018 at 09:09:56AM +0100, Ard Biesheuvel wrote:
> (+ Arnd)
>
> On Wed, 5 Dec 2018 at 09:06, Nathan Chancellor <natechancellor@gmail.com> wrote:
> >
> > On Wed, Dec 05, 2018 at 08:37:05AM +0100, Ard Biesheuvel wrote:
> > > On Wed, 5 Dec 2018 at 02:42, Nathan Chancellor <natechancellor@gmail.com> wrote:
> > > >
> > > > This flag is not supported by lld:
> > > >
> > > > ld.lld: error: unknown argument: --pic-veneer
> > > >
> > > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > >
> > > Hi Nate,
> > >
> > > Does this mean ld.lld is guaranteed to produce position independent
> > > veneers if you build kernels that are bigger than the typical range of
> > > a relative branch?
> > >
> >
> > Hi Ard,
> >
> > Honestly, I'm not quite sure. I saw your commit that introduced this
> > flag and I wasn't quite sure what to make of it for lld. What
> > configuration would I use to verify and what would I check for?
> >
>
> Try building allyesconfig, and check the resulting binary for veneers
> (which have 'veneer' in the symbol name, at least when ld.bfd emits
> them). These veneers should not take the [virtual] address of the
> branch target directly, but take a PC relative offset (as in the
> example in the commit log of that patch you are referring to)
>
Alright, compiling with allyesconfig is a little rough at the moment
(bug reports I will file in due time) but I was able to do it. Here's
the disassembly specifically for the functions you had in your commit,
my assembly knowledge is pretty much non-existent unfortunately so I am
not sure what to make of it (it doesn't look like there is a virtual
address for pc in that mix?). I am happy to provide any more information
that is needed.
c03030cc <__enable_mmu>:
c03030cc: e3c00002 bic r0, r0, #2
c03030d0: e3c00b02 bic r0, r0, #2048 ; 0x800
c03030d4: e3c00a01 bic r0, r0, #4096 ; 0x1000
c03030d8: e3a05051 mov r5, #81 ; 0x51
c03030dc: ee035f10 mcr 15, 0, r5, cr3, cr0, {0}
c03030e0: ee024f10 mcr 15, 0, r4, cr2, cr0, {0}
c03030e4: eafff3c5 b c0300000 <__turn_mmu_on>
c03030e8: e320f000 nop {0}
c03030ec: e320f000 nop {0}
c03030f0: e320f000 nop {0}
c03030f4: e320f000 nop {0}
c03030f8: e320f000 nop {0}
c03030fc: e320f000 nop {0}
c0300000 <__turn_mmu_on>:
c0300000: e1a00000 nop ; (mov r0, r0)
c0300004: ee070f95 mcr 15, 0, r0, cr7, cr5, {4}
c0300008: ee010f10 mcr 15, 0, r0, cr1, cr0, {0}
c030000c: ee103f10 mrc 15, 0, r3, cr0, cr0, {0}
c0300010: ee070f95 mcr 15, 0, r0, cr7, cr5, {4}
c0300014: e1a03003 mov r3, r3
c0300018: e1a0300d mov r3, sp
c030001c: e1a0f003 mov pc, r3
Thanks,
Nathan
> > Additionally, I have filed an LLVM bug for the lld developers to
> > check and see if this is a flag they should support:
> >
> > https://bugs.llvm.org/show_bug.cgi?id=39886
> >
> > Thanks for the quick reply,
> > Nathan
> >
> > > > ---
> > > > arch/arm/Makefile | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> > > > index e2a0baf36766..4fab2aa29570 100644
> > > > --- a/arch/arm/Makefile
> > > > +++ b/arch/arm/Makefile
> > > > @@ -10,7 +10,7 @@
> > > > #
> > > > # Copyright (C) 1995-2001 by Russell King
> > > >
> > > > -LDFLAGS_vmlinux := --no-undefined -X --pic-veneer
> > > > +LDFLAGS_vmlinux := --no-undefined -X $(call ld-option,--pic-veneer)
> > > > ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
> > > > LDFLAGS_vmlinux += --be8
> > > > KBUILD_LDFLAGS_MODULE += --be8
> > > > --
> > > > 2.20.0.rc1
> > > >
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <natechancellor@gmail.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Stefan Agner <stefan@agner.ch>,
Nicolas Pitre <nicolas.pitre@linaro.org>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH 2/2] ARM: Wrap '--pic-veneer' with ld-option
Date: Wed, 5 Dec 2018 11:36:06 -0700 [thread overview]
Message-ID: <20181205183606.GA7274@flashbox> (raw)
In-Reply-To: <CAKv+Gu9Nq51Fj_14MYS6MEm0VPHOJB1CBFkCHmyC8Wt0=NWpRg@mail.gmail.com>
On Wed, Dec 05, 2018 at 09:09:56AM +0100, Ard Biesheuvel wrote:
> (+ Arnd)
>
> On Wed, 5 Dec 2018 at 09:06, Nathan Chancellor <natechancellor@gmail.com> wrote:
> >
> > On Wed, Dec 05, 2018 at 08:37:05AM +0100, Ard Biesheuvel wrote:
> > > On Wed, 5 Dec 2018 at 02:42, Nathan Chancellor <natechancellor@gmail.com> wrote:
> > > >
> > > > This flag is not supported by lld:
> > > >
> > > > ld.lld: error: unknown argument: --pic-veneer
> > > >
> > > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > >
> > > Hi Nate,
> > >
> > > Does this mean ld.lld is guaranteed to produce position independent
> > > veneers if you build kernels that are bigger than the typical range of
> > > a relative branch?
> > >
> >
> > Hi Ard,
> >
> > Honestly, I'm not quite sure. I saw your commit that introduced this
> > flag and I wasn't quite sure what to make of it for lld. What
> > configuration would I use to verify and what would I check for?
> >
>
> Try building allyesconfig, and check the resulting binary for veneers
> (which have 'veneer' in the symbol name, at least when ld.bfd emits
> them). These veneers should not take the [virtual] address of the
> branch target directly, but take a PC relative offset (as in the
> example in the commit log of that patch you are referring to)
>
Alright, compiling with allyesconfig is a little rough at the moment
(bug reports I will file in due time) but I was able to do it. Here's
the disassembly specifically for the functions you had in your commit,
my assembly knowledge is pretty much non-existent unfortunately so I am
not sure what to make of it (it doesn't look like there is a virtual
address for pc in that mix?). I am happy to provide any more information
that is needed.
c03030cc <__enable_mmu>:
c03030cc: e3c00002 bic r0, r0, #2
c03030d0: e3c00b02 bic r0, r0, #2048 ; 0x800
c03030d4: e3c00a01 bic r0, r0, #4096 ; 0x1000
c03030d8: e3a05051 mov r5, #81 ; 0x51
c03030dc: ee035f10 mcr 15, 0, r5, cr3, cr0, {0}
c03030e0: ee024f10 mcr 15, 0, r4, cr2, cr0, {0}
c03030e4: eafff3c5 b c0300000 <__turn_mmu_on>
c03030e8: e320f000 nop {0}
c03030ec: e320f000 nop {0}
c03030f0: e320f000 nop {0}
c03030f4: e320f000 nop {0}
c03030f8: e320f000 nop {0}
c03030fc: e320f000 nop {0}
c0300000 <__turn_mmu_on>:
c0300000: e1a00000 nop ; (mov r0, r0)
c0300004: ee070f95 mcr 15, 0, r0, cr7, cr5, {4}
c0300008: ee010f10 mcr 15, 0, r0, cr1, cr0, {0}
c030000c: ee103f10 mrc 15, 0, r3, cr0, cr0, {0}
c0300010: ee070f95 mcr 15, 0, r0, cr7, cr5, {4}
c0300014: e1a03003 mov r3, r3
c0300018: e1a0300d mov r3, sp
c030001c: e1a0f003 mov pc, r3
Thanks,
Nathan
> > Additionally, I have filed an LLVM bug for the lld developers to
> > check and see if this is a flag they should support:
> >
> > https://bugs.llvm.org/show_bug.cgi?id=39886
> >
> > Thanks for the quick reply,
> > Nathan
> >
> > > > ---
> > > > arch/arm/Makefile | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> > > > index e2a0baf36766..4fab2aa29570 100644
> > > > --- a/arch/arm/Makefile
> > > > +++ b/arch/arm/Makefile
> > > > @@ -10,7 +10,7 @@
> > > > #
> > > > # Copyright (C) 1995-2001 by Russell King
> > > >
> > > > -LDFLAGS_vmlinux := --no-undefined -X --pic-veneer
> > > > +LDFLAGS_vmlinux := --no-undefined -X $(call ld-option,--pic-veneer)
> > > > ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
> > > > LDFLAGS_vmlinux += --be8
> > > > KBUILD_LDFLAGS_MODULE += --be8
> > > > --
> > > > 2.20.0.rc1
> > > >
next prev parent reply other threads:[~2018-12-05 18:36 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 1:42 [PATCH 1/2] ARM: Remove '-p' from LDFLAGS Nathan Chancellor
2018-12-05 1:42 ` Nathan Chancellor
2018-12-05 1:42 ` [PATCH 2/2] ARM: Wrap '--pic-veneer' with ld-option Nathan Chancellor
2018-12-05 1:42 ` Nathan Chancellor
2018-12-05 7:37 ` Ard Biesheuvel
2018-12-05 7:37 ` Ard Biesheuvel
2018-12-05 8:06 ` Nathan Chancellor
2018-12-05 8:06 ` Nathan Chancellor
2018-12-05 8:09 ` Ard Biesheuvel
2018-12-05 8:09 ` Ard Biesheuvel
2018-12-05 18:21 ` Nick Desaulniers
2018-12-05 18:21 ` Nick Desaulniers
2018-12-05 19:30 ` Peter Smith
2018-12-05 19:30 ` Peter Smith
2018-12-05 18:36 ` Nathan Chancellor [this message]
2018-12-05 18:36 ` Nathan Chancellor
2018-12-05 18:39 ` Ard Biesheuvel
2018-12-05 18:39 ` Ard Biesheuvel
2018-12-05 18:41 ` Nick Desaulniers
2018-12-05 18:41 ` Nick Desaulniers
2018-12-05 22:59 ` Stefan Agner
2018-12-05 22:59 ` Stefan Agner
2018-12-05 23:19 ` Nick Desaulniers
2018-12-05 23:19 ` Nick Desaulniers
2018-12-05 19:45 ` Nathan Chancellor
2018-12-05 21:03 ` Ard Biesheuvel
2018-12-05 21:03 ` Ard Biesheuvel
2018-12-29 12:27 ` Stefan Agner
2018-12-29 12:27 ` Stefan Agner
2019-01-07 19:42 ` Nick Desaulniers
2019-01-07 19:42 ` Nick Desaulniers
2018-12-05 18:40 ` Nick Desaulniers
2018-12-05 18:40 ` Nick Desaulniers
2018-12-05 7:37 ` [PATCH 1/2] ARM: Remove '-p' from LDFLAGS Ard Biesheuvel
2018-12-05 7:37 ` Ard Biesheuvel
2018-12-05 16:37 ` Nicolas Pitre
2018-12-05 16:37 ` Nicolas Pitre
2018-12-05 17:47 ` Nick Desaulniers
2018-12-05 17:47 ` Nick Desaulniers
2018-12-29 12:49 ` Stefan Agner
2018-12-29 12:49 ` Stefan Agner
2018-12-31 18:12 ` [PATCH v2] " Nathan Chancellor
2018-12-31 18:12 ` Nathan Chancellor
2019-01-05 16:34 ` Nicolas Pitre
2019-01-05 16:34 ` Nicolas Pitre
2019-01-07 19:19 ` Nick Desaulniers
2019-01-07 19:19 ` 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=20181205183606.GA7274@flashbox \
--to=natechancellor@gmail.com \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=ndesaulniers@google.com \
--cc=nicolas.pitre@linaro.org \
--cc=stefan@agner.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.