All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH, RFC, RFT] ARM relocation fixes
Date: Tue, 03 Dec 2013 13:00:34 +0100	[thread overview]
Message-ID: <529DC7E2.3080307@gmail.com> (raw)
In-Reply-To: <20131203111609.GT24997@rocoto.smurfnet.nu>

[-- Attachment #1: Type: text/plain, Size: 3081 bytes --]

On 03.12.2013 12:16, Leif Lindholm wrote:
> On Tue, Dec 03, 2013 at 10:31:13AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>>>> I meant that you can use conditions with bl but not blx. So if we have a
>>>> reloc on ARM bl.e targetting Thumb then we have to add veneers. Since we
>>>> have only small number of interworking calls it's probably easier to
>>>> always add veneers on interworking relative relocations rather than
>>>> having micro-optimisation and get some minor case wrong.
>>>
>>> OK, but the only place we could ever have a problem with this would
>>> be if we had asm in the kernel _explicitly_ done as .thumb.
>>> Which we don't. We explicitly moved away from that in order to have
>>> support for pre-v7 processors.
>>>
>> We also call C code from asm. One such instance (for division
>> instructions) caused the problem
>>> All modules will have full 32-bit external references, so will not
>>> use these instructions anyway. Any internal references within modules
>>> will be linked with LD, which will fix this up automatically.
>>>
>> In my small test I compiled:
>> extern void g(void);
>>
>> void f (int x)
>> {
>>   if (!x)
>>     g();
>> }
>> And got following assembly with -Os:
>>
>>    0:	e3500000 	cmp	r0, #0
>>    4:	e92d4008 	push	{r3, lr}
>>    8:	0bfffffe 	bleq	0 <g>
>> 			8: R_ARM_JUMP24	g
>>    c:	e8bd4008 	pop	{r3, lr}
>>   10:	e12fff1e 	bx	lr
>>
>> If g is a function in thumb kernel or thumb module then you need a veneer.
> 
> Ok, you got me. Didn't consider -Os.
> But the second case would still be auto-added by the linker.
> 
LD in -r mode doesn't always resolve all relocs
> But what is the objection to -mlong-calls?
> 
Originally it was from my experiments with clang. It doesn't accept
-mlong-calls. But clang isn't enough of motivation for this complexity,
far from it. My motivation is to have a robust dynamic linker with
interwork possibilities, that we won't have to rewrite when new compiler
changes behaviour or if we decide to decrease the requirement to armv4.
I think, I'll make build system add -mlong-calls if it's supported by
compiler.
> My armv7 kernel ends up only slightly larger with this option (57272
> bytes vs. 57088) - 184 bytes, from which 12 bytes per veneer can be
> subtracted. And the overall arm-efi directory is smaller (10031244 vs.
> 10254924). For just the *.mod too (1229498 vs. 1234034).
> 
> When compiling for For ARM (A32) (i.e. armv6), there is no difference
> in kernel size, but modules do grow 1.8% from 1477726 to 1503986.
I'm confused by numbers: I don't see which ones relate to which configs
(long-calls/no-long-calls A32/T16/T32)
> But is it really worth adding complexity to grub-mkimage for a small
> benefit to legacy platforms only? Could we instead add an arm_cflags
> with -mlong-calls for kernel in Makefile.core.def?
> 
> /
>     Leif
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

  reply	other threads:[~2013-12-03 12:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-01  6:06 [PATCH, RFC, RFT] ARM relocation fixes Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 10:53 ` Leif Lindholm
2013-12-02 10:58   ` Leif Lindholm
2013-12-02 10:59   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 11:28     ` Leif Lindholm
2013-12-02 11:43       ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 11:46       ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 13:30         ` Leif Lindholm
2013-12-02 14:14           ` Leif Lindholm
2013-12-02 14:33             ` Leif Lindholm
2013-12-02 17:32               ` Leif Lindholm
2013-12-02 17:40                 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 17:38             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 17:45           ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 19:40             ` Leif Lindholm
2013-12-02 20:04               ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-02 20:46                 ` Leif Lindholm
2013-12-03  5:37                   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-03  8:14                     ` Leif Lindholm
2013-12-03  8:22                       ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-03  8:47                         ` Leif Lindholm
2013-12-03  9:31                           ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-03 11:16                             ` Leif Lindholm
2013-12-03 12:00                               ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-12-03  8:09                   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-03 11:23                     ` Leif Lindholm

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=529DC7E2.3080307@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.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 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.