From: Dave.Martin@arm.com (Dave P Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: force linker to use PIC veneers
Date: Mon, 30 Mar 2015 13:06:12 +0100 [thread overview]
Message-ID: <20150330120612.GB22336@e103592.cambridge.arm.com> (raw)
In-Reply-To: <CAKv+Gu8Wr7MY6ogMjNFBDU=GMgYrFga7CD5-kf2msSH5vk+ubQ@mail.gmail.com>
On Fri, Mar 27, 2015 at 12:01:03AM +0000, Ard Biesheuvel wrote:
> On 26 March 2015 at 14:19, Dave P Martin <Dave.Martin@arm.com> wrote:
> > On Thu, Mar 26, 2015 at 01:05:09PM +0000, Ard Biesheuvel wrote:
> >> On 26 March 2015 at 13:53, Dave P Martin <Dave.Martin@arm.com> wrote:
[...]
> > THUMB2_KERNEL generates a kernel which is very nearly 100% Thumb
> > code, so BX should be very rare when veneers are not involved.
> >
> >> > Ard, can you should build a couple of !THUMB2_KERNEL/pre-v5
> >> > configurations with your change and check, just to be sure?
> >> >
[...]
> ARM kernel with --pic-veneer:
> =============================
> $ readelf -A vmlinux
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "4T"
> Tag_CPU_arch: v4T
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-1
> [...]
>
> $ size vmlinux
> text data bss dec hex filename
> 38287123 13496224 9589540 61372887 3a879d7 vmlinux
>
> $ grep -c veneer System.map
> 493
>
> Veneers look like this:
>
> c247d53c <__sys_write_veneer>:
> c247d53c: e59fc000 ldr ip, [pc]
> c247d540: e08ff00c add pc, pc, ip
> c247d544: fdd3aa8c .word 0xfdd3aa8c
>
> c247d548 <__init_rt_rq_veneer>:
> c247d548: e59fc000 ldr ip, [pc]
> c247d54c: e08ff00c add pc, pc, ip
> c247d550: fdbf9600 .word 0xfdbf9600
>
> c247d554 <__read_boot_clock_veneer>:
> c247d554: e59fc000 ldr ip, [pc]
> c247d558: e08ff00c add pc, pc, ip
> c247d55c: fdb91310 .word 0xfdb91310
>
> Thumb2 kernel with --pic-veneer
> ===============================
> Attribute Section: aeabi
> File Attributes
> Tag_CPU_name: "7-A"
> Tag_CPU_arch: v7
> Tag_CPU_arch_profile: Application
> Tag_ARM_ISA_use: Yes
> Tag_THUMB_ISA_use: Thumb-2
> [...]
>
> $ size vmlinux
> text data bss dec hex filename
> 29353740 13644128 9614052 52611920 322cb50 vmlinux
>
> $ grep -c veneer System.map
> 1928
>
> Veneers look like this:
>
> c014f9d8 <____down_interruptible_veneer>:
> c014f9d8: e59fc004 ldr ip, [pc, #4]
> c014f9dc: e08fc00c add ip, pc, ip
> c014f9e0: e12fff1c bx ip
> c014f9e4: 0128de45 .word 0x0128de45
>
> c014f9e8 <___raw_write_unlock_veneer>:
> c014f9e8: 4778 bx pc
> c014f9ea: 46c0 nop
> c014f9ec: e59fc004 ldr ip, [pc, #4]
> c014f9f0: e08fc00c add ip, pc, ip
> c014f9f4: e12fff1c bx ip
> c014f9f8: 012901e1 .word 0x012901e1
>
> c014f9fc <____mutex_unlock_slowpath_veneer>:
> c014f9fc: e59fc004 ldr ip, [pc, #4]
> c014fa00: e08fc00c add ip, pc, ip
> c014fa04: e12fff1c bx ip
> c014fa08: 0128d8e1 .word 0x0128d8e1
>
> $ arm-linux-gnueabihf-objdump -d vmlinux |grep -E bx\\s+pc -c
> 319
>
> This number does not change when adding --use-blx, so there is probably not
> much point in adding it.
Fair enough -- thanks for checking.
Cheers
---Dave
next prev parent reply other threads:[~2015-03-30 12:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-24 10:16 [PATCH] ARM: force linker to use PIC veneers Ard Biesheuvel
2015-03-24 12:22 ` Dave Martin
2015-03-24 12:50 ` Ard Biesheuvel
2015-03-24 13:54 ` Dave Martin
2015-03-24 14:04 ` Ard Biesheuvel
2015-03-24 15:23 ` Nicolas Pitre
2015-03-24 17:35 ` Ard Biesheuvel
2015-03-25 10:46 ` Dave Martin
2015-03-26 11:36 ` Russell King - ARM Linux
2015-03-26 12:20 ` Ard Biesheuvel
2015-03-26 12:22 ` Russell King - ARM Linux
2015-03-26 12:24 ` Ard Biesheuvel
2015-03-26 12:53 ` Dave P Martin
2015-03-26 13:05 ` Ard Biesheuvel
2015-03-26 13:19 ` Dave P Martin
2015-03-27 0:01 ` Ard Biesheuvel
2015-03-30 12:06 ` Dave P Martin [this message]
2015-03-24 15:16 ` Nicolas Pitre
2015-03-24 15:23 ` Ard Biesheuvel
2015-03-24 15:49 ` Nicolas Pitre
2015-03-24 15:51 ` Ard Biesheuvel
2015-03-24 23:25 ` Russell King - ARM Linux
2015-03-24 23:30 ` Ard Biesheuvel
2015-03-24 15:41 ` Ard Biesheuvel
2015-03-24 16:42 ` Nicolas Pitre
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=20150330120612.GB22336@e103592.cambridge.arm.com \
--to=dave.martin@arm.com \
--cc=linux-arm-kernel@lists.infradead.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