public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Linker Relaxations in the CRIS
@ 2005-01-19 18:54 Ravi Ramaseshan
  2005-01-20  2:47 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 2+ messages in thread
From: Ravi Ramaseshan @ 2005-01-19 18:54 UTC (permalink / raw)
  To: binutils

Hi,

I have been trying to study linker relaxations. I've been trying to
get the cris linker to relax with the following code:

<quote: foo.s>

.text
.global foo
.align 4

foo:

not     $r0
beq     bar
not     $r0

</quote: foo.s>

<quote: bar.s>

.text
.global bar
.align 4

bar:

not     $r0

</quote: bar.s>

Could you please help me by sending me some code which gets relaxed.

TIA.

Regards,
Ravi.

-- 
" All man's miseries derive from not being able to sit in a room alone. "
- Blaise Pascal

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Linker Relaxations in the CRIS
  2005-01-19 18:54 Linker Relaxations in the CRIS Ravi Ramaseshan
@ 2005-01-20  2:47 ` Hans-Peter Nilsson
  0 siblings, 0 replies; 2+ messages in thread
From: Hans-Peter Nilsson @ 2005-01-20  2:47 UTC (permalink / raw)
  To: Ravi Ramaseshan; +Cc: binutils

On Wed, 19 Jan 2005, Ravi Ramaseshan wrote:

> I have been trying to study linker relaxations. I've been trying to
> get the cris linker to relax with the following code:

The CRIS GNU AS/GAS port does assembly-time code relaxations.
However, the CRIS GNU LD port does *not* support linker code
relaxations.

A little of the reason is that IMHO linker relaxations are prone
to bugs: you manage to shrink code, but did you manage to
correctly adjust *all* the places that depend on the exact size
and shortened distance between labels on either side of the
removed code?  Have you tested all cases including ones that
straddle the different limits?  I guess most of the problem
cases may be "solved" by not doing linker relaxation when debug
information or exception tables are present.

Most of the reason though, is that CRIS does not have the type
of instructions that would benefit from linker relaxation for
normal use, as emitted by the GCC CRIS port (nor have I been
able to imagine related improvements; I'd be interested though).
You suggest conditional branches across object files, but GCC
doesn't emit such code.  Even unconditional branches are usually
within a function.

It can be argued that a counter-example is inter-section
branches, as in GCC hot/cold code partitioning, which may now or
in the not-too-distant future use conditional branches.  But
such branches are likely to anyway be separate by more than
32KiB, the largest branch reach for a CRIS conditional branch.
That is, such a branch is likely to be expanded anyway at link
time to a sequence that reaches 2GiB, as is already done at
assembly time for external or too-far-away symbols.

> Could you please help me by sending me some code which gets relaxed.

No, trivially because there is no such code.  For ports that do
support linker relaxation, look in their respective
target-specific linker test-suite.  If there are ports that do
support relaxation but do not have test-cases for it, ignore
them; they're likely broken.

For the CRIS assembly-time relaxation tests, grep for relax in
gas/testsuite/gas/cris.

brgds, H-P

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-20  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-19 18:54 Linker Relaxations in the CRIS Ravi Ramaseshan
2005-01-20  2:47 ` Hans-Peter Nilsson

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 read-only IMAP folder(s) and NNTP newsgroup(s).