All of lore.kernel.org
 help / color / mirror / Atom feed
From: jonathan.austin@arm.com (Jonathan Austin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] arm: decompressor: initialize PIC offset base register for uClinux tools
Date: Mon, 04 Feb 2013 12:20:52 +0000	[thread overview]
Message-ID: <510FA7A4.5030409@arm.com> (raw)
In-Reply-To: <20130204120708.GB17786@n2100.arm.linux.org.uk>

On 04/02/13 12:07, Russell King - ARM Linux wrote:
> On Mon, Feb 04, 2013 at 12:00:00PM +0000, Jonathan Austin wrote:
>> You seem to have understood! Specifying -mno-single-pic-base
>> means the compiler *won't* expect r9 to point to the GOT, but also
>> means r9 is free as a general purpose register, the effect that I
>> believe gives the performance improvement in the decompresser.
>>
>> Perhaps the context missing is that these are two independent patch
>> suggestions that achieve the same thing in different ways (that is,
>> they stop the decompresser running off to some incorrect memory location
>> because r9 isn't set-up). The -mno-single-pic base patch does it by not
>> using r9 as a PIC offset, and the 'initialise r9' patch does what it says
>> on the tin.
>>
>> As you see, I benchmarked them and got the opposite result to what I
>> expected (IE -mno-songle-pic-base is quicker), so, based also on
>> Nicolas's Ack, would now champion a different patch to the original one
>> that I posted...
>>
>> This is probably overkill, but here's a simple C example for comparison:
>> $cat pic.c
>> ----------------
>> int foo;
>> int ret_foo()
>> {
>> 	return foo;
>> }
>> ----------------
>> $arm-none-uclinux-uclibceabi-gcc -O2 -fPIC -S pic.c -o pic.s
>> $cat pic.s
>> -------------
>> [...]
>> ret_foo:
>> 	ldr	r3, .L2
>> 	ldr	r3, [r9, r3]
>> 	ldr	r0, [r3, #0]
>> 	bx	lr
>> .L3:
>> 	.align	2
>> .L2:
>> 	.word	foo(GOT)
>> 	.size	ret_foo, .-ret_foo
>
> Ah, so the problem is that the default for single-pic-base is different
> with uclinux compilers from other compilers.  Other compilers will
> default to -mno-single-pic-base, but what your build above shows is that
> for your compiler, your default is -msingle-pic-base.
>
> So, passing -mno-single-pic-base means that you're actually _restoring_
> the compiler behaviour that we're expecting for the decompressor.
>

Ahh, I see.

My experience is that my toolchain behaves much like most other uclinux 
toolchains - I've just checked:
- Codesourcery
- A Pengutronix one for the M3
- An ARM one

And they all default to using r9.

So shall I put the -m*no*-single-pic-base one in to the patch system?

Jonny

  reply	other threads:[~2013-02-04 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 17:29 [RFC PATCH] arm: decompressor: initialize PIC offset base register for uClinux tools Jonathan Austin
2013-01-29 20:13 ` Nicolas Pitre
2013-02-01 16:43   ` Jonathan Austin
2013-02-01 18:07     ` Nicolas Pitre
2013-02-01 18:18     ` Russell King - ARM Linux
2013-02-04 12:00       ` Jonathan Austin
2013-02-04 12:07         ` Russell King - ARM Linux
2013-02-04 12:20           ` Jonathan Austin [this message]
2013-02-04 12:23             ` Russell King - ARM Linux

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=510FA7A4.5030409@arm.com \
    --to=jonathan.austin@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 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.