All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [parisc-linux] Get rid of %r8 linker stubs
@ 2000-07-04 22:33 bame
  2000-07-05  0:36 ` Alan Modra
  0 siblings, 1 reply; 17+ messages in thread
From: bame @ 2000-07-04 22:33 UTC (permalink / raw)
  To: alan, parisc-linux


Unfortunately it looks like a couple of us are unable to build
working user-space executables with the no-%r8 linker.  I tried re-linking
with the old (16-June) one and that works (but of course that linker
can't link large executables).  So starting with:

	main(){}

I used both the 16-June and today's binutils.  It appears the "broken"
executable is running or sleeping (unlikely?) and it doesn't panic
the system.  I disassembled both versions and the _init sections are
a bit different, which isn't surprising, but also doesn't look right
to me.  Here's the one which works, using the old %r8 stub method:

000010b4 <_init>:
    10b4:       6b c2 3f d9     stw rp,-14(sr0,sp)
    10b8:       37 de 00 80     ldo 40(sp),sp
    10bc:       6b d3 3f c1     stw r19,-20(sr0,sp)
    10c0:       6b c4 3f 81     stw r4,-40(sr0,sp)
    /* jsr through stub to __gmon_start */
    10c4:       e5 00 22 f4     be,l 1178(sr4,r8),%sr0,%r31
    10c8:       08 13 02 44     copy r19,r4
    /* jsr through stub to __do_global_ctors_aux */
    10cc:       e5 00 22 bc     be,l 115c(sr4,r8),%sr0,%r31
    10d0:       08 00 02 40     nop
    10d4:       4b c2 3f 59     ldw -54(sr0,sp),rp
    10d8:       e8 40 c0 00     bv r0(rp)
    10dc:       4f c4 3f 81     ldw,mb -40(sr0,sp),r4

And here's the new one which fails.  Looks like maybe the %rp is
not being set, or the linker's overwriting a branch in a funny
way or something:

000010bc <_init>:
    10bc:       6b c2 3f d9     stw rp,-14(sr0,sp)
    10c0:       37 de 00 80     ldo 40(sp),sp
    10c4:       6b d3 3f c1     stw r19,-20(sr0,sp)
    10c8:       6b c4 3f 81     stw r4,-40(sr0,sp)
    /* jsr through local stub to __gmon_start */
    10cc:       e8 5f 1f c5     b,l 10b4 <_init-0x8>,rp
    10d0:       08 13 02 44     copy r19,r4
    /* branch to __do_global_ctors_aux !!! rp was never set !!! */
    10d4:       20 2b 40 00     ldil 56000,r1
    10d8:       e0 20 26 ba     be,n 35c(sr4,r1)
    /* nullified instruction -- otherwise it'd be an infinite loop */
    10dc:       e8 5f 1f e5     b,l 10d4 <_init+0x18>,rp
    10e0:       08 00 02 40     nop
    10e4:       4b c2 3f 59     ldw -54(sr0,sp),rp
    10e8:       e8 40 c0 00     bv r0(rp)
    10ec:       4f c4 3f 81     ldw,mb -40(sr0,sp),r4

Help?

	-Paul Bame

^ permalink raw reply	[flat|nested] 17+ messages in thread
* [parisc-linux] Get rid of %r8 linker stubs
@ 2000-06-21 14:07 Alan Modra
  2000-06-22 20:33 ` Paul Bame
  0 siblings, 1 reply; 17+ messages in thread
From: Alan Modra @ 2000-06-21 14:07 UTC (permalink / raw)
  To: parisc-linux

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1292 bytes --]

Hello all,
   The attached patch to puffin.external.hp.com CVS binutils-2.10
implements a new linker stub scheme for elf32-hppa.  (Well, it's new for
gnu - I believe the hp linker does something like this).

The new scheme works like this:  For any linker input section that needs a
stub to reach called routines, the linker creates a stub section located
immediately prior to the input section.  A call is simply redirected to
the stub, which consists of a long branch
  ldil LR'XXX,%r1
  be,n RR'XXX(%sr4,%r1)
to the destination.

The old scheme had a single stub section, and out-of-range calls changed
the call instruction from "b,l faraway,%r2" to "be,l stub(%sr4,%r8)".
This of course dedicates a register to point to the stubs, and has some
serious problems caused by changing the return pointer from the normal %r2
to the implicit %r31 used by "be,l".  Additionally, when we finally
implement elf32-hppa shared libraries, there are going to be a _lot_ more
stubs.  We may even exceed the maximum 256k of stubs, especially if we try
to combine .plt and .got with stubs to get a register back.

Anyway, I'd appreciate some brave souls testing out this patch.  A few
positive reports and I'll check the lot in to pehc.

Regards, Alan Modra
-- 
Linuxcare.  Support for the Revolution.




[-- Attachment #2: Type: APPLICATION/octet-stream, Size: 20092 bytes --]

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

end of thread, other threads:[~2000-07-05  7:30 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-07-04 22:33 [parisc-linux] Get rid of %r8 linker stubs bame
2000-07-05  0:36 ` Alan Modra
2000-07-05  0:57   ` Ulrich Drepper
2000-07-05  1:52     ` bame
2000-07-05  2:38       ` Alan Modra
2000-07-05  1:55     ` Alan Modra
2000-07-05  2:58   ` bame
2000-07-05  6:43     ` Patric Karlstrom
2000-07-05  6:26       ` willy
  -- strict thread matches above, loose matches on Subject: below --
2000-06-21 14:07 Alan Modra
2000-06-22 20:33 ` Paul Bame
2000-06-22 20:35   ` Jeffrey A Law
2000-06-23  1:45   ` Alan Modra
2000-06-23 10:34     ` Alan Modra
2000-07-03 19:15       ` willy
2000-07-04 14:21     ` willy
2000-07-05  0:38       ` Alan Modra

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.