Skip to contentSkip to conversation

is this a known hppa64-linux-ld bug?

parisc-linux Randolph Chung 3 participants 5 messages Sep 11, 2004

lore
Share & tools
lore
#0 lore raw

i'm doing some experiments with code that contains:

.section .text.function, "ax"
....
1: stw %r19,(%sr3,%r20)
2: /* some other insn */
....

.section .fixup, "ax"
3: b,l 2b
.previous

.section __ex_table, "aw"
.dword 1b,3b
.previous

when this code is compiled and assembled, i can see in the disassembly that the insn at "3:" contains a PCREL17F reloc against .text.function+xxx which is pointing to the location of "2:". So far so good...

But after linking with the rest of the kernel, the b,l address at "3:" is wrong (it points to an address that is an offset from the __ex_table section).

not sure why this is happening, but it looks like a ld bug?

does anybody have a suggestion for a workaround?

randolph

Signature · 7 lines
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
#1 lore raw
Quoted 2 lines

when this code is compiled and assembled, i can see in the disassembly that the insn at "3:" contains a PCREL17F reloc against

Not a PCREL22F?

Quoted 8 lines

.text.function+xxx which is pointing to the location of "2:". So far so good...

But after linking with the rest of the kernel, the b,l address at "3:" is wrong (it points to an address that is an offset from the __ex_table section).

not sure why this is happening, but it looks like a ld bug?

Does it point to a long branch stub? I've had trouble with this before when trying to use sibcalls. There's only one stub table and if you can't get there you're scuppered. Since your branch is in a different section from the target, you may need a long branch stub.

This needs to be fixed but no one has time to work on it.

Dave

Signature · 6 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
#2 lore raw

In reference to a message from John David Anglin, dated Sep 11:

Quoted 4 lines
Quoted 2 lines

when this code is compiled and assembled, i can see in the disassembly that the insn at "3:" contains a PCREL17F reloc against

Not a PCREL22F?

no, i think you get a PCRLE22F only if the link register is r2, right?

Quoted 5 lines

Does it point to a long branch stub? I've had trouble with this before when trying to use sibcalls. There's only one stub table and if you can't get there you're scuppered. Since your branch is in a different section from the target, you may need a long branch stub.

oh, right, it's that problem again.... :-(

randolph

Signature · 7 lines
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
#3 lore raw
In reply to Randolph Chung
Quoted 1 line · Randolph Chung

does anybody have a suggestion for a workaround?

I'm glad you didn't say "good" work around. How about just building the stub ourselves:

3: ldil L%2b,%r19

	ldo	R%2b(%r19),%r19
	bv,n	0(%r19)

This is certainly more efficient than the linker could ever do since we know that even on LP64 the kernel lies under 4GB.

James

_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

#4 lore raw
Quoted 11 lines
Quoted 1 line

does anybody have a suggestion for a workaround?

I'm glad you didn't say "good" work around. How about just building the stub ourselves:

3: ldil L%2b,%r19

	ldo	R%2b(%r19),%r19
	bv,n	0(%r19)

This is certainly more efficient than the linker could ever do since we know that even on LP64 the kernel lies under 4GB.

If the branch always uses the same space register, you can shorten the above sequence to something like:

3: ldil L%2b,%r19

	be,n	R%2b(%sr4,%r19)

Dave

Signature · 6 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux